This repository has been archived by the owner on Feb 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "convert commands to oclif v7 style (#45)"
This reverts commit 7a7a4f6. This seems to not be working right with `heroku local` and `heroku local:start`
- Loading branch information
Showing
12 changed files
with
740 additions
and
218 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict' | ||
|
||
const co = require('co') | ||
const cli = require('heroku-cli-util') | ||
const {FileCompletion} = require('@heroku-cli/command/lib/completions') | ||
|
||
function * run (context) { | ||
if (context.args.length < 1) { | ||
cli.error('Usage: heroku local:run [COMMAND]\nMust specify command to run') | ||
process.exit(-1) | ||
} | ||
|
||
let execArgv = ['run'] | ||
|
||
if (context.flags.env) execArgv.push('--env', context.flags.env) | ||
if (context.flags.port) execArgv.push('--port', context.flags.port) | ||
|
||
execArgv.push('--') // disable node-foreman flag parsing | ||
execArgv.push(...context.args) | ||
|
||
yield require('../lib/fork_foreman')(execArgv) | ||
} | ||
|
||
module.exports = { | ||
topic: 'local', | ||
command: 'run', | ||
description: 'run a one-off command', | ||
help: `Example: | ||
heroku local:run bin/migrate`, | ||
variableArgs: true, | ||
flags: [ | ||
{name: 'env', char: 'e', hasValue: true, completion: FileCompletion}, | ||
{name: 'port', char: 'p', hasValue: true} | ||
], | ||
run: cli.command(co.wrap(run)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use strict' | ||
|
||
const co = require('co') | ||
const cli = require('heroku-cli-util') | ||
const {FileCompletion} = require('@heroku-cli/command/lib/completions') | ||
|
||
function * run (context) { | ||
if (context.flags.restart) throw new Error('--restart is no longer available\nUse forego instead: https://github.com/ddollar/forego') | ||
if (context.flags.concurrency) throw new Error('--concurrency is no longer available\nUse forego instead: https://github.com/ddollar/forego') | ||
|
||
let execArgv = ['start'] | ||
|
||
if (context.flags.procfile) execArgv.push('--procfile', context.flags.procfile) | ||
if (context.flags.env) execArgv.push('--env', context.flags.env) | ||
if (context.flags.port) execArgv.push('--port', context.flags.port) | ||
if (context.args.processname) { | ||
execArgv.push(context.args.processname) | ||
} else { | ||
let procfile = context.flags.procfile || 'Procfile' | ||
let procHash = require('@heroku/foreman/lib/procfile.js').loadProc(procfile) | ||
let processes = Object.keys(procHash).filter((x) => x !== 'release') | ||
execArgv.push(processes.join(',')) | ||
} | ||
yield require('../lib/fork_foreman')(execArgv) | ||
} | ||
|
||
const cmd = { | ||
topic: 'local', | ||
description: 'run heroku app locally', | ||
help: `Start the application specified by a Procfile (defaults to ./Procfile) | ||
Examples: | ||
heroku local | ||
heroku local web | ||
heroku local web=2 | ||
heroku local web=1,worker=2`, | ||
args: [{name: 'processname', optional: true}], | ||
flags: [ | ||
{name: 'procfile', char: 'f', hasValue: true, description: 'use a different Procfile', completion: FileCompletion}, | ||
{name: 'env', char: 'e', hasValue: true, description: 'location of env file (defaults to .env)', completion: FileCompletion}, | ||
{name: 'port', char: 'p', hasValue: true, description: 'port to listen on'}, | ||
{name: 'restart', char: 'r', hasValue: false, hidden: true, description: 'restart process if it dies'}, | ||
{name: 'concurrency', char: 'c', hasValue: true, hidden: true, description: 'number of processes to start'} | ||
], | ||
run: cli.command(co.wrap(run)) | ||
} | ||
|
||
module.exports = [ | ||
cmd, | ||
Object.assign({command: 'start'}, cmd) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict' | ||
|
||
const co = require('co') | ||
const cli = require('heroku-cli-util') | ||
|
||
function * run () { | ||
let execArgv = ['--version'] | ||
yield require('../lib/fork_foreman')(execArgv) | ||
} | ||
|
||
module.exports = { | ||
topic: 'local', | ||
command: 'version', | ||
description: 'display node-foreman version', | ||
help: 'Display node-foreman version', | ||
run: cli.command(co.wrap(run)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict' | ||
|
||
const flatten = require('lodash.flatten') | ||
|
||
exports.topic = { | ||
name: 'local', | ||
description: 'run heroku app locally' | ||
} | ||
|
||
exports.commands = flatten([ | ||
require('./commands/start'), | ||
require('./commands/run'), | ||
require('./commands/version') | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.