Skip to content

Commit

Permalink
Merge pull request #94 from mrb/all_command
Browse files Browse the repository at this point in the history
One command to run them all
  • Loading branch information
fivetanley committed Dec 17, 2015
2 parents 1c2ca9c + 8285284 commit 8b39fc3
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,27 @@ program
watson.replaceNeedsWithInjection(path);
});

program
.command('all')
.option('--tests-path [path]', 'Path to tests directory.', 'tests')
.option('--app-path [path]', 'Path to app directory.', 'app')
.option('--router-path [path]', 'Path to router file.', 'app/router.js')
.option('--acceptance-path [path]', 'Path to acceptance tests directory.', 'tests/acceptance')
.option('--controllers-path [path]', 'Path to controllers directory.', 'app/controllers')
.option('--output [format]', 'Output format: pretty or json.', 'pretty')
.description('Run all commands.')
.action(function(options) {
watson.transformQUnitTest(options.testsPath);
watson.transformPrototypeExtensions(options.appPath);
watson.transformEmberDataModelLookups(options.appPath);
watson.transformEmberDataAsyncFalseRelationships(options.appPath);
watson.transformResourceRouterMapping(options.routerPath);
watson.transformMethodify(options.appPath);
watson.findOverloadedCPs(options.appPath).outputSummary(options.output);
watson.transformTestToUseDestroyApp(options.acceptancePath);
watson.replaceNeedsWithInjection(options.controllersPath);
});

module.exports = function init(args) {
program.parse(args);
};
29 changes: 29 additions & 0 deletions lib/commands/all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

var Watson = require('../../index');
var watson = new Watson();

module.exports = {
name: 'watson:all',
description: 'Performs all available Watson commands on a project.',
works: 'insideProject',
availableOptions: [
{ name: 'app-path', type: String, description: 'Path to app directory.', default: 'app' },
{ name: 'tests-path', type: String, description: 'Path to tests directory.', default: 'tests' },
{ name: 'router-path', type: String, description: 'Path to router file.', default: 'app/router.js' },
{ name: 'output', type: String, description: 'Output format: pretty or json.', default: 'pretty' },
{ name: 'acceptance-path', type: String, description: 'Path to acceptance tests directory.', default: 'tests/acceptance' },
{ name: 'controllers-path', type: String, description: 'Path to controllers directory.', default: 'app/controllers' },
],
run: function(options) {
watson.transformQUnitTest(options.testsPath);
watson.transformPrototypeExtensions(options.appPath);
watson.transformEmberDataModelLookups(options.appPath);
watson.transformEmberDataAsyncFalseRelationships(options.appPath);
watson.transformResourceRouterMapping(options.routerPath);
watson.transformMethodify(options.appPath);
watson.findOverloadedCPs(options.appPath).outputSummary(options.output);
watson.transformTestToUseDestroyApp(options.acceptancePath);
watson.replaceNeedsWithInjection(options.controllersPath);
}
};
1 change: 1 addition & 0 deletions lib/commands/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

module.exports = {
'watson:all': require('./all'),
'watson:upgrade-qunit-tests': require('./upgrade-qunit-tests'),
'watson:convert-prototype-extensions': require('./convert-prototype-extensions'),
'watson:convert-ember-data-model-lookups': require('./convert-ember-data-model-lookups'),
Expand Down

0 comments on commit 8b39fc3

Please sign in to comment.