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

Commit

Permalink
standardify (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Apr 22, 2016
1 parent 0545d6d commit 87350fe
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 88 deletions.
16 changes: 16 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
engines:
duplication:
enabled: true
config:
languages:
- javascript
eslint:
enabled: false
fixme:
enabled: true
ratings:
paths:
- "**.js"
exclude_paths:
- test/
1 change: 0 additions & 1 deletion .jshintignore

This file was deleted.

47 changes: 0 additions & 47 deletions .jshintrc

This file was deleted.

24 changes: 12 additions & 12 deletions commands/run.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
'use strict';
'use strict'

let cli = require('heroku-cli-util');
let cli = require('heroku-cli-util')

function* run (context) {
function * run (context) {
if (context.args.length < 1) {
cli.error('Usage: heroku local:run [COMMAND]\nMust specify command to run');
process.exit(-1);
cli.error('Usage: heroku local:run [COMMAND]\nMust specify command to run')
process.exit(-1)
}

process.argv = ['', 'heroku local:run', 'run'];
process.argv = ['', 'heroku local:run', 'run']

if (context.flags.env) process.argv.push('--env', context.flags.env);
if (context.flags.port) process.argv.push('--port', context.flags.port);
if (context.flags.env) process.argv.push('--env', context.flags.env)
if (context.flags.port) process.argv.push('--port', context.flags.port)

process.argv.push('--'); // disable node-foreman flag parsing
process.argv.push(...context.args);
process.argv.push('--') // disable node-foreman flag parsing
process.argv.push(...context.args)

require('foreman/nf.js');
require('foreman/nf.js')
}

module.exports = {
Expand All @@ -32,4 +32,4 @@ module.exports = {
{name: 'port', char: 'p', hasValue: true}
],
run: cli.command(run)
};
}
34 changes: 17 additions & 17 deletions commands/start.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
'use strict';
'use strict'

let cli = require('heroku-cli-util');
let cli = require('heroku-cli-util')

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');
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')

process.argv = ['', 'heroku local', 'start'];
process.argv = ['', 'heroku local', 'start']

if (context.flags.procfile) process.argv.push('--procfile', context.flags.procfile);
if (context.flags.env) process.argv.push('--env', context.flags.env);
if (context.flags.port) process.argv.push('--port', context.flags.port);
if (context.args.processname) process.argv.push(context.args.processname);
if (context.flags.procfile) process.argv.push('--procfile', context.flags.procfile)
if (context.flags.env) process.argv.push('--env', context.flags.env)
if (context.flags.port) process.argv.push('--port', context.flags.port)
if (context.args.processname) process.argv.push(context.args.processname)

require('foreman/nf.js');
require('foreman/nf.js')
}

module.exports = {
Expand All @@ -30,11 +30,11 @@ Examples:
heroku local -f Procfile.test -e .env.test`,
args: [{name: 'processname', optional: true}],
flags: [
{name: 'procfile', char: 'f', hasValue: true, description: 'use a different Procfile'},
{name: 'env', char: 'e', hasValue: true, description: 'location of env file (defaults to .env)'},
{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'},
{name: 'procfile', char: 'f', hasValue: true, description: 'use a different Procfile'},
{name: 'env', char: 'e', hasValue: true, description: 'location of env file (defaults to .env)'},
{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(run)
};
}
12 changes: 6 additions & 6 deletions commands/version.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';
'use strict'

let cli = require('heroku-cli-util');
let cli = require('heroku-cli-util')

function* run () {
process.argv = ['', 'heroku local', '--version'];
require('foreman/nf.js');
function * run () {
process.argv = ['', 'heroku local', '--version']
require('foreman/nf.js')
}

module.exports = {
Expand All @@ -13,4 +13,4 @@ module.exports = {
description: 'display node-foreman version',
help: 'Display node-foreman version',
run: cli.command(run)
};
}
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
exports.topic = {
name: 'local',
description: 'run heroku app locally'
};
}

exports.commands = [
require('./commands/start'),
require('./commands/run'),
require('./commands/version')
];
]
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"author": "Jeff Dickey @dickeyxxx",
"scripts": {
"test": "jshint .",
"test": "standard | snazzy",
"preversion": "npm test",
"postversion": "npm publish && git push && git push --tags"
},
Expand All @@ -22,9 +22,10 @@
"license": "ISC",
"dependencies": {
"foreman": "1.4.1",
"heroku-cli-util": "5.9.1"
"heroku-cli-util": "5.10.10"
},
"devDependencies": {
"jshint": "^2.8.0"
"snazzy": "3.0.1",
"standard": "6.0.8"
}
}

0 comments on commit 87350fe

Please sign in to comment.