Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
Merge pull request #120 from revathskumar/backbone_jasmine
Browse files Browse the repository at this point in the history
Generate backbone scaffold with Jasmine
  • Loading branch information
sindresorhus committed Nov 21, 2012
2 parents 50d79b1 + 224829c commit 8e85646
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,46 @@ module.exports = Generator;

function Generator() {
yeoman.generators.Base.apply(this, arguments);

this.test_framework = this.options['test-framework'] || 'mocha';
this.hookFor('test-framework', { as: 'app' });
}

util.inherits(Generator, yeoman.generators.Base);

Generator.prototype.setupEnv = function setupEnv() {
// Copies the contents of the generator `templates`
// directory into your users new application path
this.directory('.','.', true);
this.directory('app/scripts/','app/scripts/', true);
this.directory('app/styles/','app/styles/', true);
this.template('app/.buildignore');
this.template('app/.htaccess');
this.template('app/404.html');
this.template('app/favicon.ico');
this.template('app/robots.txt');
};

Generator.prototype.git = function git() {
this.copy('.gitignore', '.gitignore');
this.copy('.gitattributes', '.gitattributes');
};

Generator.prototype.gruntfile = function gruntfile() {
if(this.test_framework === 'jasmine'){
var jasmine_gruntfile = this.read('Gruntfile.js').replace(/mocha/g,'jasmine');
this.write('Gruntfile.js', jasmine_gruntfile);
}else{
this.template('Gruntfile.js');
}
};

Generator.prototype.packageJSON = function packageJSON() {
this.template('package.json');
};

Generator.prototype.indexFile = function indexFile(){
if(this.test_framework === 'jasmine'){
var jasmine_indexfile = this.read('app/index.html').replace(/mocha/gi, 'Jasmine');
this.write('app/index.html', jasmine_indexfile,true);
}else{
this.template('app/index.html');
}
};

0 comments on commit 8e85646

Please sign in to comment.