-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jeff Escalante
committed
Mar 31, 2016
1 parent
8402639
commit 84b9b97
Showing
7 changed files
with
115 additions
and
117 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
var helpers = require('./../helpers') | ||
var path = require('path') | ||
|
||
module.exports = (function () { | ||
/* | ||
* Add a template. | ||
* @param {Function} cli - CLI instance. | ||
* @param {Object} args - CLI arguments. | ||
*/ | ||
return function (cli, args) { | ||
var name = args.name | ||
var src = helpers.isGitUrl(args.src) ? args.src : path.resolve(cli.cwd, args.src) | ||
return cli.sprout.add(name, src).then(function () { | ||
return cli.emitter.emit('success', 'template `' + name + '` from ' + src + ' added!') | ||
}) | ||
} | ||
}.call(this)) | ||
/* | ||
* Add a template. | ||
* @param {Function} cli - CLI instance. | ||
* @param {Object} args - CLI arguments. | ||
*/ | ||
module.exports = function (cli, args) { | ||
var name = args.name | ||
var src = helpers.isGitUrl(args.src) ? args.src : path.resolve(cli.cwd, args.src) | ||
return cli.sprout.add(name, src).then(function () { | ||
return cli.emitter.emit('success', 'template `' + name + '` from ' + src + ' added!') | ||
}) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
var W = require('when') | ||
var _ = require('lodash') | ||
|
||
module.exports = (function () { | ||
/* | ||
* List all templates. | ||
* @param {Function} cli - CLI instance. | ||
*/ | ||
|
||
return function (cli) { | ||
if (_.isEmpty(cli.sprout.templates)) { | ||
cli.emitter.emit('error', new Error('no templates exist!')) | ||
} else { | ||
cli.emitter.emit('list', _.keys(cli.sprout.templates)) | ||
} | ||
return W.resolve() | ||
/* | ||
* List all templates. | ||
* @param {Function} cli - CLI instance. | ||
*/ | ||
module.exports = function (cli) { | ||
if (_.isEmpty(cli.sprout.templates)) { | ||
cli.emitter.emit('error', new Error('no templates exist!')) | ||
} else { | ||
cli.emitter.emit('list', _.keys(cli.sprout.templates)) | ||
} | ||
}.call(this)) | ||
return W.resolve() | ||
} |
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 |
---|---|---|
@@ -1,14 +1,11 @@ | ||
module.exports = (function () { | ||
/* | ||
* Remove a template. | ||
* @param {Function} cli - CLI instance. | ||
* @param {Object} args - CLI arguments. | ||
*/ | ||
|
||
return function (cli, args) { | ||
var name = args.name | ||
return cli.sprout.remove(name).then(function () { | ||
return cli.emitter.emit('success', 'template `' + name + '` removed!') | ||
}) | ||
} | ||
}.call(this)) | ||
/* | ||
* Remove a template. | ||
* @param {Function} cli - CLI instance. | ||
* @param {Object} args - CLI arguments. | ||
*/ | ||
module.exports = function (cli, args) { | ||
var name = args.name | ||
return cli.sprout.remove(name).then(function () { | ||
return cli.emitter.emit('success', 'template `' + name + '` removed!') | ||
}) | ||
} |
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 |
---|---|---|
@@ -1,18 +1,15 @@ | ||
var path = require('path') | ||
|
||
module.exports = (function () { | ||
/* | ||
* Run a generator on a template. | ||
* @param {Function} cli - CLI instance. | ||
* @param {Object} args - CLI arguments. | ||
*/ | ||
|
||
return function (cli, args) { | ||
var name = args.name | ||
var generator = args.generator | ||
var target = args.target ? path.resolve(cli.cwd, args.target) : cli.cwd | ||
return cli.sprout.run(name, target, generator, args.args).then(function () { | ||
return cli.emitter.emit('success', 'template `' + name + '` ran generator `' + generator + '` at ' + target + '!') | ||
}) | ||
} | ||
}.call(this)) | ||
/* | ||
* Run a generator on a template. | ||
* @param {Function} cli - CLI instance. | ||
* @param {Object} args - CLI arguments. | ||
*/ | ||
module.exports = function (cli, args) { | ||
var name = args.name | ||
var generator = args.generator | ||
var target = args.target ? path.resolve(cli.cwd, args.target) : cli.cwd | ||
return cli.sprout.run(name, target, generator, args.args).then(function () { | ||
return cli.emitter.emit('success', 'template `' + name + '` ran generator `' + generator + '` at ' + target + '!') | ||
}) | ||
} |
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