Browse files

Merge pull request #47 from passy/skip-install

Option to skip automatic install via bower/npm
  • Loading branch information...
2 parents a84a7fa + 4cb934d commit b112b89cbe7cb4d907d095ebbde8af7ef7947007 @sindresorhus sindresorhus committed Apr 8, 2013
Showing with 24 additions and 5 deletions.
  1. +8 −4 app/index.js
  2. +13 −0 readme.md
  3. +3 −1 test/test.js
View
12 app/index.js
@@ -24,13 +24,17 @@ var AppGenerator = module.exports = function Appgenerator(args, options, config)
this.mainCoffeeFile = 'console.log "\'Allo from CoffeeScript!"';
this.on('end', function () {
- console.log('\n\nI\'m all done. Running ' + 'npm install & bower install'.bold.yellow + ' for you to install the required dependencies. If this fails, try running the command yourself.\n\n');
- spawn('npm', ['install'], { stdio: 'inherit' });
- spawn('bower', ['install'], { stdio: 'inherit' });
+ if (options['skip-install']) {
+ console.log('\n\nI\'m all done. Just run ' + 'npm install & bower install --dev'.bold.yellow + ' to install the required dependencies.\n\n');
+ } else {
+ console.log('\n\nI\'m all done. Running ' + 'npm install & bower install'.bold.yellow + ' for you to install the required dependencies. If this fails, try running the command yourself.\n\n');
+ spawn('npm', ['install'], { stdio: 'inherit' });
+ spawn('bower', ['install'], { stdio: 'inherit' });
+ }
});
this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
-}
+};
util.inherits(AppGenerator, yeoman.generators.NamedBase);
View
13 readme.md
@@ -3,6 +3,19 @@
Default Yeoman generator for scaffolding out a front-end web app.
+## Options
+
+* `--skip-install`
+
+ Skips the automatic execution of `bower` and `npm` after
+ scaffolding has finished.
+
+* `--test-framework=[framework]`
+
+ Defaults to `mocha`. Can be switched for
+ another supported testing framework like `jasmine`.
+
+
## Contribute
See the [contributing docs](https://github.com/yeoman/yeoman/blob/master/contributing.md)
View
4 test/test.js
@@ -1,4 +1,4 @@
-/*global describe beforeEach it*/
+/*global describe, beforeEach, it*/
var path = require('path');
var helpers = require('yeoman-generator').test;
@@ -46,6 +46,7 @@ describe('Webapp generator test', function () {
'includeRequireJS': 'N'
});
+ this.webapp.options['skip-install'] = true;
this.webapp.run({}, function () {
helpers.assertFiles(expected);
done();
@@ -70,6 +71,7 @@ describe('Webapp generator test', function () {
'includeRequireJS': 'Y'
});
+ this.webapp.options['skip-install'] = true;
this.webapp.run({}, function () {
helpers.assertFiles(expected);
done();

0 comments on commit b112b89

Please sign in to comment.