Skip to content

Commit

Permalink
refactor(core): unify appname
Browse files Browse the repository at this point in the history
  • Loading branch information
balthazar committed Feb 6, 2015
1 parent b479b34 commit 57697c3
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 18 deletions.
3 changes: 1 addition & 2 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ var BangularGenerator = yeoman.generators.Base.extend({
initializing: {
getVars: function () {
this.appname = this.appname || path.basename(process.cwd());
this.appname = this._.camelize(this._.slugify(this._.humanize(this.appname)));
this.filters = {};
this.pkg = require('../package.json');
},
Expand Down Expand Up @@ -90,7 +89,7 @@ var BangularGenerator = yeoman.generators.Base.extend({
checked: false
}]
}], function (props) {
self.appname = props.name;
self.appname = self._.camelize(self._.slugify(self._.humanize(props.name)));
self.filters.backend = props.backend;

if (props.modules.length) {
Expand Down
2 changes: 1 addition & 1 deletion app/templates/client/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

angular.module('<%= _.slugify(appname) %>', [
angular.module('<%= appname %>', [
'ngRoute'<% if (filters.ngCookies) { %>,
'ngCookies'<% } %><% if (filters.ngResource) { %>,
'ngResource'<% } %><% if (filters.ngSanitize) { %>,
Expand Down
4 changes: 2 additions & 2 deletions app/templates/client/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html ng-app="<%= _.slugify(appname) %>">
<html ng-app="<%= appname %>">
<head>

<base href="/">

<title><%= _.slugify(appname) %></title>
<title><%= appname %></title>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
Expand Down
2 changes: 1 addition & 1 deletion app/templates/client/views/home/home.controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

angular.module('<%= _.slugify(appname) %>')
angular.module('<%= appname %>')
.controller('HomeCtrl', function () {

var vm = this;
Expand Down
2 changes: 1 addition & 1 deletion app/templates/client/views/home/home.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

angular.module('<%= _.slugify(appname) %>')
angular.module('<%= appname %>')
.config(function ($routeProvider) {
$routeProvider
.when('/', {
Expand Down
3 changes: 1 addition & 2 deletions app/templates/client/views/home/home.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*global describe, beforeEach, it, inject, expect*/
'use strict';

describe('HomeCtrl', function () {

beforeEach(module('<%= _.slugify(appname) %>'));
beforeEach(module('<%= appname %>'));

var HomeCtrl,
scope;
Expand Down
2 changes: 1 addition & 1 deletion directive/templates/directive.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

angular.module('<%= _.camelize(appname) %>')
angular.module('<%= appname %>')
.directive('<%= camelName %>', function () {
return {
restrict: 'EA',
Expand Down
2 changes: 1 addition & 1 deletion directive/templates/directive.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe('Directive: <%= dashName %>', function () {

beforeEach(module('<%= _.camelize(appname) %>', 'templates'));
beforeEach(module('<%= appname %>', 'templates'));

var element, scope;

Expand Down
2 changes: 1 addition & 1 deletion filter/templates/filter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

angular.module('<%= _.camelize(appname) %>')
angular.module('<%= appname %>')
.filter('<%= camelName %>', function () {
return function (input) {
return input;
Expand Down
2 changes: 1 addition & 1 deletion filter/templates/filter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe('<%= camelName %> filter', function () {

beforeEach(module('<%= _.camelize(appname) %>'));
beforeEach(module('<%= appname %>'));

var <%= camelName %>;

Expand Down
2 changes: 1 addition & 1 deletion route/templates/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

angular.module('<%= _.camelize(appname) %>')
angular.module('<%= appname %>')
.config(function ($routeProvider) {
$routeProvider
.when('<%= route %>', {
Expand Down
2 changes: 1 addition & 1 deletion route/templates/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe('Controller: <%= _.capitalize(_.camelize(name)) %>Ctrl', function () {

beforeEach(module('<%= _.camelize(appname) %>'));
beforeEach(module('<%= appname %>'));

var MainCtrl,
scope;
Expand Down
2 changes: 1 addition & 1 deletion service/templates/service.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

angular.module('<%= _.camelize(appname) %>')
angular.module('<%= appname %>')
.service('<%= camelName %>', function () {
});
2 changes: 1 addition & 1 deletion service/templates/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe('Service: <%= camelName %>', function () {

beforeEach(module('<%= _.camelize(appname) %>'));
beforeEach(module('<%= appname %>'));

var <%= camelName %>;

Expand Down
3 changes: 2 additions & 1 deletion test/test-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ describe('Launching app generator tests', function () {
it('should creates all the files', basicFileCheck);

it('should check name in some files', function () {
assert.fileContent('client/index.html', 'ng-app="test"');
assert.fileContent('README.md', '# test');
assert.fileContent('client/index.html', 'ng-app="test"');
assert.fileContent('client/app.js', 'angular.module(\'test\'');
});

it('should have mongo dependency', function () {
Expand Down

0 comments on commit 57697c3

Please sign in to comment.