Skip to content

Commit 813e0fe

Browse files
committed
Merge branch 'master' into add-decorator-generator
2 parents 7d9b862 + 61d044f commit 813e0fe

File tree

11 files changed

+76
-58
lines changed

11 files changed

+76
-58
lines changed

app/USAGE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Example:
66

77
This will create:
88
Gruntfile.js
9-
component.json
9+
bower.json
1010

1111
app/index.html
1212
app/scripts/your-app-name-here.js
1313
app/scripts/controllers/main.js
14-
app/components/angular/angular.js
14+
app/bower_components/angular/angular.js
1515
app/styles/main.css
1616
app/views/main.html
1717

app/index.js

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,43 @@ var Generator = module.exports = function Generator(args, options) {
6969

7070
util.inherits(Generator, yeoman.generators.NamedBase);
7171

72-
Generator.prototype.askFor = function askFor() {
72+
Generator.prototype.askForBootstrap = function askForBootstrap() {
7373
var cb = this.async();
7474

75-
var prompts = [{
75+
this.prompt({
7676
name: 'bootstrap',
7777
message: 'Would you like to include Twitter Bootstrap?',
78-
default: 'Y/n',
78+
default: true,
7979
warning: 'Yes: All Twitter Bootstrap files will be placed into the styles directory.'
80-
}, {
80+
}, function (err, props) {
81+
if (err) {
82+
return this.emit('error', err);
83+
}
84+
85+
this.bootstrap = props.bootstrap;
86+
87+
cb();
88+
}.bind(this));
89+
};
90+
91+
Generator.prototype.askForCompass = function askForCompass() {
92+
if (!this.bootstrap) {
93+
return;
94+
}
95+
96+
var cb = this.async();
97+
98+
this.prompt({
8199
name: 'compassBootstrap',
82100
message: 'If so, would you like to use Twitter Bootstrap for Compass (as opposed to vanilla CSS)?',
83-
default: 'Y/n',
101+
default: true,
84102
warning: 'Yes: All Twitter Bootstrap files will be placed into the styles directory.'
85-
}];
86-
87-
this.prompt(prompts, function (err, props) {
103+
}, function (err, props) {
88104
if (err) {
89105
return this.emit('error', err);
90106
}
91107

92-
this.bootstrap = (/y/i).test(props.bootstrap);
93-
this.compassBootstrap = (/y/i).test(props.compassBootstrap);
108+
this.compassBootstrap = props.compassBootstrap;
94109

95110
cb();
96111
}.bind(this));
@@ -102,17 +117,17 @@ Generator.prototype.askForModules = function askForModules() {
102117
var prompts = [{
103118
name: 'resourceModule',
104119
message: 'Would you like to include angular-resource.js?',
105-
default: 'Y/n',
120+
default: true,
106121
warning: 'Yes: angular-resource added to bower.json'
107122
}, {
108123
name: 'cookiesModule',
109124
message: 'Would you like to include angular-cookies.js?',
110-
default: 'Y/n',
125+
default: true,
111126
warning: 'Yes: angular-cookies added to bower.json'
112127
}, {
113128
name: 'sanitizeModule',
114129
message: 'Would you like to include angular-sanitize.js?',
115-
default: 'Y/n',
130+
default: true,
116131
warning: 'Yes: angular-sanitize added to bower.json'
117132
}];
118133

@@ -121,9 +136,9 @@ Generator.prototype.askForModules = function askForModules() {
121136
return this.emit('error', err);
122137
}
123138

124-
this.resourceModule = (/y/i).test(props.resourceModule);
125-
this.cookiesModule = (/y/i).test(props.cookiesModule);
126-
this.sanitizeModule = (/y/i).test(props.sanitizeModule);
139+
this.resourceModule = props.resourceModule;
140+
this.cookiesModule = props.cookiesModule;
141+
this.sanitizeModule = props.sanitizeModule;
127142

128143
cb();
129144
}.bind(this));

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
"test": "mocha"
2323
},
2424
"dependencies": {
25-
"yeoman-generator": "~0.10.5"
25+
"yeoman-generator": "~0.11.0"
2626
},
2727
"peerDependencies": {
28-
"generator-karma": "~0.2.0"
28+
"generator-karma": "~0.3.0"
2929
},
3030
"devDependencies": {
3131
"mocha": "~1.9.0",

templates/coffeescript-min/directive.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
angular.module('<%= _.camelize(appname) %>App')
4-
.directive('<%= _.camelize(name) %>', [() ->
4+
.directive '<%= _.camelize(name) %>', [->
55
template: '<div></div>'
66
restrict: 'E'
77
link: (scope, element, attrs) ->

templates/coffeescript-min/spec/directive.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ describe 'Directive: <%= _.camelize(name) %>', () ->
88
it 'should make hidden element visible', inject ($rootScope, $compile) ->
99
element = angular.element '<<%= _.dasherize(name) %>></<%= _.dasherize(name) %>>'
1010
element = $compile(element) $rootScope
11-
expect(element text()).toBe 'this is the <%= _.camelize(name) %> directive'
11+
expect(element.text()).toBe 'this is the <%= _.camelize(name) %> directive'

templates/common/Gruntfile.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
2-
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
2+
var LIVERELOAD_PORT = 35729;
3+
var lrSnippet = require('connect-livereload')({ port: LIVERELOAD_PORT });
34
var mountFolder = function (connect, dir) {
45
return connect.static(require('path').resolve(dir));
56
};
@@ -21,6 +22,9 @@ module.exports = function (grunt) {
2122
grunt.initConfig({
2223
yeoman: yeomanConfig,
2324
watch: {
25+
options: {
26+
nospawn: true
27+
},
2428
coffee: {
2529
files: ['<%%= yeoman.app %>/scripts/{,*/}*.coffee'],
2630
tasks: ['coffee:dist']
@@ -34,13 +38,15 @@ module.exports = function (grunt) {
3438
tasks: ['compass']
3539
},
3640
livereload: {
41+
options: {
42+
livereload: LIVERELOAD_PORT
43+
},
3744
files: [
3845
'<%%= yeoman.app %>/{,*/}*.html',
3946
'{.tmp,<%%= yeoman.app %>}/styles/{,*/}*.css',
4047
'{.tmp,<%%= yeoman.app %>}/scripts/{,*/}*.js',
4148
'<%%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
42-
],
43-
tasks: ['livereload']
49+
]
4450
}
4551
},
4652
connect: {
@@ -131,7 +137,7 @@ module.exports = function (grunt) {
131137
imagesDir: '<%%= yeoman.app %>/images',
132138
javascriptsDir: '<%%= yeoman.app %>/scripts',
133139
fontsDir: '<%%= yeoman.app %>/styles/fonts',
134-
importPath: '<%%= yeoman.app %>/components',
140+
importPath: '<%%= yeoman.app %>/bower_components',
135141
relativeAssets: true
136142
},
137143
dist: {},
@@ -251,7 +257,7 @@ module.exports = function (grunt) {
251257
src: [
252258
'*.{ico,txt}',
253259
'.htaccess',
254-
'components/**/*',
260+
'bower_components/**/*',
255261
'images/{,*/}*.{gif,webp}',
256262
'styles/fonts/*'
257263
]
@@ -260,13 +266,10 @@ module.exports = function (grunt) {
260266
}
261267
});
262268

263-
grunt.renameTask('regarde', 'watch');
264-
265269
grunt.registerTask('server', [
266270
'clean:server',
267271
'coffee:dist',
268272
'compass:server',
269-
'livereload-start',
270273
'connect:livereload',
271274
'open',
272275
'watch'
@@ -287,10 +290,10 @@ module.exports = function (grunt) {
287290
'coffee',
288291
'compass:dist',
289292
'useminPrepare',
293+
'concat',
290294
'imagemin',
291295
'cssmin',
292296
'htmlmin',
293-
'concat',
294297
'copy',
295298
'cdnify',
296299
'ngmin',

templates/common/gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ node_modules
22
dist
33
.tmp
44
.sass-cache
5-
app/components
5+
app/bower_components

templates/common/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@
2121
<![endif]-->
2222

2323
<!--[if lt IE 9]>
24-
<script src="components/es5-shim/es5-shim.js"></script>
25-
<script src="components/json3/lib/json3.min.js"></script>
24+
<script src="bower_components/es5-shim/es5-shim.js"></script>
25+
<script src="bower_components/json3/lib/json3.min.js"></script>
2626
<![endif]-->
2727

2828
<!-- Add your site or application content here -->
2929
<div class="container" ng-view></div>
3030

31-
<script src="components/angular/angular.js"></script><% if (resourceModule) { %>
32-
<script src="components/angular-resource/angular-resource.js"></script><% } %><% if (cookiesModule) { %>
33-
<script src="components/angular-cookies/angular-cookies.js"></script><% } %><% if (sanitizeModule) { %>
34-
<script src="components/angular-sanitize/angular-sanitize.js"></script><% } %>
31+
<script src="bower_components/angular/angular.js"></script><% if (resourceModule) { %>
32+
<script src="bower_components/angular-resource/angular-resource.js"></script><% } %><% if (cookiesModule) { %>
33+
<script src="bower_components/angular-cookies/angular-cookies.js"></script><% } %><% if (sanitizeModule) { %>
34+
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script><% } %>
3535

3636
<!-- build:js scripts/scripts.js -->
3737
<script src="scripts/app.js"></script>

templates/common/package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44
"dependencies": {},
55
"devDependencies": {
66
"grunt": "~0.4.1",
7-
"grunt-contrib-copy": "~0.4.0",
8-
"grunt-contrib-concat": "~0.1.3",
9-
"grunt-contrib-coffee": "~0.6.4",
7+
"grunt-contrib-copy": "~0.4.1",
8+
"grunt-contrib-concat": "~0.2.0",
9+
"grunt-contrib-coffee": "~0.7.0",
1010
"grunt-contrib-uglify": "~0.2.0",
11-
"grunt-contrib-compass": "~0.1.3",
12-
"grunt-contrib-jshint": "~0.3.0",
13-
"grunt-contrib-cssmin": "~0.5.0",
14-
"grunt-contrib-connect": "~0.2.0",
15-
"grunt-contrib-clean": "~0.4.0",
16-
"grunt-contrib-htmlmin": "~0.1.1",
17-
"grunt-contrib-imagemin": "~0.1.2",
18-
"grunt-contrib-livereload": "~0.1.2",
19-
"grunt-bower-requirejs": "~0.4.1",
20-
"grunt-usemin": "~0.1.10",
21-
"grunt-regarde": "~0.1.1",
11+
"grunt-contrib-compass": "~0.2.0",
12+
"grunt-contrib-jshint": "~0.4.3",
13+
"grunt-contrib-cssmin": "~0.6.0",
14+
"grunt-contrib-connect": "~0.3.0",
15+
"grunt-contrib-clean": "~0.4.1",
16+
"grunt-contrib-htmlmin": "~0.1.3",
17+
"grunt-contrib-imagemin": "~0.1.4",
18+
"grunt-contrib-watch": "~0.4.0",
19+
"grunt-bower-requirejs": "~0.4.2",
20+
"grunt-usemin": "~0.1.11",
2221
"grunt-rev": "~0.1.0",
23-
"grunt-karma": "~0.3.0",
22+
"grunt-karma": "~0.4.3",
2423
"grunt-open": "~0.2.0",
25-
"matchdep": "~0.1.1",
26-
"grunt-google-cdn": "~0.1.1",
24+
"matchdep": "~0.1.2",
25+
"connect-livereload": "~0.1.0",
26+
"grunt-google-cdn": "~0.2.0",
2727
"grunt-ngmin": "~0.0.2"
2828
},
2929
"engines": {

templates/common/root/.bowerrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"directory": "app/components"
2+
"directory": "app/bower_components"
33
}

0 commit comments

Comments
 (0)