Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
added :start and :run commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jul 8, 2015
1 parent d5a3b05 commit 597f97d
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 28 deletions.
3 changes: 2 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
web: echo "it works!"
web: echo "it works (web)!"
worker: echo "it works (worker)!"
2 changes: 2 additions & 0 deletions Procfile.alternate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
web: echo "it works (web) (alternate)!"
worker: echo "it works (worker) (alternate)!"
19 changes: 12 additions & 7 deletions lib/commands/local.js → commands/run.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
'use strict';
let Forego = require('../forego');
let h = require('heroku-cli-util');

let Forego = require('../lib/forego');
let cli = require('heroku-cli-util');

function* run (context) {
let forego = new Forego(context.herokuDir);
yield forego.ensureSetup();
forego.start({args: context.args, flags: context.flags});
}

module.exports = {
topic: 'local',
command: 'run',
description: 'run heroku app locally',
default: true,
help: `Start the application specified by a Procfile (defaults to ./Procfile)
Examples:
Expand All @@ -20,9 +29,5 @@ Examples:
{name: 'port', char: 'p', hasValue: true},
{name: 'r', char: 'r', hasValue: false}
],
run: h.command(function* (ctx) {
let forego = new Forego(ctx.herokuDir);
yield forego.ensureSetup();
forego.start({args: ctx.args, flags: ctx.flags});
})
run: cli.command(run)
};
33 changes: 33 additions & 0 deletions commands/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

let Forego = require('../lib/forego');
let cli = require('heroku-cli-util');

function* run (context) {
let forego = new Forego(context.herokuDir);
yield forego.ensureSetup();
forego.start({args: context.args, flags: context.flags});
}

module.exports = {
topic: 'local',
command: 'start',
description: 'run heroku app locally',
default: true,
help: `Start the application specified by a Procfile (defaults to ./Procfile)
Examples:
heroku local
heroku local web
heroku local -f Procfile.test -e .env.test`,
args: [{name: 'processname', optional: true}],
flags: [
{name: 'procfile', char: 'f', hasValue: true},
{name: 'env', char: 'e', hasValue: true},
{name: 'concurrency', char: 'c', hasValue: true},
{name: 'port', char: 'p', hasValue: true},
{name: 'r', char: 'r', hasValue: false}
],
run: cli.command(run)
};
18 changes: 18 additions & 0 deletions commands/version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

let Forego = require('../lib/forego');
let cli = require('heroku-cli-util');

function* run (context) {
let forego = new Forego(context.herokuDir);
yield forego.ensureSetup();
forego.version();
}

module.exports = {
topic: 'local',
command: 'version',
description: 'display forego version',
help: 'Display forego version',
run: cli.command(run)
};
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
exports.topics = [{
exports.topic = {
name: 'local',
description: 'run heroku app locally'
}];
};

exports.commands = [
require('./lib/commands/local'),
require('./lib/commands/version')
require('./commands/start'),
require('./commands/run'),
require('./commands/version')
];
15 changes: 0 additions & 15 deletions lib/commands/version.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"license": "ISC",
"dependencies": {
"heroku-cli-util": "^1.10.3",
"heroku-cli-util": "^5.3.0",
"request": "^2.53.0"
}
}

0 comments on commit 597f97d

Please sign in to comment.