Skip to content

Chore: update yeoman-generator #1135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
},

info: function () {
this.log(this.yeoman);
this.log(this.welcome);
this.log('Out of the box I create an AngularJS app with an Express server.\n');
},

Expand All @@ -60,14 +60,15 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
});

// NOTE: temp(?) fix for #403
if(typeof this.filters.oauth==='undefined') {
if(typeof this.filters.oauth === 'undefined') {
var strategies = Object.keys(this.filters).filter(function(key) {
return key.match(/Auth$/) && key;
});
return key.match(/Auth$/) && this.filters[key];
}.bind(this));

if(strategies.length) this.filters.oauth = true;
}

this.config.set('filters', this.filters);
this.config.forceSave();

cb();
Expand Down
16 changes: 8 additions & 8 deletions endpoint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var Generator = module.exports = function Generator() {

util.inherits(Generator, ScriptBase);

Generator.prototype.askFor = function askFor() {
Generator.prototype.prompting = function askFor() {
var done = this.async();
var name = this.name;

Expand Down Expand Up @@ -66,7 +66,13 @@ Generator.prototype.askFor = function askFor() {
}.bind(this));
};

Generator.prototype.registerEndpoint = function registerEndpoint() {
Generator.prototype.writing = function createFiles() {
var dest = this.config.get('endpointDirectory') || 'server/api/' + this.name;
this.sourceRoot(path.join(__dirname, './templates'));
ngUtil.processDirectory(this, '.', dest);
};

Generator.prototype.end = function registerEndpoint() {
if(this.config.get('insertRoutes')) {
var routeConfig = {
file: this.config.get('registerRoutesFile'),
Expand Down Expand Up @@ -110,9 +116,3 @@ Generator.prototype.registerEndpoint = function registerEndpoint() {
}
}
};

Generator.prototype.createFiles = function createFiles() {
var dest = this.config.get('endpointDirectory') || 'server/api/' + this.name;
this.sourceRoot(path.join(__dirname, './templates'));
ngUtil.processDirectory(this, '.', dest);
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"test": "grunt test"
},
"dependencies": {
"yeoman-generator": "~0.17.0",
"chalk": "~0.4.0",
"generator-ng-component": "~0.0.4"
"generator-ng-component": "~0.1.0",
"yeoman-generator": "~0.18.10"
},
"devDependencies": {
"chai": "^1.9.1",
Expand Down
30 changes: 15 additions & 15 deletions test/test-file-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ describe('angular-fullstack generator', function () {
}, dependenciesInstalled = false;

function generatorTest(generatorType, name, mockPrompt, callback) {
gen.run({}, function () {
gen.run(function () {
var afGenerator;
var deps = [path.join('../..', generatorType)];
afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name]);

helpers.mockPrompt(afGenerator, mockPrompt);
afGenerator.run([], function () {
afGenerator.run(function () {
callback();
});
});
Expand Down Expand Up @@ -107,7 +107,7 @@ describe('angular-fullstack generator', function () {
if (endpoint) {
generatorTest('endpoint', endpoint, {}, execFn);
} else {
gen.run({}, execFn);
gen.run(execFn);
}
}

Expand Down Expand Up @@ -430,7 +430,7 @@ describe('angular-fullstack generator', function () {
helpers.mockPrompt(gen, {
skipConfig: true
});
gen.run({}, function () {
gen.run(function () {
helpers.assertFile([
'client/app/main/main.less',
'client/app/main/main.coffee',
Expand All @@ -454,22 +454,22 @@ describe('angular-fullstack generator', function () {
helpers.mockPrompt(gen, {
skipConfig: true
});
gen.run({}, function () {
gen.run(function () {
var yoConfig = require(__dirname + '/temp/.yo-rc.json');
expect(yoConfig['generator-angular-fullstack'].filters.oauth).to.be.true;
done();
});
});

it('should generate expected files', function (done) {
gen.run({}, function () {
gen.run(function () {
helpers.assertFile(genFiles(defaultOptions));
done();
});
});

it('should not generate unexpected files', function (done) {
gen.run({}, function () {
gen.run(function () {
assertOnlyFiles(genFiles(defaultOptions), done);
});
});
Expand Down Expand Up @@ -533,14 +533,14 @@ describe('angular-fullstack generator', function () {
});

it('should generate expected files', function (done) {
gen.run({}, function () {
gen.run(function () {
helpers.assertFile(genFiles(testOptions));
done();
});
});

it('should not generate unexpected files', function (done) {
gen.run({}, function () {
gen.run(function () {
assertOnlyFiles(genFiles(testOptions), done);
});
});
Expand Down Expand Up @@ -605,14 +605,14 @@ describe('angular-fullstack generator', function () {
});

it('should generate expected files', function (done) {
gen.run({}, function () {
gen.run(function () {
helpers.assertFile(genFiles(testOptions));
done();
});
});

it('should not generate unexpected files', function (done) {
gen.run({}, function () {
gen.run(function () {
assertOnlyFiles(genFiles(testOptions), done);
});
});
Expand Down Expand Up @@ -679,14 +679,14 @@ describe('angular-fullstack generator', function () {
});

it('should generate expected files', function (done) {
gen.run({}, function () {
gen.run(function () {
helpers.assertFile(genFiles(testOptions));
done();
});
});

it('should not generate unexpected files', function (done) {
gen.run({}, function () {
gen.run(function () {
assertOnlyFiles(genFiles(testOptions), done);
});
});
Expand Down Expand Up @@ -740,14 +740,14 @@ describe('angular-fullstack generator', function () {
});

it('should generate expected files', function (done) {
gen.run({}, function () {
gen.run(function () {
helpers.assertFile(genFiles(testOptions));
done();
});
});

it('should not generate unexpected files', function (done) {
gen.run({}, function () {
gen.run(function () {
assertOnlyFiles(genFiles(testOptions), done);
});
});
Expand Down