Merge branch 'grunt' into develop

This commit is contained in:
Hyzual 2015-01-17 19:03:57 +01:00
commit a0a697d3e2
5 changed files with 104 additions and 40 deletions

21
.editorconfig Normal file
View file

@ -0,0 +1,21 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 4
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false

1
.gitignore vendored
View file

@ -3,3 +3,4 @@ bower_components
node_modules node_modules
/.tmp /.tmp
/.ssh /.ssh
/coverage

View file

@ -9,8 +9,12 @@
module.exports = function (grunt) { module.exports = function (grunt) {
// Load grunt tasks automatically // Lazy-load grunt tasks automatically
require('load-grunt-tasks')(grunt); require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
sshexec: 'grunt-ssh',
sftp: 'grunt-ssh'
});
// Time how long tasks take. Can help when optimizing build times // Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt); require('time-grunt')(grunt);
@ -86,18 +90,26 @@ module.exports = function (grunt) {
} }
}, },
test: { test: {
options: { options: {
port: 9001, port: 9001,
middleware: function (connect) { middleware: function (connect) {
return [ return [
connect().use( connect().use(
'/bower_components', '/bower_components',
connect.static('./bower_components') connect.static('./bower_components')
), ),
connect.static(appConfig.app) connect.static(appConfig.app)
]; ];
}
}
},
coverage: {
options: {
open: true,
port: 9003,
keepalive: true,
base: './coverage/'
} }
}
}, },
dist: { dist: {
options: { options: {
@ -115,12 +127,14 @@ module.exports = function (grunt) {
}, },
unit: { unit: {
singleRun: true, singleRun: true,
browsers: ['Chrome'] browsers: ['Chrome'],
reporters: ['notify', 'coverage']
}, },
continuous: { continuous: {
singleRun: false, singleRun: false,
background: true, background: true,
browsers: ['PhantomJS'] browsers: ['Chrome'],
reporters: ['progress', 'notify']
} }
}, },
@ -346,11 +360,19 @@ module.exports = function (grunt) {
createDirectories: true createDirectories: true
} }
} }
} },
// Display notfifications when builds complete using Growl
notify: {
deploy: {
options: {
message: 'Jamstash deployed to test server'
}
}
}
}); });
grunt.registerTask('serve', 'Compile then start a connect web server', function (target) { grunt.registerTask('serve', 'Compile then start a connect web server', function(target) {
if (target === 'dist') { if (target === 'dist') {
return grunt.task.run(['build', 'connect:dist:keepalive']); return grunt.task.run(['build', 'connect:dist:keepalive']);
} }
@ -363,31 +385,43 @@ module.exports = function (grunt) {
]); ]);
}); });
grunt.registerTask('test', [ grunt.registerTask('test', 'Run unit tests and jshint', function() {
'karma:unit', return grunt.task.run([
'jshint' 'karma:unit',
]); 'jshint'
]);
});
grunt.registerTask('build', [ grunt.registerTask('coverage', 'Run unit tests and display test coverage results on browser', function() {
'clean:dist', return grunt.task.run([
'wiredep:app', 'karma:unit',
'useminPrepare', 'connect:coverage'
'concat:generated', ]);
'copy:dist', });
'imagemin',
//'ngAnnotate', grunt.registerTask('build', 'Concatenate all JS files, minify all JS, CSS, HTML and image files and version all static assets', function() {
'cssmin', return grunt.task.run([
'uglify:generated', 'clean:dist',
'filerev', 'wiredep:app',
'usemin', 'useminPrepare',
'htmlmin' 'concat:generated',
]); 'copy:dist',
'imagemin',
//'ngAnnotate',
'cssmin',
'uglify:generated',
'filerev',
'usemin',
'htmlmin'
]);
});
grunt.registerTask('deploy', 'Build and deploy to test server', function() { grunt.registerTask('deploy', 'Build and deploy to test server', function() {
return grunt.task.run([ return grunt.task.run([
'build', 'build',
'sshexec:cleanTest', 'sshexec:cleanTest',
'sftp:test' 'sftp:test',
'notify:deploy'
]); ]);
}); });

View file

@ -42,6 +42,10 @@ module.exports = function(config) {
// list of files / patterns to exclude // list of files / patterns to exclude
exclude: ['app/vendor/**/*.js'], exclude: ['app/vendor/**/*.js'],
preprocessors: {
'app/**/!(*_test).js': ['coverage']
},
// web server port // web server port
port: 8080, port: 8080,
@ -54,14 +58,16 @@ module.exports = function(config) {
// - PhantomJS // - PhantomJS
// - IE (only Windows) // - IE (only Windows)
browsers: [ browsers: [
'Chrome' 'PhantomJS'
], ],
// Which plugins to enable // Which plugins to enable
plugins: [ plugins: [
'karma-chrome-launcher', 'karma-chrome-launcher',
'karma-phantomjs-launcher', 'karma-phantomjs-launcher',
'karma-jasmine' 'karma-jasmine',
'karma-coverage',
'karma-notify-reporter'
], ],
// Continuous Integration mode // Continuous Integration mode

View file

@ -42,16 +42,18 @@
"grunt-filerev": "^2.1.1", "grunt-filerev": "^2.1.1",
"grunt-karma": "^0.9.0", "grunt-karma": "^0.9.0",
"grunt-ng-annotate": "^0.5.0", "grunt-ng-annotate": "^0.5.0",
"grunt-notify": "^0.4.1",
"grunt-ssh": "^0.12.0", "grunt-ssh": "^0.12.0",
"grunt-usemin": "^2.6.0", "grunt-usemin": "^2.6.0",
"grunt-wiredep": "^1.9.0", "grunt-wiredep": "^1.9.0",
"jit-grunt": "^0.9.0",
"jshint-stylish": "^1.0.0", "jshint-stylish": "^1.0.0",
"karma": "^0.12.25", "karma": "^0.12.25",
"karma-chrome-launcher": "^0.1.5", "karma-chrome-launcher": "^0.1.5",
"karma-coverage": "^0.2.6",
"karma-jasmine": "^0.3.0", "karma-jasmine": "^0.3.0",
"karma-notify-reporter": "^0.1.1",
"karma-phantomjs-launcher": "^0.1.4", "karma-phantomjs-launcher": "^0.1.4",
"load-grunt-tasks": "^1.0.0",
"sellout": "0.0.1",
"time-grunt": "^1.0.0" "time-grunt": "^1.0.0"
}, },
"engines": { "engines": {