Skip to content

Commit 0bd8a64

Browse files
committed
Merge pull request #1135 from kingcody/chore/update-yeoman-generator
Chore: update yeoman-generator
2 parents a77d051 + 533bbd7 commit 0bd8a64

File tree

4 files changed

+30
-29
lines changed

4 files changed

+30
-29
lines changed

app/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({
3737
},
3838

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

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

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

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

71+
this.config.set('filters', this.filters);
7172
this.config.forceSave();
7273

7374
cb();

endpoint/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var Generator = module.exports = function Generator() {
1111

1212
util.inherits(Generator, ScriptBase);
1313

14-
Generator.prototype.askFor = function askFor() {
14+
Generator.prototype.prompting = function askFor() {
1515
var done = this.async();
1616
var name = this.name;
1717

@@ -66,7 +66,13 @@ Generator.prototype.askFor = function askFor() {
6666
}.bind(this));
6767
};
6868

69-
Generator.prototype.registerEndpoint = function registerEndpoint() {
69+
Generator.prototype.writing = function createFiles() {
70+
var dest = this.config.get('endpointDirectory') || 'server/api/' + this.name;
71+
this.sourceRoot(path.join(__dirname, './templates'));
72+
ngUtil.processDirectory(this, '.', dest);
73+
};
74+
75+
Generator.prototype.end = function registerEndpoint() {
7076
if(this.config.get('insertRoutes')) {
7177
var routeConfig = {
7278
file: this.config.get('registerRoutesFile'),
@@ -110,9 +116,3 @@ Generator.prototype.registerEndpoint = function registerEndpoint() {
110116
}
111117
}
112118
};
113-
114-
Generator.prototype.createFiles = function createFiles() {
115-
var dest = this.config.get('endpointDirectory') || 'server/api/' + this.name;
116-
this.sourceRoot(path.join(__dirname, './templates'));
117-
ngUtil.processDirectory(this, '.', dest);
118-
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
"test": "grunt test"
2727
},
2828
"dependencies": {
29-
"yeoman-generator": "~0.17.0",
3029
"chalk": "~0.4.0",
31-
"generator-ng-component": "~0.0.4"
30+
"generator-ng-component": "~0.1.0",
31+
"yeoman-generator": "~0.18.10"
3232
},
3333
"devDependencies": {
3434
"chai": "^1.9.1",

test/test-file-creation.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ describe('angular-fullstack generator', function () {
2626
}, dependenciesInstalled = false;
2727

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

3434
helpers.mockPrompt(afGenerator, mockPrompt);
35-
afGenerator.run([], function () {
35+
afGenerator.run(function () {
3636
callback();
3737
});
3838
});
@@ -107,7 +107,7 @@ describe('angular-fullstack generator', function () {
107107
if (endpoint) {
108108
generatorTest('endpoint', endpoint, {}, execFn);
109109
} else {
110-
gen.run({}, execFn);
110+
gen.run(execFn);
111111
}
112112
}
113113

@@ -430,7 +430,7 @@ describe('angular-fullstack generator', function () {
430430
helpers.mockPrompt(gen, {
431431
skipConfig: true
432432
});
433-
gen.run({}, function () {
433+
gen.run(function () {
434434
helpers.assertFile([
435435
'client/app/main/main.less',
436436
'client/app/main/main.coffee',
@@ -454,22 +454,22 @@ describe('angular-fullstack generator', function () {
454454
helpers.mockPrompt(gen, {
455455
skipConfig: true
456456
});
457-
gen.run({}, function () {
457+
gen.run(function () {
458458
var yoConfig = require(__dirname + '/temp/.yo-rc.json');
459459
expect(yoConfig['generator-angular-fullstack'].filters.oauth).to.be.true;
460460
done();
461461
});
462462
});
463463

464464
it('should generate expected files', function (done) {
465-
gen.run({}, function () {
465+
gen.run(function () {
466466
helpers.assertFile(genFiles(defaultOptions));
467467
done();
468468
});
469469
});
470470

471471
it('should not generate unexpected files', function (done) {
472-
gen.run({}, function () {
472+
gen.run(function () {
473473
assertOnlyFiles(genFiles(defaultOptions), done);
474474
});
475475
});
@@ -533,14 +533,14 @@ describe('angular-fullstack generator', function () {
533533
});
534534

535535
it('should generate expected files', function (done) {
536-
gen.run({}, function () {
536+
gen.run(function () {
537537
helpers.assertFile(genFiles(testOptions));
538538
done();
539539
});
540540
});
541541

542542
it('should not generate unexpected files', function (done) {
543-
gen.run({}, function () {
543+
gen.run(function () {
544544
assertOnlyFiles(genFiles(testOptions), done);
545545
});
546546
});
@@ -605,14 +605,14 @@ describe('angular-fullstack generator', function () {
605605
});
606606

607607
it('should generate expected files', function (done) {
608-
gen.run({}, function () {
608+
gen.run(function () {
609609
helpers.assertFile(genFiles(testOptions));
610610
done();
611611
});
612612
});
613613

614614
it('should not generate unexpected files', function (done) {
615-
gen.run({}, function () {
615+
gen.run(function () {
616616
assertOnlyFiles(genFiles(testOptions), done);
617617
});
618618
});
@@ -679,14 +679,14 @@ describe('angular-fullstack generator', function () {
679679
});
680680

681681
it('should generate expected files', function (done) {
682-
gen.run({}, function () {
682+
gen.run(function () {
683683
helpers.assertFile(genFiles(testOptions));
684684
done();
685685
});
686686
});
687687

688688
it('should not generate unexpected files', function (done) {
689-
gen.run({}, function () {
689+
gen.run(function () {
690690
assertOnlyFiles(genFiles(testOptions), done);
691691
});
692692
});
@@ -740,14 +740,14 @@ describe('angular-fullstack generator', function () {
740740
});
741741

742742
it('should generate expected files', function (done) {
743-
gen.run({}, function () {
743+
gen.run(function () {
744744
helpers.assertFile(genFiles(testOptions));
745745
done();
746746
});
747747
});
748748

749749
it('should not generate unexpected files', function (done) {
750-
gen.run({}, function () {
750+
gen.run(function () {
751751
assertOnlyFiles(genFiles(testOptions), done);
752752
});
753753
});

0 commit comments

Comments
 (0)