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
/.tmp
/.ssh
/coverage

View file

@ -9,8 +9,12 @@
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Lazy-load grunt tasks automatically
require('jit-grunt')(grunt, {
useminPrepare: 'grunt-usemin',
sshexec: 'grunt-ssh',
sftp: 'grunt-ssh'
});
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
@ -99,6 +103,14 @@ module.exports = function (grunt) {
}
}
},
coverage: {
options: {
open: true,
port: 9003,
keepalive: true,
base: './coverage/'
}
},
dist: {
options: {
port: 9002,
@ -115,12 +127,14 @@ module.exports = function (grunt) {
},
unit: {
singleRun: true,
browsers: ['Chrome']
browsers: ['Chrome'],
reporters: ['notify', 'coverage']
},
continuous: {
singleRun: false,
background: true,
browsers: ['PhantomJS']
browsers: ['Chrome'],
reporters: ['progress', 'notify']
}
},
@ -346,8 +360,16 @@ module.exports = function (grunt) {
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) {
@ -363,12 +385,22 @@ module.exports = function (grunt) {
]);
});
grunt.registerTask('test', [
grunt.registerTask('test', 'Run unit tests and jshint', function() {
return grunt.task.run([
'karma:unit',
'jshint'
]);
});
grunt.registerTask('build', [
grunt.registerTask('coverage', 'Run unit tests and display test coverage results on browser', function() {
return grunt.task.run([
'karma:unit',
'connect:coverage'
]);
});
grunt.registerTask('build', 'Concatenate all JS files, minify all JS, CSS, HTML and image files and version all static assets', function() {
return grunt.task.run([
'clean:dist',
'wiredep:app',
'useminPrepare',
@ -382,12 +414,14 @@ module.exports = function (grunt) {
'usemin',
'htmlmin'
]);
});
grunt.registerTask('deploy', 'Build and deploy to test server', function() {
return grunt.task.run([
'build',
'sshexec:cleanTest',
'sftp:test'
'sftp:test',
'notify:deploy'
]);
});

View file

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

View file

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