Skip to content

Commit 8a72d26

Browse files
committed
Merge pull request #1252 from kingcody/chore/update-yeoman-generator
chore(gen): update yeoman-generator to `~0.19.2`
2 parents e335fa0 + 15fdd0f commit 8a72d26

19 files changed

+72
-43
lines changed

Diff for: app/generator.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default class Generator extends Base {
3333
},
3434

3535
info: function () {
36-
this.log(this.welcome);
36+
this.log(this.yoWelcome);
3737
this.log('Out of the box I create an AngularJS app with an Express server.\n');
3838
},
3939

@@ -49,7 +49,7 @@ export default class Generator extends Base {
4949
}], function (answers) {
5050
this.skipConfig = answers.skipConfig;
5151

52-
this.filters = this._.defaults(this.config.get('filters'), {
52+
this.filters = this.lodash.defaults(this.config.get('filters'), {
5353
bootstrap: true,
5454
uibootstrap: true,
5555
jasmine: true

Diff for: app/templates/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# <%= _.slugify(_.humanize(appname)) %>
1+
# <%= lodash.slugify(lodash.humanize(appname)) %>
22

33
This project was generated with the [Angular Full-Stack Generator](https://github.com/DaftMonk/generator-angular-fullstack) version <%= pkg.version %>.
44

Diff for: app/templates/_bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "<%= _.slugify(_.humanize(appname)) %>",
2+
"name": "<%= lodash.slugify(lodash.humanize(appname)) %>",
33
"version": "0.0.0",
44
"dependencies": {
55
"angular": "~1.4.0",

Diff for: app/templates/_package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "<%= _.slugify(_.humanize(appname)) %>",
2+
"name": "<%= lodash.slugify(lodash.humanize(appname)) %>",
33
"version": "0.0.0",
44
"main": "server/app.js",
55
"dependencies": {

Diff for: app/templates/client/components/navbar/navbar(html).html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<span class="icon-bar"></span>
88
<span class="icon-bar"></span>
99
</button>
10-
<a href="/" class="navbar-brand"><%= _.slugify(_.humanize(appname)) %></a>
10+
<a href="/" class="navbar-brand"><%= lodash.slugify(lodash.humanize(appname)) %></a>
1111
</div>
1212
<div collapse="isCollapsed" class="navbar-collapse collapse" id="navbar-main">
1313
<ul class="nav navbar-nav">

Diff for: app/templates/client/components/navbar/navbar(jade).jade

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ div.navbar.navbar-default.navbar-static-top(ng-controller='NavbarCtrl')
66
span.icon-bar
77
span.icon-bar
88
span.icon-bar
9-
a.navbar-brand(href='/') <%= _.slugify(_.humanize(appname)) %>
9+
a.navbar-brand(href='/') <%= lodash.slugify(lodash.humanize(appname)) %>
1010

1111
div#navbar-main.navbar-collapse.collapse(collapse='isCollapsed')
1212
ul.nav.navbar-nav

Diff for: app/templates/server/config/_local.env.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
module.exports = {
99
DOMAIN: 'http://localhost:9000',
10-
SESSION_SECRET: '<%= _.slugify(appname) + "-secret" %>',<% if (filters.facebookAuth) { %>
10+
SESSION_SECRET: '<%= lodash.slugify(appname) + "-secret" %>',<% if (filters.facebookAuth) { %>
1111

1212
FACEBOOK_ID: 'app-id',
1313
FACEBOOK_SECRET: 'secret',<% } if (filters.twitterAuth) { %>

Diff for: app/templates/server/config/_local.env.sample.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
module.exports = {
99
DOMAIN: 'http://localhost:9000',
10-
SESSION_SECRET: '<%= _.slugify(appname) + "-secret" %>',<% if (filters.facebookAuth) { %>
10+
SESSION_SECRET: '<%= lodash.slugify(appname) + "-secret" %>',<% if (filters.facebookAuth) { %>
1111

1212
FACEBOOK_ID: 'app-id',
1313
FACEBOOK_SECRET: 'secret',<% } if (filters.twitterAuth) { %>

Diff for: app/templates/server/config/environment/development.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module.exports = {
66
// MongoDB connection options
77
mongo: {
8-
uri: 'mongodb://localhost/<%= _.slugify(appname) %>-dev'
8+
uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-dev'
99
},
1010
sequelize: {
1111
uri: 'sqlite://',

Diff for: app/templates/server/config/environment/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var all = {
2929

3030
// Secret for session, you will want to change this and make it an environment variable
3131
secrets: {
32-
session: '<%= _.slugify(_.humanize(appname)) + '-secret' %>'
32+
session: '<%= lodash.slugify(lodash.humanize(appname)) + '-secret' %>'
3333
},
3434

3535
// List of user roles

Diff for: app/templates/server/config/environment/production.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ module.exports = {
1919
process.env.MONGOHQ_URL ||
2020
process.env.OPENSHIFT_MONGODB_DB_URL +
2121
process.env.OPENSHIFT_APP_NAME ||
22-
'mongodb://localhost/<%= _.slugify(appname) %>'
22+
'mongodb://localhost/<%= lodash.slugify(appname) %>'
2323
}
2424
};

Diff for: app/templates/server/config/environment/test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
module.exports = {
66
// MongoDB connection options
77
mongo: {
8-
uri: 'mongodb://localhost/<%= _.slugify(appname) %>-test'
8+
uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-test'
99
},
1010
sequelize: {
1111
uri: 'sqlite://',

Diff for: app/templates/server/config/express.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ module.exports = function(app) {
4646
saveUninitialized: true<% if (filters.mongoose) { %>,
4747
store: new mongoStore({
4848
mongooseConnection: mongoose.connection,
49-
db: '<%= _.slugify(_.humanize(appname)) %>'
49+
db: '<%= lodash.slugify(lodash.humanize(appname)) %>'
5050
})<% } else if(filters.sequelize) { %>,
5151
store: new Store(sqldb.sequelize)<% } %>
5252
}));

Diff for: generator-base.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,26 @@
22

33
import util from 'util';
44
import path from 'path';
5+
import lodash from 'lodash';
6+
import s from 'underscore.string';
7+
import yoWelcome from 'yeoman-welcome';
58
import * as genUtils from './util';
69

10+
// extend lodash with underscore.string
11+
lodash.mixin(s.exports());
12+
713
export function genBase(self) {
814
self = self || this;
915

16+
self.lodash = lodash;
17+
self.yoWelcome = yoWelcome;
18+
1019
try {
1120
self.appname = require(path.join(process.cwd(), 'bower.json')).name;
1221
} catch (e) {
1322
self.appname = self.name || path.basename(process.cwd());
1423
}
15-
self.appname = self._.camelize(self._.slugify(self._.humanize(self.appname)));
24+
self.appname = lodash.camelize(lodash.slugify(lodash.humanize(self.appname)));
1625
self.scriptAppName = self.appname + genUtils.appSuffix(self);
1726

1827
self.filters = self.filters || self.config.get('filters');
@@ -41,8 +50,8 @@ export function genNamedBase(self) {
4150

4251
var name = self.name.replace(/\//g, '-');
4352

44-
self.cameledName = self._.camelize(name);
45-
self.classedName = self._.classify(name);
53+
self.cameledName = lodash.camelize(name);
54+
self.classedName = lodash.classify(name);
4655

4756
self.basename = path.basename(self.name);
4857
self.dirname = (self.name.indexOf('/') >= 0) ? path.dirname(self.name) : self.name;

Diff for: heroku/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var yeoman = require('yeoman-generator');
44
var exec = require('child_process').exec;
55
var chalk = require('chalk');
66
var path = require('path');
7+
var s = require('underscore.string');
78

89
var Generator = module.exports = function Generator() {
910
yeoman.generators.Base.apply(this, arguments);
@@ -14,7 +15,7 @@ var Generator = module.exports = function Generator() {
1415
} catch (e) {
1516
this.appname = path.basename(process.cwd());
1617
}
17-
this.appname = this._.slugify(this.appname);
18+
this.appname = s.slugify(this.appname);
1819
this.filters = this.config.get('filters') || {};
1920
};
2021

@@ -29,7 +30,7 @@ Generator.prototype.askForName = function askForName() {
2930
}];
3031

3132
this.prompt(prompts, function (props) {
32-
this.deployedName = this._.slugify(props.deployedName);
33+
this.deployedName = s.slugify(props.deployedName);
3334
done();
3435
}.bind(this));
3536
};

Diff for: openshift/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var yeoman = require('yeoman-generator');
44
var childProcess = require('child_process');
55
var chalk = require('chalk');
66
var path = require('path');
7+
var s = require('underscore.string');
78
var exec = childProcess.exec;
89
var spawn = childProcess.spawn;
910

@@ -16,7 +17,7 @@ var Generator = module.exports = function Generator() {
1617
} catch (e) {
1718
this.appname = path.basename(process.cwd());
1819
}
19-
this.appname = this._.slugify(this.appname).split('-').join('');
20+
this.appname = s.slugify(this.appname).split('-').join('');
2021
this.filters = this.config.get('filters') || {};
2122
};
2223

@@ -32,7 +33,7 @@ Generator.prototype.askForName = function askForName() {
3233
}];
3334

3435
this.prompt(prompts, function (props) {
35-
this.deployedName = this._.slugify(props.deployedName).split('-').join('');
36+
this.deployedName = s.slugify(props.deployedName).split('-').join('');
3637
done();
3738
}.bind(this));
3839
};

Diff for: package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@
3737
"babel-core": "^5.8.23",
3838
"chalk": "^1.1.0",
3939
"generator-ng-component": "~0.1.0",
40-
"yeoman-generator": "~0.18.10"
40+
"glob": "^5.0.14",
41+
"lodash": "^3.10.1",
42+
"underscore.string": "^3.1.1",
43+
"yeoman-generator": "~0.19.2",
44+
"yeoman-welcome": "^1.0.1"
4145
},
4246
"devDependencies": {
4347
"chai": "^3.2.0",
@@ -55,7 +59,7 @@
5559
"q": "^1.0.1",
5660
"recursive-readdir": "^1.2.0",
5761
"shelljs": "^0.5.3",
58-
"underscore.string": "^3.1.1"
62+
"yeoman-assert": "^2.0.0"
5963
},
6064
"engines": {
6165
"node": ">=0.12.0",

Diff for: test/test-file-creation.js

+21-16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var path = require('path');
44
var fs = require('fs');
55
var exec = require('child_process').exec;
66
var helpers = require('yeoman-generator').test;
7+
var assert = require('yeoman-assert');
78
var chai = require('chai');
89
var expect = chai.expect;
910
var recursiveReadDir = require('recursive-readdir');
@@ -31,7 +32,9 @@ describe('angular-fullstack generator', function () {
3132
gen.run(function () {
3233
var afGenerator;
3334
var deps = [path.join('../..', generatorType)];
34-
afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name]);
35+
afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name], {
36+
skipInstall: true
37+
});
3538

3639
helpers.mockPrompt(afGenerator, mockPrompt);
3740
afGenerator.run(function () {
@@ -328,22 +331,23 @@ describe('angular-fullstack generator', function () {
328331
return done(err);
329332
}
330333

331-
gen = helpers.createGenerator('angular-fullstack:app', deps);
332-
gen.options['skip-install'] = true;
334+
gen = helpers.createGenerator('angular-fullstack:app', deps, [], {
335+
skipInstall: true
336+
});
333337
done();
334338
}.bind(this));
335339
});
336340

337341
describe('making sure test fixtures are present', function() {
338342

339343
it('should have package.json in fixtures', function() {
340-
helpers.assertFile([
344+
assert.file([
341345
path.join(__dirname, 'fixtures', 'package.json')
342346
]);
343347
});
344348

345349
it('should have bower.json in fixtures', function() {
346-
helpers.assertFile([
350+
assert.file([
347351
path.join(__dirname, 'fixtures', 'bower.json')
348352
]);
349353
});
@@ -355,7 +359,7 @@ describe('angular-fullstack generator', function () {
355359
deps = deps.map(function(dep) {
356360
return path.join(__dirname, 'fixtures', 'node_modules', dep);
357361
});
358-
helpers.assertFile(deps);
362+
assert.file(deps);
359363
});
360364

361365
it('should have all bower packages in fixtures/bower_components', function() {
@@ -365,7 +369,7 @@ describe('angular-fullstack generator', function () {
365369
deps = deps.map(function(dep) {
366370
return path.join(__dirname, 'fixtures', 'bower_components', dep);
367371
});
368-
helpers.assertFile(deps);
372+
assert.file(deps);
369373
});
370374
});
371375

@@ -429,7 +433,7 @@ describe('angular-fullstack generator', function () {
429433

430434
it('should generate expected files with path name endpoint', function(done) {
431435
runTest('(exit 0)', this, function() {
432-
helpers.assertFile([
436+
assert.file([
433437
'server/api/foo/bar/index.js',
434438
'server/api/foo/bar/index.spec.js',
435439
'server/api/foo/bar/bar.controller.js',
@@ -452,13 +456,14 @@ describe('angular-fullstack generator', function () {
452456
helpers.createDummyGenerator(),
453457
'ng-component:app'
454458
]
455-
]);
456-
gen.options['skip-install'] = true;
459+
], [], {
460+
skipInstall: true
461+
});
457462
helpers.mockPrompt(gen, {
458463
skipConfig: true
459464
});
460465
gen.run(function () {
461-
helpers.assertFile([
466+
assert.file([
462467
'client/app/main/main.less',
463468
'client/app/main/main.coffee',
464469
'server/auth/google/passport.js'
@@ -469,7 +474,7 @@ describe('angular-fullstack generator', function () {
469474

470475
it('should generate expected files', function (done) {
471476
gen.run(function () {
472-
helpers.assertFile(genFiles(defaultOptions));
477+
assert.file(genFiles(defaultOptions));
473478
done();
474479
});
475480
});
@@ -540,7 +545,7 @@ describe('angular-fullstack generator', function () {
540545

541546
it('should generate expected files', function (done) {
542547
gen.run(function () {
543-
helpers.assertFile(genFiles(testOptions));
548+
assert.file(genFiles(testOptions));
544549
done();
545550
});
546551
});
@@ -612,7 +617,7 @@ describe('angular-fullstack generator', function () {
612617

613618
it('should generate expected files', function (done) {
614619
gen.run(function () {
615-
helpers.assertFile(genFiles(testOptions));
620+
assert.file(genFiles(testOptions));
616621
done();
617622
});
618623
});
@@ -686,7 +691,7 @@ describe('angular-fullstack generator', function () {
686691

687692
it('should generate expected files', function (done) {
688693
gen.run(function () {
689-
helpers.assertFile(genFiles(testOptions));
694+
assert.file(genFiles(testOptions));
690695
done();
691696
});
692697
});
@@ -747,7 +752,7 @@ describe('angular-fullstack generator', function () {
747752

748753
it('should generate expected files', function (done) {
749754
gen.run(function () {
750-
helpers.assertFile(genFiles(testOptions));
755+
assert.file(genFiles(testOptions));
751756
done();
752757
});
753758
});

0 commit comments

Comments
 (0)