carrot/roots-buildpack-sample — pull request #3 by zeke (2014-03-30 04:26:11+00:00)
Title: add app.json

I still don't have this thing running locally, but the `app.json` manifest is working!

Eventually support for this will make its way into the Heroku CLI and will also be honored on first push with a regular old `git push heroku master`, but for now you have to use the nascent Heroku Build API. Here's the current rough-around-the-edges way to spawn a new app with a bash function:

```sh
$ concoct zeke/roots-buildpack-sample
```

```sh
concoct() {
host="https://nyata.herokuapp.com"
tarball_url="https://codeload.github.com/${1}/legacy.tar.gz/master"
token=$(heroku auth:token)

echo "\nConcocting..."
echo $tarball_url

api_response=$(curl \
-u :$token \
-X POST \
--silent \
-H 'Content-Type: application/json' \
-d "{ \"source_blob\": { \"url\": \"$tarball_url\" } }" \
$host/builds)

echo "\nAPI Response"
echo $api_response

echo "\nBuild ID"
build_id=$(echo $api_response | jq -r .id)
echo $build_id

echo "\nBuild Status URL"
status_url="$host/builds/$build_id"
echo $status_url

# status is a reserved word in bash
state="pending"
while [ $state == "pending" ]; do
status_response=$(curl \
-u :$token \
--silent \
-H 'Content-Type: application/json' \
$status_url)
state=$(echo $status_response | jq -r .status)
echo "\nStatus"
echo $status_response
sleep 1
done
}
```