Permalink
Browse files

fix download manifest

  • Loading branch information...
1 parent 3702a2f commit 8a70b18ab88b29a0df4340d9237672d157cd54ee @ddollar committed May 30, 2012
Showing with 13 additions and 13 deletions.
  1. +5 −5 bin/compile
  2. +8 −8 lib/download_manifest.coffee
View
@@ -17,11 +17,11 @@ mkdir -p $cache_dir
# fetching app
echo -n "Recreating app from manifest... "
-# manifest=$(mktemp -t manifest_XXXXX)
-# curl -s $ANVIL_HOST/manifest/$id.json -o $manifest
-# bin/download_manifest $manifest $compile_dir >/dev/null
-cd $compile_dir
-curl -s $MANIFEST_TGZ -o- | tar xzf -
+manifest=$(mktemp -t manifest_XXXXX)
+curl -s $ANVIL_HOST/manifest/$id.json -o $manifest
+bin/download_manifest $manifest $compile_dir >/dev/null
+# cd $compile_dir
+# curl -s $MANIFEST_TGZ -o- | tar xzf -
echo "done"
# fetch buildpack
@@ -24,14 +24,14 @@ datastore_fetchers = (manifest, dir) ->
fetchers[file_manifest.hash] = (async_cb) =>
filename = "#{dir}/#{name}"
mkdirp path.dirname(filename), =>
- fs.open filename, "w", (err, fd) =>
- options = url.parse("#{process.env.ANVIL_HOST}/file/#{file_manifest["hash"]}")
- client = if options.protocol is "https:" then https else http
- client.get options, (get) ->
- get.on "data", (chunk) -> fs.write fd, chunk
- get.on "end", ->
- fs.fchmod fd, file_manifest.mode
- fs.close fd
+ file = fs.createWriteStream filename
+ options = url.parse("#{process.env.ANVIL_HOST}/file/#{file_manifest["hash"]}")
+ client = if options.protocol is "https:" then https else http
+ client.get options, (get) ->
+ get.on "data", (chunk) -> file.write chunk
+ get.on "end", ->
+ file.end()
+ fs.chmod filename, file_manifest.mode, (err) ->
async_cb null, true
module.exports.execute = (args) ->

0 comments on commit 8a70b18

Please sign in to comment.