2015-01-03 22:49:28 +00:00
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-clean');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-copy');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-recess');
|
|
|
|
grunt.loadNpmTasks('grunt-karma');
|
|
|
|
grunt.loadNpmTasks('grunt-html2js');
|
|
|
|
|
|
|
|
// Default task.
|
2015-08-25 05:59:54 +00:00
|
|
|
grunt.registerTask('default', ['jshint', 'build', 'karma:unit']);
|
|
|
|
grunt.registerTask('build', ['clean', 'html2js', 'concat', 'recess:build', 'copy']);
|
|
|
|
grunt.registerTask('release', ['clean', 'html2js', 'uglify', 'jshint', 'karma:unit', 'concat:index', 'recess:min', 'copy']);
|
2015-01-03 22:49:28 +00:00
|
|
|
grunt.registerTask('test-watch', ['karma:watch']);
|
|
|
|
|
|
|
|
// Print a timestamp (useful for when watching)
|
2015-08-25 05:59:54 +00:00
|
|
|
grunt.registerTask('timestamp', function () {
|
2015-01-03 22:49:28 +00:00
|
|
|
grunt.log.subhead(Date());
|
|
|
|
});
|
|
|
|
|
2015-08-25 05:59:54 +00:00
|
|
|
var karmaConfig = function (configFile, customOptions) {
|
|
|
|
var options = {configFile: configFile, keepalive: true};
|
|
|
|
var travisOptions = process.env.TRAVIS && {browsers: ['Firefox'], reporters: 'dots'};
|
2015-01-03 22:49:28 +00:00
|
|
|
return grunt.util._.extend(options, customOptions, travisOptions);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Project configuration.
|
|
|
|
grunt.initConfig({
|
|
|
|
distdir: 'dist',
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2015-08-29 07:38:03 +00:00
|
|
|
remoteApiVersion: 'v1.20',
|
2015-08-25 05:59:54 +00:00
|
|
|
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
|
2015-01-03 22:49:28 +00:00
|
|
|
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
|
|
|
|
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>;\n' +
|
|
|
|
' * Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %>\n */\n',
|
|
|
|
src: {
|
2015-01-19 05:20:49 +00:00
|
|
|
js: ['app/**/*.js', '!app/**/*.spec.js'],
|
2015-01-03 22:49:28 +00:00
|
|
|
jsTpl: ['<%= distdir %>/templates/**/*.js'],
|
|
|
|
specs: ['test/**/*.spec.js'],
|
|
|
|
scenarios: ['test/**/*.scenario.js'],
|
|
|
|
html: ['index.html'],
|
|
|
|
tpl: {
|
|
|
|
app: ['app/components/**/*.html']
|
|
|
|
},
|
|
|
|
css: ['assets/css/app.css']
|
|
|
|
},
|
|
|
|
clean: ['<%= distdir %>/*'],
|
|
|
|
copy: {
|
|
|
|
assets: {
|
2015-08-25 05:59:54 +00:00
|
|
|
files: [{dest: '<%= distdir %>/assets', src: '**', expand: true, cwd: 'assets/'}]
|
2015-01-03 22:49:28 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
karma: {
|
2015-08-25 05:59:54 +00:00
|
|
|
unit: {options: karmaConfig('test/unit/karma.conf.js')},
|
|
|
|
watch: {options: karmaConfig('test/unit/karma.conf.js', {singleRun: false, autoWatch: true})}
|
2015-01-03 22:49:28 +00:00
|
|
|
},
|
|
|
|
html2js: {
|
|
|
|
app: {
|
|
|
|
options: {
|
|
|
|
base: '.'
|
|
|
|
},
|
|
|
|
src: ['<%= src.tpl.app %>'],
|
|
|
|
dest: '<%= distdir %>/templates/app.js',
|
|
|
|
module: '<%= pkg.name %>.templates'
|
|
|
|
}
|
|
|
|
},
|
2015-08-25 05:59:54 +00:00
|
|
|
concat: {
|
|
|
|
dist: {
|
2015-01-03 22:49:28 +00:00
|
|
|
options: {
|
|
|
|
banner: "<%= banner %>",
|
|
|
|
process: true
|
|
|
|
},
|
2015-08-25 05:59:54 +00:00
|
|
|
src: ['<%= src.js %>', '<%= src.jsTpl %>'],
|
|
|
|
dest: '<%= distdir %>/<%= pkg.name %>.js'
|
2015-01-03 22:49:28 +00:00
|
|
|
},
|
|
|
|
index: {
|
|
|
|
src: ['index.html'],
|
|
|
|
dest: '<%= distdir %>/index.html',
|
|
|
|
options: {
|
|
|
|
process: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
angular: {
|
2015-08-25 05:59:54 +00:00
|
|
|
src: ['assets/js/angularjs/1.3.15/angular.min.js',
|
|
|
|
'assets/js/angularjs/1.3.15/angular-route.min.js',
|
|
|
|
'assets/js/angularjs/1.3.15/angular-resource.min.js',
|
|
|
|
'assets/js/ui-bootstrap/ui-bootstrap-custom-tpls-0.12.0.min.js',
|
|
|
|
'assets/js/angular-oboe.min.js'],
|
2015-01-03 22:49:28 +00:00
|
|
|
dest: '<%= distdir %>/angular.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
uglify: {
|
2015-08-25 05:59:54 +00:00
|
|
|
dist: {
|
2015-01-03 22:49:28 +00:00
|
|
|
options: {
|
|
|
|
banner: "<%= banner %>"
|
|
|
|
},
|
2015-08-25 05:59:54 +00:00
|
|
|
src: ['<%= src.js %>', '<%= src.jsTpl %>'],
|
|
|
|
dest: '<%= distdir %>/<%= pkg.name %>.js'
|
2015-01-03 22:49:28 +00:00
|
|
|
},
|
|
|
|
angular: {
|
2015-08-25 05:59:54 +00:00
|
|
|
src: ['<%= concat.angular.src %>'],
|
2015-01-03 22:49:28 +00:00
|
|
|
dest: '<%= distdir %>/angular.js'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
recess: {
|
|
|
|
build: {
|
|
|
|
files: {
|
2015-08-25 05:59:54 +00:00
|
|
|
'<%= distdir %>/<%= pkg.name %>.css': ['<%= src.css %>']
|
|
|
|
},
|
2015-01-03 22:49:28 +00:00
|
|
|
options: {
|
|
|
|
compile: true,
|
|
|
|
noOverqualifying: false // TODO: Added because of .nav class, rename
|
|
|
|
}
|
|
|
|
},
|
|
|
|
min: {
|
|
|
|
files: {
|
|
|
|
'<%= distdir %>/<%= pkg.name %>.css': ['<%= src.css %>']
|
|
|
|
},
|
|
|
|
options: {
|
|
|
|
compress: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-08-25 05:59:54 +00:00
|
|
|
watch: {
|
2015-01-03 22:49:28 +00:00
|
|
|
all: {
|
2015-08-25 05:59:54 +00:00
|
|
|
files: ['<%= src.js %>', '<%= src.specs %>', '<%= src.css %>', '<%= src.tpl.app %>', '<%= src.tpl.common %>', '<%= src.html %>'],
|
|
|
|
tasks: ['default', 'timestamp']
|
2015-01-03 22:49:28 +00:00
|
|
|
},
|
|
|
|
build: {
|
2015-08-25 05:59:54 +00:00
|
|
|
files: ['<%= src.js %>', '<%= src.specs %>', '<%= src.css %>', '<%= src.tpl.app %>', '<%= src.tpl.common %>', '<%= src.html %>'],
|
|
|
|
tasks: ['build', 'timestamp']
|
2015-01-03 22:49:28 +00:00
|
|
|
}
|
|
|
|
},
|
2015-08-25 05:59:54 +00:00
|
|
|
jshint: {
|
|
|
|
files: ['gruntFile.js', '<%= src.js %>', '<%= src.jsTpl %>', '<%= src.specs %>', '<%= src.scenarios %>'],
|
|
|
|
options: {
|
|
|
|
curly: true,
|
|
|
|
eqeqeq: true,
|
|
|
|
immed: true,
|
|
|
|
latedef: true,
|
|
|
|
newcap: true,
|
|
|
|
noarg: true,
|
|
|
|
sub: true,
|
|
|
|
boss: true,
|
|
|
|
eqnull: true,
|
|
|
|
globals: {
|
2015-01-04 00:39:40 +00:00
|
|
|
angular: false,
|
|
|
|
'$': false
|
|
|
|
}
|
2015-01-03 22:49:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|