Skip to content

Commit

Permalink
Readd welcome message, update skip-install message
Browse files Browse the repository at this point in the history
  • Loading branch information
sondr3 committed May 28, 2016
1 parent 63f97fb commit ca13406
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
27 changes: 25 additions & 2 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var _ = require('lodash');
var chalk = require('chalk');
var generators = require('yeoman-generator');
var shelljs = require('shelljs');
var yosay = require('yosay');

module.exports = generators.Base.extend({
constructor: function () {
Expand All @@ -14,6 +15,11 @@ module.exports = generators.Base.extend({
type: Boolean
});

this.option('skip-welcome-message', {
desc: 'Skips the welcome message',
type: Boolean
});

if (!this.options['skip-install']) {
var dependencies = ['ruby', 'bundle', 'yo', 'gulp', 'node'].every(function (depend) {
return shelljs.which(depend);
Expand All @@ -33,6 +39,10 @@ module.exports = generators.Base.extend({
},

prompting: function () {
if (!this.options['skip-welcome-message']) {
this.log(yosay(`'Allo 'allo`));
}

var questions = [{
name: 'projectName',
message: 'What is the name of your project?',
Expand Down Expand Up @@ -145,11 +155,24 @@ module.exports = generators.Base.extend({
},

installing: function () {
this.installDependencies({
skipInstall: this.options['skip-install']
});
if (this.options['skip-install']) {
this.log('Please run "npm install" and "bundle install" to install dependencies');
this.log('Please run bundle install to ');
} else {
this.npmInstall();
this.spawnCommand('bundle', ['install', '--quiet']);
}
},

end: function () {
var skipInstallMessage =
'\nPlease run ' + chalk.blue('npm install') + ' and ' +
chalk.blue('bundle install') + ' to install dependencies';

if (this.options['skip-install']) {
this.log(skipInstallMessage);
return;
}
}
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"lodash": "^4.11.1",
"shelljs": "^0.7.0",
"yargs": "^4.6.0",
"yeoman-generator": "^0.23.3"
"yeoman-generator": "^0.23.3",
"yosay": "^1.1.1"
},
"devDependencies": {
"ava": "^0.15.1",
Expand Down

0 comments on commit ca13406

Please sign in to comment.