Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to skip slug extraction #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion commands/slugs/download.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
let cli = require('heroku-cli-util')
let flags = require('cli-engine-heroku').flags;
let co = require('co')
let download = require('../../lib/download')

Expand All @@ -16,7 +17,9 @@ function* run (context, heroku) {
let slug = yield heroku.request({path: `/apps/${context.app}/slugs/${id}`})
exec(`mkdir ${context.app}`)
yield download(slug.blob.url, `${context.app}/slug.tar.gz`, {progress: true})
exec(`tar -xf ${context.app}/slug.tar.gz -C ${context.app}`)
if (!context.flags['no-extract']) {
exec(`tar -xf ${context.app}/slug.tar.gz -C ${context.app}`)
}
}

module.exports = {
Expand All @@ -25,6 +28,9 @@ module.exports = {
description: 'downloads a slug to <APP_NAME>/slug.tar.gz and then extracts it',
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about changing the description as well to reflect the possible option.

Suggested change
description: 'downloads a slug to <APP_NAME>/slug.tar.gz and then extracts it',
description: 'downloads a slug to <APP_NAME>/slug.tar.gz and then extracts it if `no-extract` option not provided.',

help: 'If SLUG_ID is not specified, returns the current slug.',
args: [{name: 'slug_id', optional: true}],
flags: {
'no-extract': flags.boolean({description: 'Do not extract slug after download'})
},
needsApp: true,
needsAuth: true,
run: cli.command(co.wrap(run))
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
},
"dependencies": {
"bytes": "2.4.0",
"cli-engine-command": "^9.0.7",
"cli-engine-config": "^3.5.0",
"cli-engine-heroku": "^5.0.4",
"co": "4.6.0",
"heroku-cli-util": "5.7.3",
"heroku-run": "3.2.14",
Expand Down