Skip to content

Commit

Permalink
Update to Yeoman Generator v0.20.1
Browse files Browse the repository at this point in the history
Also, change the directory structure to be consistent with other generators and avoid having to set sourceRoot manually.
  • Loading branch information
silvenon committed Jul 2, 2015
1 parent 379f444 commit 6ddbded
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 58 deletions.
39 changes: 39 additions & 0 deletions generators/app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict';

var path = require('path');
var generators = require('yeoman-generator');

module.exports = generators.Base.extend({
constructor: function () {
generators.Base.apply(this, arguments);
},

configuring: function () {
this.config.save();
},

writing: function () {
this.fs.copy(
this.templatePath('test.js'),
this.destinationPath('test/spec/test.js')
);

this.fs.copy(
this.templatePath('index.html'),
this.destinationPath('test/index.html')
);
},

install: function () {
if (this.options['skip-install']) {
return;
}

var dependencies = [
'jasmine'
];

this.bowerInstall(dependencies, {saveDev: true});
}

});
File renamed without changes.
File renamed without changes.
32 changes: 0 additions & 32 deletions lib/generators/app/index.js

This file was deleted.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,11 @@
"test": "mocha --reporter spec"
},
"dependencies": {
"yeoman-generator": "~0.17.6"
"yeoman-generator": "^0.20.1"
},
"devDependencies": {
"mocha": "*"
},
"peerDependencies": {
"yo": ">=1.0.0"
"mocha": "*",
"yeoman-assert": "^2.0.0"
},
"engines": {
"node": ">=0.10.0",
Expand Down
30 changes: 9 additions & 21 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,20 @@
'use strict';
var path = require('path');
var helpers = require('yeoman-generator').test;
var assert = require('yeoman-assert');

describe('Jasmine generator test', function () {
beforeEach(function (done) {
helpers.testDirectory(path.join(__dirname, 'temp'), function (err) {
if (err) {
done(err);
return;
}

this.app = helpers.createGenerator('jasmine:app', [
'../../lib/generators/app'
]);
done();
}.bind(this));
before(function (done) {
helpers.run(path.join(__dirname, '../generators/app'))
.inDir(path.join(__dirname, 'temp'))
.withOptions({'skip-install': true})
.on('end', done);
});

it('creates expected files', function (done) {
var expected = [
it('creates expected files', function () {
assert.file([
'test/spec/test.js',
'test/index.html'
];

this.app.options['skip-install'] = true;
this.app.run(function () {
helpers.assertFile(expected);
done();
});
]);
});
});

0 comments on commit 6ddbded

Please sign in to comment.