File tree Expand file tree Collapse file tree 11 files changed +103
-90
lines changed Expand file tree Collapse file tree 11 files changed +103
-90
lines changed Original file line number Diff line number Diff line change 11/* jshint node: true */
22'use strict' ;
33
4- var commands = require ( './lib/commands' ) ;
5-
64module . exports = {
7- name : 'ember-micro-addon' ,
8-
9- includedCommands : function ( ) {
10- return commands ;
11- }
5+ name : 'ember-micro-addon'
126} ;
Original file line number Diff line number Diff line change 11#! /usr/bin/env node
22
3+ var program = require ( 'commander' ) ;
4+
5+ var dasherize = require ( '../utils/string' ) . dasherize ;
6+ var Promise = require ( '../ext/promise' ) ;
37var ui = require ( '../ui' ) ;
48
5- require ( '../commands/component' ) . validateAndRun ( [ process . argv [ 2 ] ] )
6- . catch ( ui . error )
7- . finally ( process . exit ) ;
9+ function validateOptions ( options ) {
10+ return new Promise ( function ( resolve , reject ) {
11+ if ( ! options . addonName ) {
12+ reject ( 'You must provide a name of the component you wisth to generate.' ) ;
13+ } else {
14+ resolve ( options ) ;
15+ }
16+ } ) ;
17+ }
18+
19+ function run ( options ) {
20+ return require ( '../tasks/component' ) ( options ) ;
21+ }
22+
23+ program
24+ . arguments ( '<addonName>' )
25+ . action ( function ( addonName ) {
26+ program . addonName = addonName ;
27+ } )
28+ . parse ( process . argv ) ;
29+
30+ var options = {
31+ addonName : dasherize ( program . addonName )
32+ } ;
33+
34+ return validateOptions ( options )
35+ . then ( run )
36+ . catch ( ui . error ) ;
Original file line number Diff line number Diff line change 11#! /usr/bin/env node
22
3+ var program = require ( 'commander' ) ;
4+
5+ var dasherize = require ( '../utils/string' ) . dasherize ;
6+ var Promise = require ( '../ext/promise' ) ;
37var ui = require ( '../ui' ) ;
48
5- require ( '../commands/helper' ) . validateAndRun ( [ process . argv [ 2 ] ] )
6- . catch ( ui . error )
7- . finally ( process . exit ) ;
9+ function validateOptions ( options ) {
10+ return new Promise ( function ( resolve , reject ) {
11+ if ( ! options . addonName ) {
12+ reject ( 'You must provide a name of the helper you wisth to generate.' ) ;
13+ } else {
14+ resolve ( options ) ;
15+ }
16+ } ) ;
17+ }
18+
19+ function run ( options ) {
20+ return require ( '../tasks/helper' ) ( options ) ;
21+ }
22+
23+ program
24+ . arguments ( '<addonName>' )
25+ . action ( function ( addonName ) {
26+ program . addonName = addonName ;
27+ } )
28+ . parse ( process . argv ) ;
29+
30+ var options = {
31+ addonName : dasherize ( program . addonName )
32+ } ;
33+
34+ return validateOptions ( options )
35+ . then ( run )
36+ . catch ( ui . error ) ;
Original file line number Diff line number Diff line change 11#! /usr/bin/env node
22
3+ var program = require ( 'commander' ) ;
4+
5+ var dasherize = require ( '../utils/string' ) . dasherize ;
6+ var Promise = require ( '../ext/promise' ) ;
37var ui = require ( '../ui' ) ;
48
5- require ( '../commands/library' ) . validateAndRun ( [ process . argv [ 2 ] ] )
6- . catch ( ui . error )
7- . finally ( process . exit ) ;
9+ function validateOptions ( options ) {
10+ return new Promise ( function ( resolve , reject ) {
11+ if ( ! options . addonName ) {
12+ reject ( 'You must provide a name of the library you wisth to generate.' ) ;
13+ } else {
14+ resolve ( options ) ;
15+ }
16+ } ) ;
17+ }
18+
19+ function run ( options ) {
20+ return require ( '../tasks/library' ) ( options ) ;
21+ }
22+
23+ program
24+ . arguments ( '<addonName>' )
25+ . action ( function ( addonName ) {
26+ program . addonName = addonName ;
27+ } )
28+ . parse ( process . argv ) ;
29+
30+ var options = {
31+ addonName : dasherize ( program . addonName )
32+ } ;
33+
34+ return validateOptions ( options )
35+ . then ( run )
36+ . catch ( ui . error ) ;
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ module.exports = function(options) {
88 var blueprintName = "micro-component" ;
99 var blueprintFolderRelativePath = "../../blueprints" ;
1010 var blueprintPath = path . resolve ( __dirname , blueprintFolderRelativePath , blueprintName ) ;
11- var command = 'ember new ' + options . name + ' --blueprint ' + blueprintPath + ' --skip-npm --skip-bower --skip-git' ;
12- var msg = 'Creating micro-component in ./' + options . name ;
11+ var command = 'ember new ' + options . addonName + ' --blueprint ' + blueprintPath + ' --skip-npm --skip-bower --skip-git' ;
12+ var msg = 'Creating micro-component in ./' + options . addonName ;
1313 return runCommand ( command , msg , {
1414 cwd : process . cwd ( )
1515 } ) ( ) ;
Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ module.exports = function(options) {
88 var blueprintName = "micro-helper" ;
99 var blueprintFolderRelativePath = "../../blueprints" ;
1010 var blueprintPath = path . resolve ( __dirname , blueprintFolderRelativePath , blueprintName ) ;
11- var command = 'ember new ' + options . name + ' --blueprint ' + blueprintPath + ' --skip-npm --skip-bower --skip-git' ;
12- var msg = 'Creating micro-helper in ./' + options . name ;
11+ var command = 'ember new ' + options . addonName + ' --blueprint ' + blueprintPath + ' --skip-npm --skip-bower --skip-git' ;
12+ var msg = 'Creating micro-helper in ./' + options . addonName ;
1313 return runCommand ( command , msg , {
1414 cwd : process . cwd ( )
1515 } ) ( ) ;
You can’t perform that action at this time.
0 commit comments