Skip to content

Commit

Permalink
chore(gen): update yeoman-generator to ~0.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kingcody committed Sep 5, 2015
1 parent 1b0c49d commit 15fdd0f
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 43 deletions.
4 changes: 2 additions & 2 deletions app/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class Generator extends Base {
},

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

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

this.filters = this._.defaults(this.config.get('filters'), {
this.filters = this.lodash.defaults(this.config.get('filters'), {
bootstrap: true,
uibootstrap: true,
jasmine: true
Expand Down
2 changes: 1 addition & 1 deletion app/templates/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <%= _.slugify(_.humanize(appname)) %>
# <%= lodash.slugify(lodash.humanize(appname)) %>

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

Expand Down
2 changes: 1 addition & 1 deletion app/templates/_bower.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "<%= _.slugify(_.humanize(appname)) %>",
"name": "<%= lodash.slugify(lodash.humanize(appname)) %>",
"version": "0.0.0",
"dependencies": {
"angular": "~1.4.0",
Expand Down
2 changes: 1 addition & 1 deletion app/templates/_package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "<%= _.slugify(_.humanize(appname)) %>",
"name": "<%= lodash.slugify(lodash.humanize(appname)) %>",
"version": "0.0.0",
"main": "server/app.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion app/templates/client/components/navbar/navbar(html).html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="/" class="navbar-brand"><%= _.slugify(_.humanize(appname)) %></a>
<a href="/" class="navbar-brand"><%= lodash.slugify(lodash.humanize(appname)) %></a>
</div>
<div collapse="isCollapsed" class="navbar-collapse collapse" id="navbar-main">
<ul class="nav navbar-nav">
Expand Down
2 changes: 1 addition & 1 deletion app/templates/client/components/navbar/navbar(jade).jade
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ div.navbar.navbar-default.navbar-static-top(ng-controller='NavbarCtrl')
span.icon-bar
span.icon-bar
span.icon-bar
a.navbar-brand(href='/') <%= _.slugify(_.humanize(appname)) %>
a.navbar-brand(href='/') <%= lodash.slugify(lodash.humanize(appname)) %>

div#navbar-main.navbar-collapse.collapse(collapse='isCollapsed')
ul.nav.navbar-nav
Expand Down
2 changes: 1 addition & 1 deletion app/templates/server/config/_local.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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

FACEBOOK_ID: 'app-id',
FACEBOOK_SECRET: 'secret',<% } if (filters.twitterAuth) { %>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/server/config/_local.env.sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

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

FACEBOOK_ID: 'app-id',
FACEBOOK_SECRET: 'secret',<% } if (filters.twitterAuth) { %>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/server/config/environment/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module.exports = {
// MongoDB connection options
mongo: {
uri: 'mongodb://localhost/<%= _.slugify(appname) %>-dev'
uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-dev'
},
sequelize: {
uri: 'sqlite://',
Expand Down
2 changes: 1 addition & 1 deletion app/templates/server/config/environment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var all = {

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

// List of user roles
Expand Down
2 changes: 1 addition & 1 deletion app/templates/server/config/environment/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ module.exports = {
process.env.MONGOHQ_URL ||
process.env.OPENSHIFT_MONGODB_DB_URL +
process.env.OPENSHIFT_APP_NAME ||
'mongodb://localhost/<%= _.slugify(appname) %>'
'mongodb://localhost/<%= lodash.slugify(appname) %>'
}
};
2 changes: 1 addition & 1 deletion app/templates/server/config/environment/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module.exports = {
// MongoDB connection options
mongo: {
uri: 'mongodb://localhost/<%= _.slugify(appname) %>-test'
uri: 'mongodb://localhost/<%= lodash.slugify(appname) %>-test'
},
sequelize: {
uri: 'sqlite://',
Expand Down
2 changes: 1 addition & 1 deletion app/templates/server/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ module.exports = function(app) {
saveUninitialized: true<% if (filters.mongoose) { %>,
store: new mongoStore({
mongooseConnection: mongoose.connection,
db: '<%= _.slugify(_.humanize(appname)) %>'
db: '<%= lodash.slugify(lodash.humanize(appname)) %>'
})<% } else if(filters.sequelize) { %>,
store: new Store(sqldb.sequelize)<% } %>
}));
Expand Down
15 changes: 12 additions & 3 deletions generator-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@

import util from 'util';
import path from 'path';
import lodash from 'lodash';
import s from 'underscore.string';
import yoWelcome from 'yeoman-welcome';
import * as genUtils from './util';

// extend lodash with underscore.string
lodash.mixin(s.exports());

export function genBase(self) {
self = self || this;

self.lodash = lodash;
self.yoWelcome = yoWelcome;

try {
self.appname = require(path.join(process.cwd(), 'bower.json')).name;
} catch (e) {
self.appname = self.name || path.basename(process.cwd());
}
self.appname = self._.camelize(self._.slugify(self._.humanize(self.appname)));
self.appname = lodash.camelize(lodash.slugify(lodash.humanize(self.appname)));
self.scriptAppName = self.appname + genUtils.appSuffix(self);

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

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

self.cameledName = self._.camelize(name);
self.classedName = self._.classify(name);
self.cameledName = lodash.camelize(name);
self.classedName = lodash.classify(name);

self.basename = path.basename(self.name);
self.dirname = (self.name.indexOf('/') >= 0) ? path.dirname(self.name) : self.name;
Expand Down
5 changes: 3 additions & 2 deletions heroku/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var yeoman = require('yeoman-generator');
var exec = require('child_process').exec;
var chalk = require('chalk');
var path = require('path');
var s = require('underscore.string');

var Generator = module.exports = function Generator() {
yeoman.generators.Base.apply(this, arguments);
Expand All @@ -14,7 +15,7 @@ var Generator = module.exports = function Generator() {
} catch (e) {
this.appname = path.basename(process.cwd());
}
this.appname = this._.slugify(this.appname);
this.appname = s.slugify(this.appname);
this.filters = this.config.get('filters') || {};
};

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

this.prompt(prompts, function (props) {
this.deployedName = this._.slugify(props.deployedName);
this.deployedName = s.slugify(props.deployedName);
done();
}.bind(this));
};
Expand Down
5 changes: 3 additions & 2 deletions openshift/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var yeoman = require('yeoman-generator');
var childProcess = require('child_process');
var chalk = require('chalk');
var path = require('path');
var s = require('underscore.string');
var exec = childProcess.exec;
var spawn = childProcess.spawn;

Expand All @@ -16,7 +17,7 @@ var Generator = module.exports = function Generator() {
} catch (e) {
this.appname = path.basename(process.cwd());
}
this.appname = this._.slugify(this.appname).split('-').join('');
this.appname = s.slugify(this.appname).split('-').join('');
this.filters = this.config.get('filters') || {};
};

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

this.prompt(prompts, function (props) {
this.deployedName = this._.slugify(props.deployedName).split('-').join('');
this.deployedName = s.slugify(props.deployedName).split('-').join('');
done();
}.bind(this));
};
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@
"babel-core": "^5.8.23",
"chalk": "^1.1.0",
"generator-ng-component": "~0.1.0",
"yeoman-generator": "~0.18.10"
"glob": "^5.0.14",
"lodash": "^3.10.1",
"underscore.string": "^3.1.1",
"yeoman-generator": "~0.19.2",
"yeoman-welcome": "^1.0.1"
},
"devDependencies": {
"chai": "^3.2.0",
Expand All @@ -55,7 +59,7 @@
"q": "^1.0.1",
"recursive-readdir": "^1.2.0",
"shelljs": "^0.5.3",
"underscore.string": "^3.1.1"
"yeoman-assert": "^2.0.0"
},
"engines": {
"node": ">=0.12.0",
Expand Down
37 changes: 21 additions & 16 deletions test/test-file-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var path = require('path');
var fs = require('fs');
var exec = require('child_process').exec;
var helpers = require('yeoman-generator').test;
var assert = require('yeoman-assert');
var chai = require('chai');
var expect = chai.expect;
var recursiveReadDir = require('recursive-readdir');
Expand Down Expand Up @@ -31,7 +32,9 @@ describe('angular-fullstack generator', function () {
gen.run(function () {
var afGenerator;
var deps = [path.join('../..', generatorType)];
afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name]);
afGenerator = helpers.createGenerator('angular-fullstack:' + generatorType, deps, [name], {
skipInstall: true
});

helpers.mockPrompt(afGenerator, mockPrompt);
afGenerator.run(function () {
Expand Down Expand Up @@ -328,22 +331,23 @@ describe('angular-fullstack generator', function () {
return done(err);
}

gen = helpers.createGenerator('angular-fullstack:app', deps);
gen.options['skip-install'] = true;
gen = helpers.createGenerator('angular-fullstack:app', deps, [], {
skipInstall: true
});
done();
}.bind(this));
});

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

it('should have package.json in fixtures', function() {
helpers.assertFile([
assert.file([
path.join(__dirname, 'fixtures', 'package.json')
]);
});

it('should have bower.json in fixtures', function() {
helpers.assertFile([
assert.file([
path.join(__dirname, 'fixtures', 'bower.json')
]);
});
Expand All @@ -355,7 +359,7 @@ describe('angular-fullstack generator', function () {
deps = deps.map(function(dep) {
return path.join(__dirname, 'fixtures', 'node_modules', dep);
});
helpers.assertFile(deps);
assert.file(deps);
});

it('should have all bower packages in fixtures/bower_components', function() {
Expand All @@ -365,7 +369,7 @@ describe('angular-fullstack generator', function () {
deps = deps.map(function(dep) {
return path.join(__dirname, 'fixtures', 'bower_components', dep);
});
helpers.assertFile(deps);
assert.file(deps);
});
});

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

it('should generate expected files with path name endpoint', function(done) {
runTest('(exit 0)', this, function() {
helpers.assertFile([
assert.file([
'server/api/foo/bar/index.js',
'server/api/foo/bar/index.spec.js',
'server/api/foo/bar/bar.controller.js',
Expand All @@ -452,13 +456,14 @@ describe('angular-fullstack generator', function () {
helpers.createDummyGenerator(),
'ng-component:app'
]
]);
gen.options['skip-install'] = true;
], [], {
skipInstall: true
});
helpers.mockPrompt(gen, {
skipConfig: true
});
gen.run(function () {
helpers.assertFile([
assert.file([
'client/app/main/main.less',
'client/app/main/main.coffee',
'server/auth/google/passport.js'
Expand All @@ -469,7 +474,7 @@ describe('angular-fullstack generator', function () {

it('should generate expected files', function (done) {
gen.run(function () {
helpers.assertFile(genFiles(defaultOptions));
assert.file(genFiles(defaultOptions));
done();
});
});
Expand Down Expand Up @@ -540,7 +545,7 @@ describe('angular-fullstack generator', function () {

it('should generate expected files', function (done) {
gen.run(function () {
helpers.assertFile(genFiles(testOptions));
assert.file(genFiles(testOptions));
done();
});
});
Expand Down Expand Up @@ -612,7 +617,7 @@ describe('angular-fullstack generator', function () {

it('should generate expected files', function (done) {
gen.run(function () {
helpers.assertFile(genFiles(testOptions));
assert.file(genFiles(testOptions));
done();
});
});
Expand Down Expand Up @@ -686,7 +691,7 @@ describe('angular-fullstack generator', function () {

it('should generate expected files', function (done) {
gen.run(function () {
helpers.assertFile(genFiles(testOptions));
assert.file(genFiles(testOptions));
done();
});
});
Expand Down Expand Up @@ -747,7 +752,7 @@ describe('angular-fullstack generator', function () {

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

0 comments on commit 15fdd0f

Please sign in to comment.