Commit 50da9759 authored by Evren Kutar's avatar Evren Kutar

grunt config to build every branch in a directory under dist/

parent 34d81dc0
...@@ -6,13 +6,24 @@ module.exports = function (grunt) { ...@@ -6,13 +6,24 @@ module.exports = function (grunt) {
uglify: { uglify: {
dist: { dist: {
options: { options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n', banner: '/*! <%= pkg.name %> <%= grunt.branchname %> <%= grunt.template.today("yyyy-mm-dd") %> */\n',
mangle: false mangle: false
}, },
files: { files: {
'dist/app.js': ['dist/app.js'], 'dist/app.js': ['dist/app.js'],
'dist/bower_components/components.js': ['dist/bower_components/components.js'] 'dist/bower_components/components.js': ['dist/bower_components/components.js']
} }
},
branch: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.branchname %> <%= grunt.template.today("yyyy-mm-dd") %>' +
' */\n',
mangle: false
},
files: {
'dist/<%= grunt.branchname %>/app.js': ['dist/app.js'],
'dist/<%= grunt.branchname %>/bower_components/components.js': ['dist/bower_components/components.js']
}
} }
}, },
bower: { bower: {
...@@ -47,6 +58,10 @@ module.exports = function (grunt) { ...@@ -47,6 +58,10 @@ module.exports = function (grunt) {
prod: { prod: {
src: ['app/components/**/*.html'], src: ['app/components/**/*.html'],
dest: 'dist/templates.js' dest: 'dist/templates.js'
},
prod_branch: {
src: ['app/components/**/*.html'],
dest: 'dist/<%= grunt.branchname %>/templates.js'
} }
}, },
concat: { concat: {
...@@ -79,6 +94,33 @@ module.exports = function (grunt) { ...@@ -79,6 +94,33 @@ module.exports = function (grunt) {
css: { css: {
src: ['app/bower_components/**/**/*.css', 'app/app.css'], src: ['app/bower_components/**/**/*.css', 'app/app.css'],
dest: 'dist/app.css' dest: 'dist/app.css'
},
js_branch: {
src: [
'app/app.js', 'app/app_routes.js', 'app/zetalib/**/*service.js', 'app/zetalib/general.js', 'app/zetalib/interceptors.js', 'app/components/**/*controller.js', 'app/components/**/*service.js'],
dest: 'dist/<%= grunt.branchname %>/app.js'
},
components_branch: {
src: [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-cookies/angular-cookies.js',
'app/bower_components/angular-resource/angular-resource.js',
'app/bower_components/angular-bootstrap/ui-bootstrap.js',
'app/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
'app/bower_components/angular-sanitize/angular-sanitize.js',
'app/bower_components/tv4/tv4.js',
'app/bower_components/objectpath/lib/ObjectPath.js',
'app/bower_components/angular-schema-form/dist/schema-form.js',
'app/bower_components/angular-schema-form/dist/bootstrap-decorator.js',
'app/bower_components/angular-schema-form-datepicker/bootstrap-datepicker.js',
'app/bower_components/angular-gettext/dist/angular-gettext.js'
],
dest: 'dist/<%= grunt.branchname %>/bower_components/components.js'
},
css_branch: {
src: ['app/bower_components/**/**/*.css', 'app/app.css'],
dest: 'dist/<%= grunt.branchname %>/app.css'
} }
}, },
watch: { watch: {
...@@ -114,6 +156,11 @@ module.exports = function (grunt) { ...@@ -114,6 +156,11 @@ module.exports = function (grunt) {
files: { files: {
'app/shared/translations.js': ['po/*.po'] 'app/shared/translations.js': ['po/*.po']
} }
},
branch: {
files: {
'dist/<%= grunt.branchname %>/shared/translations.js': ['po/*.po']
}
} }
}, },
env: { env: {
...@@ -147,29 +194,33 @@ module.exports = function (grunt) { ...@@ -147,29 +194,33 @@ module.exports = function (grunt) {
} }
}, },
preprocess : { preprocess : {
dev: { dev: {
src: 'index.html', src: 'index.html',
dest: 'app/index.html' dest: 'app/index.html'
}, },
prod: { prod: {
src: 'index.html', src: 'index.html',
dest: 'dist/index.html', dest: 'dist/index.html',
options: { options: {
context: { context: {
name: '<%= pkg.name %>', name: '<%= pkg.name %>',
version: '<%= pkg.version %>', version: '<%= pkg.version %>',
now: '<%= now %>', now: '<%= now %>',
ver: '<%= ver %>' ver: '<%= ver %>'
} }
} }
},
prod_branch: {
src: 'index.html',
dest: 'dist/<%= grunt.branchname %>/index.html',
options: {
context: {
name: '<%= pkg.name %>',
version: '<%= pkg.version %>',
now: '<%= now %>',
ver: '<%= ver %>'
}
}
} }
} }
}); });
...@@ -192,7 +243,6 @@ module.exports = function (grunt) { ...@@ -192,7 +243,6 @@ module.exports = function (grunt) {
grunt.registerTask('i18n', ['nggettext_extract', 'nggettext_compile']); grunt.registerTask('i18n', ['nggettext_extract', 'nggettext_compile']);
grunt.registerTask('default', [ grunt.registerTask('default', [
'bower', 'bower',
'nggettext_extract',
'nggettext_compile', 'nggettext_compile',
'concat:js', 'concat:js',
'concat:css', 'concat:css',
...@@ -202,4 +252,19 @@ module.exports = function (grunt) { ...@@ -202,4 +252,19 @@ module.exports = function (grunt) {
'html2js:prod', 'html2js:prod',
'uglify:dist' 'uglify:dist'
]); ]);
grunt.registerTask('branch', '',function(){
var branch = require('git-branch');
grunt.branchname = branch.sync();
grunt.task.run([
'bower',
'nggettext_compile:branch',
'concat:js_branch',
'concat:css_branch',
'concat:components_branch',
'env:prod',
'preprocess:prod_branch',
'html2js:prod_branch',
'uglify:branch'
])
});
}; };
\ No newline at end of file
...@@ -20,7 +20,7 @@ var app = angular.module( ...@@ -20,7 +20,7 @@ var app = angular.module(
'ulakbus.student', 'ulakbus.student',
'schemaForm', 'schemaForm',
'gettext', 'gettext',
//'templates-prod' 'templates-prod'
]). ]).
/** /**
* RESTURL is the url of rest api to talk * RESTURL is the url of rest api to talk
......
<div ng-app="ulakbus.types">
<div class="col-md-6">
<h1>{{ schema.title }}</h1>
<form name="formgenerated" sf-schema="schema" sf-form="form" sf-model="model" ng-submit="onSubmit(formgenerated)"></form>
</div>
</div>
\ No newline at end of file
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
"grunt-contrib-watch": "~0.6.1", "grunt-contrib-watch": "~0.6.1",
"grunt-bower-task": "~0.3.4", "grunt-bower-task": "~0.3.4",
"grunt-karma": "~0.8.0", "grunt-karma": "~0.8.0",
"grunt-angular-gettext": "~2.1.0" "grunt-angular-gettext": "~2.1.0",
"git-branch": "*"
}, },
"scripts": { "scripts": {
"postinstall": "bower install", "postinstall": "bower install",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment