-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from carrot/generators
Generators!
- Loading branch information
Showing
50 changed files
with
748 additions
and
251 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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var Template = require('./../template') | ||
, Promise = require('bluebird'); | ||
|
||
module.exports = (function () { | ||
|
||
/* | ||
* Run a generator in an existing template | ||
* given the target path and generator name. | ||
* @param {Function} sprout - Sprout instance. | ||
* @param {String} name - name of template to run generator from. | ||
* @param {String} target - The path of the existing instance. | ||
* @param {String} generator - The generator to use. | ||
* @param {Array} args - An array of arguments to pass to the generator. | ||
* @return {Promise} - Promise for Template instance. | ||
*/ | ||
|
||
return function (sprout, name, target, generator, args) { | ||
var template = sprout.templates[name]; | ||
if (template) return template.run(target, generator, args); | ||
return Promise.reject(new Error('template ' + name + ' does not exist')); | ||
} | ||
|
||
}.call(this)); |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.