Skip to content

Commit

Permalink
Migrate to yeoman-generator v1
Browse files Browse the repository at this point in the history
  • Loading branch information
silvenon committed May 26, 2017
1 parent fe0ad0c commit 44ae045
Show file tree
Hide file tree
Showing 4 changed files with 362 additions and 1,041 deletions.
30 changes: 11 additions & 19 deletions generators/app/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
'use strict';
const path = require('path');
const Generator = require('yeoman-generator');

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

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

configuring: function () {
module.exports = class extends Generator {
configuring() {
this.config.save();
},
}

writing: function () {
writing() {
this.fs.copy(
this.templatePath('test.js'),
this.destinationPath('test/spec/test.js')
Expand All @@ -22,18 +17,15 @@ module.exports = generators.Base.extend({
this.templatePath('index.html'),
this.destinationPath('test/index.html')
);
},
}

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

var dependencies = [
this.bowerInstall([
'jasmine'
];

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

});
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
"test": "mocha --reporter spec"
},
"dependencies": {
"yeoman-generator": "^0.20.1"
"yeoman-generator": "^1.1.1"
},
"devDependencies": {
"mocha": "*",
"yeoman-assert": "^2.0.0"
"yeoman-assert": "^3.0.0",
"yeoman-test": "^1.6.0"
},
"engines": {
"node": ">=0.10.0",
Expand Down
12 changes: 6 additions & 6 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*global describe, beforeEach, it */
'use strict';
var path = require('path');
var helpers = require('yeoman-generator').test;
var assert = require('yeoman-assert');
const path = require('path');
const helpers = require('yeoman-test');
const assert = require('yeoman-assert');

describe('Jasmine generator test', function () {
before(function (done) {
describe('Jasmine generator test', () => {
before(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 () {
it('creates expected files', () => {
assert.file([
'test/spec/test.js',
'test/index.html'
Expand Down
Loading

0 comments on commit 44ae045

Please sign in to comment.