Skip to content

Commit

Permalink
Rename generator runtime context for composability
Browse files Browse the repository at this point in the history
  • Loading branch information
hariadi committed Jun 26, 2014
1 parent 3148c66 commit 8982715
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions app/index.js
Expand Up @@ -9,7 +9,7 @@ var yeoman = require('yeoman-generator');

var AssembleGenerator = yeoman.generators.Base.extend({

init: function () {
initializing: function () {
this.pkg = require('../package.json');
this.description = this.pkg.description;

Expand All @@ -23,16 +23,6 @@ var AssembleGenerator = yeoman.generators.Base.extend({

this.init = this.options['init'] || this.options['i'] || false;

this.on('end', function () {
this.installDependencies({
skipInstall: this.options['skip-install'] || this.options['s'],
skipMessage: this.options['skip-welcome-message'] || this.options['w'],
callback: function () {
this.spawnCommand('grunt', ['build']);
}.bind(this)
});
});

this.defaultPlugins = {
"assemble-contrib-anchors": false,
"assemble-contrib-permalinks": true,
Expand All @@ -52,9 +42,9 @@ var AssembleGenerator = yeoman.generators.Base.extend({
}
});

}, // init
}, // initializing

askFor: function () {
prompting: function () {
var done = this.async();

var force = false;
Expand Down Expand Up @@ -149,40 +139,50 @@ var AssembleGenerator = yeoman.generators.Base.extend({

done();
}.bind(this));
}, // askFor

projectfiles: function () {
this.template('AUTHORS');
this.template('CHANGELOG');
this.template('LICENSE-MIT');
this.template('Gruntfile.js');
this.template('_package.json', 'package.json');
this.template('editorconfig', '.editorconfig');
this.template('README.md');
},

gitfiles: function () {
this.copy('gitignore', '.gitignore');
this.copy('gitattributes', '.gitattributes');
},

assets: function () {
this.directory('bootstrap', 'dist/assets');
},

src: function () {
this.mkdir('src/data');
this.mkdir('src/content');
this.mkdir('src/templates/pages');
this.mkdir('src/templates/layouts');
this.mkdir('src/templates/partials');
this.copy('site.yml', 'src/data/site.yml');
this.copy('markdown.md', 'src/content/markdown.md');
this.copy('blog.hbs', 'src/templates/pages/blog.hbs');
this.copy('index.hbs', 'src/templates/pages/index.hbs');
this.copy('layout.hbs', 'src/templates/layouts/default.hbs');
this.copy('inc-navbar-fixed-top.hbs', 'src/templates/partials/navbar-fixed-top.hbs');
}
}, // prompting

writing: {

projectfiles: function () {
this.template('AUTHORS');
this.template('CHANGELOG');
this.template('LICENSE-MIT');
this.template('Gruntfile.js');
this.template('_package.json', 'package.json');
this.template('editorconfig', '.editorconfig');
this.template('README.md');
},

gitfiles: function () {
this.copy('gitignore', '.gitignore');
this.copy('gitattributes', '.gitattributes');
},

assets: function () {
this.directory('bootstrap', 'dist/assets');
},

src: function () {
this.mkdir('src/data');
this.mkdir('src/content');
this.mkdir('src/templates/pages');
this.mkdir('src/templates/layouts');
this.mkdir('src/templates/partials');
this.copy('site.yml', 'src/data/site.yml');
this.copy('markdown.md', 'src/content/markdown.md');
this.copy('blog.hbs', 'src/templates/pages/blog.hbs');
this.copy('index.hbs', 'src/templates/pages/index.hbs');
this.copy('layout.hbs', 'src/templates/layouts/default.hbs');
this.copy('inc-navbar-fixed-top.hbs', 'src/templates/partials/navbar-fixed-top.hbs');
}
}, // writing

install: function() {
this.installDependencies({
skipInstall: this.options['skip-install'] || this.options['s'],
skipMessage: this.options['skip-welcome-message'] || this.options['w']
});
}, // install

});

Expand Down

0 comments on commit 8982715

Please sign in to comment.