Skip to content

Commit

Permalink
update some language and internal variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiemonge committed Jan 9, 2015
1 parent 72d8689 commit 4fd4064
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 53 deletions.
36 changes: 18 additions & 18 deletions lib/actions/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ var install = module.exports;
/**
* Combine package manager cmd line arguments and run the `install` command.
*
* Every commands will be schedule to run once on the run loop during the `install` step.
* (So don't combine the callback with `this.async()`)
* During the `install` step, every command will be scheduled to run once, on the run loop. (So don't combine the callback with `this.async()`)
*
* @param {String} installer Which package manager to use
* @param {String|Array} [paths] Packages to install, empty string for `npm install`
* @param {Object} [options] Options to invoke `install` with. These options will be parsed
* by [dargs]{@link https://www.npmjs.org/package/dargs}
* @param {String|Array} [paths] Packages to install.Use an empty string for `npm install`
* @param {Object} [options] Options to invoke `install` with. These options will be parsed by [dargs]{@link https://www.npmjs.org/package/dargs}
* @param {Function} [cb]
*/

Expand All @@ -42,8 +40,10 @@ install.runInstall = function (installer, paths, options, cb) {
.on('error', cb)
.on('exit', function (err) {
if (err === 127) {
this.log.error('Could not find ' + installer + '. Please install with ' +
'`npm install -g ' + installer + '`.');
this.log.error(
'Could not find ' + installer + '. Please install with ' +
'`npm install -g ' + installer + '`.'
);
}
this.emit(installer + 'Install:end', paths);
cb(err);
Expand All @@ -55,7 +55,7 @@ install.runInstall = function (installer, paths, options, cb) {
};

/**
* Runs `npm` and `bower` in the generated directory concurrently and prints a
* Runs `npm` and `bower`, in sequence, in the generated directory and prints a
* message to let the user know.
*
* @example
Expand All @@ -73,7 +73,7 @@ install.runInstall = function (installer, paths, options, cb) {
* @param {Boolean} [options.bower=true] - whether to run `bower install`
* @param {Boolean} [options.skipInstall=false] - whether to skip automatic installation
* @param {Boolean} [options.skipMessage=false] - whether to log the used commands
* @param {Function} [options.callback] - call once every commands are runned
* @param {Function} [options.callback] - call once all commands have run
*/

install.installDependencies = function (options) {
Expand Down Expand Up @@ -115,7 +115,7 @@ install.installDependencies = function (options) {
}.bind(this));
}

assert(msg.commands.length, 'installDependencies needs at least one of npm or bower to run.');
assert(msg.commands.length, 'installDependencies needs at least one of `npm` or `bower` to run.');

if (!options.skipMessage) {
this.env.adapter.log(msg.template(_.extend(options, {
Expand All @@ -131,12 +131,12 @@ install.installDependencies = function (options) {
};

/**
* Receives a list of `components`, and an `options` object to install through bower.
* Receives a list of `components` and an `options` object to install through bower.
*
* The installation will automatically be runned during the run loop `install` phase.
* The installation will automatically run during the run loop `install` phase.
*
* @param {String|Array} cmpnt Components to install
* @param {Object} [options] Options to invoke `bower install` with, see `bower help install`
* @param {String|Array} [cmpnt] Components to install
* @param {Object} [options] Options to invoke `bower install` with (see `bower help install`).
* @param {Function} [cb]
*/

Expand All @@ -145,12 +145,12 @@ install.bowerInstall = function install(cmpnt, options, cb) {
};

/**
* Receives a list of `packages`, and an `options` object to install through npm.
* Receives a list of `packages` and an `options` object to install through npm.
*
* The installation will automatically be runned during the run loop `install` phase.
* The installation will automatically run during the run loop `install` phase.
*
* @param {String|Array} pkgs Packages to install
* @param {Object} [options] Options to invoke `npm install` with, see `npm help install`
* @param {String|Array} [pkgs] Packages to install
* @param {Object} [options] Options to invoke `npm install` with (see `npm help install`).
* @param {Function} [cb]
*/

Expand Down
46 changes: 23 additions & 23 deletions lib/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var fileLogger = { write: _.noop, warn: _.noop };
* The `Base` class provides the common API shared by all generators.
* It define options, arguments, hooks, file, prompt, log, API, etc.
*
* It mixes on its prototype all methods you'll find in the `actions/` mixins.
* It mixes into its prototype all the methods found in the `actions/` mixins.
*
* Every generator should extend this base class.
*
Expand Down Expand Up @@ -85,7 +85,7 @@ var Base = module.exports = function Base(args, options) {

this.option('help', {
alias: 'h',
desc: 'Print generator\'s options and usage'
desc: 'Print the generator\'s options and usage'
});

this.option('skip-cache', {
Expand Down Expand Up @@ -196,13 +196,13 @@ Base.prototype.invoke = require('./actions/invoke');
Base.prototype.spawnCommand = require('./actions/spawn_command');

/**
* Prompt user to answer questions. The signature of this method is the same as {@link Inquirer.js}
* Prompt user to answer questions. The signature of this method is the same as {@link https://github.com/SBoudrias/Inquirer.js Inquirer.js}
*
* On top of Inquirer.js API, you can provide a `{cache: true}` property for every
* question descriptors. When true, Yeoman will store/reuser previous user answers as
* defaults.
* On top of the Inquirer.js API, you can provide a `{cache: true}` property for
* every question descriptor. When set to true, Yeoman will store/fetch the
* user's answers as defaults.
*
* @param {array} questions Array of question descriptor objects. See {@link Inquirer.js Documentation}
* @param {array} questions Array of question descriptor objects. See {@link https://github.com/SBoudrias/Inquirer.js/blob/master/README.md Documentation}
* @param {Function} callback Receive a question object
* @return {this}
*/
Expand All @@ -225,8 +225,8 @@ Base.prototype.prompt = function (questions, callback) {

/**
* Adds an option to the set of generator expected options, only used to
* generate generator usage. By default, generators get all the cli option
* parsed by nopt as a `this.options` Hash object.
* generate generator usage. By default, generators get all the cli options
* parsed by nopt as a `this.options` hash object.
*
* ### Options:
*
Expand Down Expand Up @@ -267,7 +267,7 @@ Base.prototype.option = function option(name, config) {
*
* Arguments are different from options in several aspects. The first one
* is how they are parsed from the command line, arguments are retrieved
* from position.
* based on their position.
*
* Besides, arguments are used inside your code as a property (`this.argument`),
* while options are all kept in a hash (`this.options`).
Expand Down Expand Up @@ -335,32 +335,32 @@ Base.prototype.parseOptions = function () {
};

Base.prototype.checkRequiredArgs = function () {
// If the help option was provided, we don't want to check for required arguments,
// since we're only going to print the help message anyway.
// If the help option was provided, we don't want to check for required
// arguments, since we're only going to print the help message anyway.
if (this.options.help) return;

// Bail early if it's not possible to have a missing required arg
if (this.args.length > this._arguments.length) return;

this._arguments.forEach(function (arg, position) {
// If the help option was not provided, check whether the argument was required,
// and whether a value was provided.
// If the help option was not provided, check whether the argument was
// required, and whether a value was provided.
if (arg.config.required && position >= this.args.length) {
return this.emit('error', new Error('Did not provide required argument ' + chalk.bold(arg.name) + '!'));
}
}, this);
};

/**
* Runs the generator, scheduling prototype methods on a run queue. Method names will
* determine in which order each method will be runned. Methods without special name will
* be runned in the default queue.
* Runs the generator, scheduling prototype methods on a run queue. Method names
* will determine the order each method is run. Methods without special names
* will run in the default queue.
*
* Method named `constructor` and any methods prefixed by a `_` won't be scheduled.
* Any method named `constructor` and any methods prefixed by a `_` won't be scheduled.
*
* You can also supply the arguments for the method to be invoked, if
* none is given, the same values used to initialize the invoker are
* used to initialize the invoked.
* You can also supply the arguments for the method to be invoked. If none are
* provided, the same values used to initialize the invoker are used to
* initialize the invoked.
*
* @param {Function} [cb]
*/
Expand All @@ -380,7 +380,7 @@ Base.prototype.run = function run(cb) {
cb();
}.bind(this));

// Ensure a prototype method is candidate to be run by default
// Ensure a prototype method is a candidate run by default
function methodIsValid(name) {
return name.charAt(0) !== '_' && name !== 'constructor';
}
Expand Down Expand Up @@ -486,7 +486,7 @@ Base.prototype.runHooks = function runHooks(cb) {
* to the given option named `name`. An option is created when this method is
* invoked and you can set a hash to customize it.
*
* Must be called prior to the generator run (shouldn't be called within
* Must be called prior to running the generator (shouldn't be called within
* a generator "step" - top-level methods).
*
* ### Options:
Expand Down
6 changes: 3 additions & 3 deletions lib/test/run-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var TestAdapter = require('./adapter').TestAdapter;

var RunContext = module.exports = function RunContext(Generator, settings) {
this._asyncHolds = 0;
this.runned = false;
this.ran = false;
this.inDirSet = false;
this.args = [];
this.options = {};
Expand Down Expand Up @@ -61,8 +61,8 @@ RunContext.prototype._run = function () {
this.inTmpDir();
}

if (this._asyncHolds !== 0 || this.runned) return;
this.runned = true;
if (this._asyncHolds !== 0 || this.ran) return;
this.ran = true;

var namespace;
this.env = yeoman.createEnv([], {}, new TestAdapter());
Expand Down
10 changes: 5 additions & 5 deletions test/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,19 +276,19 @@ describe('generators.Base', function () {

it('run methods in series', function (done) {
var async1Running = false;
var async1Runned = false;
var async1Ran = false;
this.TestGenerator.prototype.async1 = function () {
async1Running = true;
var cb = this.async();
setTimeout(function () {
async1Running = false;
async1Runned = true;
async1Ran = true;
cb();
}, 10);
};
this.TestGenerator.prototype.async2 = function () {
assert(!async1Running);
assert(async1Runned);
assert(async1Ran);
done();
};
this.testGen.run();
Expand Down Expand Up @@ -580,7 +580,7 @@ describe('generators.Base', function () {
this.dummy.composeWith('composed:gen');
var runSpy = sinon.spy(this.dummy, 'run');
// I use a setTimeout here just to make sure composeWith() doesn't start the
// generator before the base one is runned.
// generator before the base one is ran.
setTimeout(function () {
this.dummy.run(function () {
assert(this.spy.calledAfter(runSpy));
Expand Down Expand Up @@ -909,7 +909,7 @@ describe('generators.Base', function () {
generatorOnce.run();
});

it('triggers end event after all generators methods are runned (#709)', function (done) {
it('triggers end event after all generators methods are ran (#709)', function (done) {
var endSpy = sinon.spy();
var GeneratorEnd = generators.Base.extend({
constructor: function () {
Expand Down
8 changes: 4 additions & 4 deletions test/invoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('generators.Base#invoke()', function () {
'skip-install': true
});
this.SubGen = generators.Base.extend({
exec: function () { this.stubGenRunned = true; }
exec: function () { this.stubGenRan = true; }
});
this.env.registerStub(this.SubGen, 'foo:bar');
});
Expand All @@ -27,7 +27,7 @@ describe('generators.Base#invoke()', function () {
options: { 'skip-install': true }
});
invoked.on('end', function () {
assert(invoked.stubGenRunned);
assert(invoked.stubGenRan);
done();
});
});
Expand All @@ -36,7 +36,7 @@ describe('generators.Base#invoke()', function () {
var invoked = this.gen.invoke('foo:bar', {
options: { 'skip-install': true }
}, function () {
assert(invoked.stubGenRunned);
assert(invoked.stubGenRan);
done();
});
});
Expand Down Expand Up @@ -64,7 +64,7 @@ describe('generators.Base#invoke()', function () {
options: { 'skip-install': true }
}, function () {
stubGenFinished = true;
assert(invoked.stubGenRunned, 'Stub generator should have runned');
assert(invoked.stubGenRan, 'Stub generator should have ran');
cb();
});
};
Expand Down

0 comments on commit 4fd4064

Please sign in to comment.