Skip to content

Commit c8072f4

Browse files
committed
Merge branch 'feature-demo'
2 parents c9f80bc + 036478d commit c8072f4

File tree

11 files changed

+210
-72
lines changed

11 files changed

+210
-72
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
node_modules
22
bower_components
33
test/temp
4-
test/UpperCaseBug
4+
demo
55
.idea
66
.DS_Store
77
release.txt

Gruntfile.js

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
'use strict';
22
var markdown = require('marked');
33
var semver = require('semver');
4+
var _s = require('underscore.string');
5+
var shell = require('shelljs');
6+
var process = require('child_process');
7+
var Q = require('q');
8+
var helpers = require('yeoman-generator').test;
49

510
module.exports = function (grunt) {
611
require('load-grunt-tasks')(grunt);
712

813
grunt.initConfig({
14+
config: {
15+
demo: 'demo'
16+
},
917
pkg: grunt.file.readJSON('package.json'),
1018
changelog: {
1119
options: {
@@ -26,12 +34,39 @@ module.exports = function (grunt) {
2634
files: ['CHANGELOG.md']
2735
}
2836
},
37+
buildcontrol: {
38+
options: {
39+
dir: 'demo',
40+
commit: true,
41+
push: true,
42+
connectCommits: false,
43+
message: 'Built using Angular Fullstack v<%= pkg.version %> from commit %sourceCommit%'
44+
},
45+
release: {
46+
options: {
47+
remote: 'origin',
48+
branch: 'master'
49+
}
50+
}
51+
},
2952
jshint: {
3053
options: {
3154
curly: false,
3255
node: true
3356
},
3457
all: ['Gruntfile.js', '*/index.js']
58+
},
59+
clean: {
60+
demo: {
61+
files: [{
62+
dot: true,
63+
src: [
64+
'<%= config.demo %>/*',
65+
'!<%= config.demo %>/.git',
66+
'!<%= config.demo %>/dist'
67+
]
68+
}]
69+
}
3570
}
3671
});
3772

@@ -63,5 +98,77 @@ module.exports = function (grunt) {
6398
}, grunt.task.current.async());
6499
});
65100

101+
grunt.registerTask('generate', 'generate demo', function () {
102+
var done = this.async();
103+
104+
shell.cd(grunt.config('config').demo);
105+
106+
Q()
107+
.then(generateDemo)
108+
.then(gruntBuild)
109+
.then(gruntRelease)
110+
.catch(function(msg){
111+
grunt.fail.warn(msg || 'failed to generate demo')
112+
})
113+
.finally(done);
114+
115+
function generateDemo() {
116+
var deferred = Q.defer();
117+
var options = {
118+
script: 'js',
119+
markup: 'html',
120+
stylesheet: 'sass',
121+
router: 'uirouter',
122+
mongoose: true,
123+
auth: true,
124+
oauth: ['googleAuth', 'twitterAuth'],
125+
socketio: true
126+
};
127+
128+
var deps = [
129+
'../app',
130+
[
131+
helpers.createDummyGenerator(),
132+
'ng-component:app'
133+
]
134+
];
135+
136+
var gen = helpers.createGenerator('angular-fullstack:app', deps);
137+
138+
helpers.mockPrompt(gen, options);
139+
gen.run({}, function () {
140+
deferred.resolve();
141+
});
142+
143+
return deferred.promise;
144+
}
145+
146+
function run(cmd) {
147+
var deferred = Q.defer();
148+
var generator = shell.exec(cmd, {async:true});
149+
generator.stdout.on('data', function (data) {
150+
grunt.verbose.writeln(data);
151+
});
152+
generator.on('exit', function (code) {
153+
deferred.resolve();
154+
});
155+
156+
return deferred.promise;
157+
}
158+
159+
function gruntBuild() {
160+
return run('grunt');
161+
}
162+
163+
function gruntRelease() {
164+
return run('grunt buildcontrol');
165+
}
166+
});
167+
168+
grunt.registerTask('demo', [
169+
'clean:demo',
170+
'generate'
171+
]);
172+
66173
//grunt.registerTask('default', ['bump', 'changelog', 'stage', 'release']);
67174
};

app/templates/Gruntfile.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ module.exports = function (grunt) {
1616
ngtemplates: 'grunt-angular-templates',
1717
cdnify: 'grunt-google-cdn',
1818
protractor: 'grunt-protractor-runner',
19-
injector: 'grunt-asset-injector'
19+
injector: 'grunt-asset-injector',
20+
buildcontrol: 'grunt-build-control'
2021
});
2122

