base-generators
Advanced tools
Comparing version 0.1.6 to 0.1.7
23
index.js
@@ -404,16 +404,23 @@ /*! | ||
var config = this.base.cache.config || {}; | ||
var gen = res.generator; | ||
var app = this; | ||
gen.config.process(this.base.cache.config, function(err) { | ||
if (typeof gen.config === 'undefined') { | ||
gen.build(res.tasks, build); | ||
return; | ||
} | ||
gen.config.process(config, function(err) { | ||
if (err) return cb(err); | ||
gen.build(res.tasks, build); | ||
}); | ||
gen.build(res.tasks, function(err) { | ||
if (err) { | ||
generatorError(err, app, name, cb); | ||
return; | ||
} | ||
function build(err) { | ||
if (err) { | ||
generatorError(err, app, name, cb); | ||
} else { | ||
cb(); | ||
}); | ||
}); | ||
} | ||
} | ||
}); | ||
@@ -420,0 +427,0 @@ |
@@ -16,4 +16,2 @@ 'use strict'; | ||
this.generators = new Cache(); | ||
var base = this.base; | ||
var envCache = {}; | ||
@@ -58,3 +56,3 @@ var getCache = {}; | ||
parent = parent || base; | ||
parent = parent || app.base; | ||
utils.define(this, 'parent', parent); | ||
@@ -72,3 +70,3 @@ var generator; | ||
// merge options | ||
var opts = utils.extend({}, config, app.base.options, parent.options, generator.options); | ||
var opts = utils.extend({}, config, app.base.options, generator.options); | ||
if (opts.pristine === true) { | ||
@@ -101,5 +99,5 @@ pristine = true; | ||
if (invoked[alias]) return invoked[alias]; | ||
var app = utils.invoke(generator); | ||
if (app) { | ||
return (invoked[alias] = app); | ||
var gen = utils.invoke(generator); | ||
if (gen) { | ||
return (invoked[alias] = gen); | ||
} | ||
@@ -114,3 +112,3 @@ } | ||
generator.options = opts; | ||
parent.run(generator); | ||
app.run(generator); | ||
} | ||
@@ -218,5 +216,5 @@ | ||
GeneratorError.prototype.inspect = function () { | ||
GeneratorError.prototype.inspect = function() { | ||
if (this.message) { | ||
return '[' + this.constructor.name + ': ' + this.message + ']' | ||
return '[' + this.constructor.name + ': ' + this.message + ']'; | ||
} | ||
@@ -223,0 +221,0 @@ return '[' + this.constructor.name + ']'; |
@@ -41,3 +41,3 @@ 'use strict'; | ||
res.generator = gen; | ||
res.tasks = [prop] | ||
res.tasks = [prop]; | ||
return res; | ||
@@ -44,0 +44,0 @@ } |
{ | ||
"name": "base-generators", | ||
"description": "Adds project-generator support to your `base` application.", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"homepage": "https://github.com/jonschlinkert/base-generators", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
@@ -245,3 +245,3 @@ # base-generators [](https://www.npmjs.com/package/base-generators) [](https://travis-ci.org/jonschlinkert/base-generators) | ||
### [.resolve](index.js#L71) | ||
### [.resolve](index.js#L74) | ||
@@ -278,3 +278,3 @@ Attempts to find a generator with the given `name` and `options`. | ||
### [.register](index.js#L125) | ||
### [.register](index.js#L130) | ||
@@ -298,3 +298,3 @@ Register generator `name` with the given `fn`. | ||
### [.generator](index.js#L149) | ||
### [.generator](index.js#L154) | ||
@@ -318,3 +318,3 @@ Register generator `name` with the given `fn`, or get generator `name` if only one argument is passed. This method calls the `.getGenerator` method but goes one step further: if `name` is not already registered, it will try to resolve and register the generator before returning it (or `undefined` if unsuccessful). | ||
### [.hasGenerator](index.js#L181) | ||
### [.hasGenerator](index.js#L186) | ||
@@ -343,3 +343,3 @@ Return true if the given `name` exists on the `generators` object. Dot-notation may be used to check for sub-generators. | ||
### [.getGenerator](index.js#L205) | ||
### [.getGenerator](index.js#L210) | ||
@@ -362,3 +362,3 @@ Get generator `name` from `app.generators`. Dot-notation may be used to get a sub-generator. | ||
### [.globalGenerator](index.js#L238) | ||
### [.globalGenerator](index.js#L243) | ||
@@ -373,3 +373,3 @@ Search for globally installed generator `name`. If found, then generator | ||
### [.findGenerator](index.js#L265) | ||
### [.findGenerator](index.js#L270) | ||
@@ -386,3 +386,3 @@ Find generator `name`, by first searching the cache, | ||
### [.invoke](index.js#L296) | ||
### [.invoke](index.js#L301) | ||
@@ -402,3 +402,3 @@ Invoke the given generator in the context of (`this`) the current instance. | ||
### [.extendWith](index.js#L333) | ||
### [.extendWith](index.js#L338) | ||
@@ -423,3 +423,3 @@ Alias for `.invoke`, Extend the current generator instance with the settings of other generators. | ||
### [.generate](index.js#L371) | ||
### [.generate](index.js#L376) | ||
@@ -462,3 +462,3 @@ Run a `generator` and `tasks`, calling the given `callback` function upon completion. | ||
### [.generateEach](index.js#L423) | ||
### [.generateEach](index.js#L444) | ||
@@ -482,3 +482,3 @@ Iterate over an array of generators and tasks, calling [generate](#generate) on each. | ||
### [.alias](index.js#L446) | ||
### [.alias](index.js#L468) | ||
@@ -493,3 +493,3 @@ Create a generator alias from the given `name`. | ||
### [.fullname](index.js#L466) | ||
### [.fullname](index.js#L488) | ||
@@ -504,3 +504,3 @@ Create a generator's full name from the given `alias`. | ||
### [.configfile](index.js#L481) | ||
### [.configfile](index.js#L503) | ||
@@ -510,3 +510,3 @@ Getter/setter for defining the `configfile` name to use for lookups. | ||
### [.modulename](index.js#L499) | ||
### [.modulename](index.js#L521) | ||
@@ -516,3 +516,3 @@ Getter/setter for defining the `modulename` name to use for lookups. | ||
### [.base](index.js#L526) | ||
### [.base](index.js#L548) | ||
@@ -578,2 +578,2 @@ Getter/setter for the `base` (or shared) instance of `generate`. | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 06, 2016._ | ||
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 09, 2016._ |
47737
934