1 | 'use strict'
|
2 |
|
3 | let co = require('co')
|
4 | let cli = require('heroku-cli-util')
|
5 | let helpers = require('../lib/helpers')
|
6 | let Dyno = require('../lib/dyno')
|
7 |
|
8 | function * run (context, heroku) {
|
9 | context.args.unshift('rake')
|
10 | let opts = {
|
11 | heroku: heroku,
|
12 | app: context.app,
|
13 | command: helpers.buildCommand(context.args),
|
14 | size: context.flags.size,
|
15 | 'exit-code': context.flags['exit-code'],
|
16 | env: context.flags.env,
|
17 | 'no-tty': context.flags['no-tty'],
|
18 | attach: true
|
19 | }
|
20 |
|
21 | let dyno = new Dyno(opts)
|
22 | try {
|
23 | yield dyno.start()
|
24 | } catch (err) {
|
25 | if (err.exitCode) {
|
26 | cli.error(err)
|
27 | process.exit(err.exitCode)
|
28 | } else throw err
|
29 | }
|
30 | }
|
31 |
|
32 | module.exports = {
|
33 | topic: 'rake',
|
34 | hidden: true,
|
35 | variableArgs: true,
|
36 | needsAuth: true,
|
37 | needsApp: true,
|
38 | flags: [
|
39 | { name: 'size', char: 's', description: 'dyno size', hasValue: true },
|
40 | { name: 'exit-code', char: 'x', description: 'passthrough the exit code of the remote command' },
|
41 | { name: 'env', char: 'e', description: "environment variables to set (use ';' to split multiple vars)", hasValue: true },
|
42 | { name: 'no-tty', description: 'force the command to not run in a tty', hasValue: false }
|
43 | ],
|
44 | run: cli.command(co.wrap(run))
|
45 | }
|