2223
// Time how long tasks take. Can help when optimizing build times
@@ -26,6 +27,7 @@ module.exports = function (grunt) {
2627
grunt.initConfig({
2728

2829
// Project settings
30+
pkg: grunt.file.readJSON('package.json'),
2931
yeoman: {
3032
// configurable paths
3133
client: require('./bower.json').appPath || 'client',
@@ -407,6 +409,28 @@ module.exports = function (grunt) {
407409
}
408410
},
409411

412+
buildcontrol: {
413+
options: {
414+
dir: 'dist',
415+
commit: true,
416+
push: true,
417+
connectCommits: false,
418+
message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
419+
},
420+
heroku: {
421+
options: {
422+
remote: 'heroku',
423+
branch: 'master'
424+
}
425+
},
426+
openshift: {
427+
options: {
428+
remote: 'openshift',
429+
branch: 'master'
430+
}
431+
}
432+
},
433+
410434
// Run some tasks in parallel to speed up the build process
411435
concurrent: {
412436
server: [<% if(filters.coffee) { %>

app/templates/_.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules
22
public
33
.tmp
44
.sass-cache
5+
.idea
56
client/bower_components
67
dist
78
/server/config/local.env.js

app/templates/_package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"grunt-protractor-runner": "^1.1.0",
6060
"grunt-asset-injector": "^0.1.0",
6161
"grunt-karma": "~0.8.2",
62+
"grunt-build-control": "DaftMonk/grunt-build-control",
6263
"grunt-mocha-test": "~0.10.2",<% if(filters.sass) { %>
6364
"grunt-contrib-sass": "^0.7.3",<% } %><% if(filters.stylus) { %>
6465
"grunt-contrib-stylus": "latest",<% } %>

app/templates/client/app/main/main(html).html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ <h1 class="page-header">Features:</h1>
3131

3232
<footer class="footer">
3333
<div class="container">
34-
<p><a href="https://twitter.com/tyhenkel">@tyhenkel</a> |
34+
<p>Angular Fullstack v<%= pkg.version %> |
35+
<a href="https://twitter.com/tyhenkel">@tyhenkel</a> |
3536
<a href="https://github.com/DaftMonk/generator-angular-fullstack/issues?state=open">Issues</a></p>
3637
</div>
3738
</footer>

app/templates/client/app/main/main(jade).jade

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ header#banner.hero-unit
2626
footer.footer
2727
.container
2828
p
29+
| Angular Fullstack v<%= pkg.version %>
30+
= ' | '
2931
a(href='https://twitter.com/tyhenkel') @tyhenkel
3032
= ' | '
3133
a(href='https://github.com/DaftMonk/generator-angular-fullstack/issues?state=open') Issues

heroku/index.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ Generator.prototype.gitForcePush = function gitForcePush() {
161161
this.log(chalk.yellow('\nBecause you\'re using mongoose, you must add mongoDB to your heroku app.\n\t' + 'from `/dist`: ' + chalk.bold('heroku addons:add mongohq') + '\n'));
162162
hasWarning = true;
163163
}
164-
if(this.filters.socketio) {
165-
this.log(chalk.yellow('Because you\'re using socketIO, you must enable websockets on your heroku app.\n\t' + 'from `/dist`: ' + chalk.bold('heroku labs:enable websockets') + '\n'));
166-
hasWarning = true;
167-
}
168164

169165
if(this.filters.facebookAuth) {
170166
this.log(chalk.yellow('You will need to set environment variables for facebook auth. From `/dist`:\n\t' +
@@ -190,9 +186,8 @@ Generator.prototype.gitForcePush = function gitForcePush() {
190186
this.log(chalk.green('\nYou may need to address the issues mentioned above and restart the server for the app to work correctly.'));
191187
}
192188

193-
this.log(chalk.cyan('\nTo deploy a new build\n\t' + chalk.bold('grunt build') +
194-
'\nThen enter the dist folder to commit these updates:\n\t' + chalk.bold('cd dist && git add -A && git commit -m "describe your changes here"')));
195-
this.log(chalk.cyan('Finally, deploy your updated build to Heroku with\n\t' + chalk.bold('git push -f heroku master')));
189+
this.log(chalk.yellow('After app modification run\n\t' + chalk.bold('grunt build') +
190+
'\nThen deploy with\n\t' + chalk.bold('grunt buildcontrol:heroku')));
196191
}
197192
done();
198193
}.bind(this));

0 commit comments

Comments
 (0)