Skip to content

Commit

Permalink
Merge pull request #84 from rhubarbselleven/updateGruntfile
Browse files Browse the repository at this point in the history
Update gruntfile
  • Loading branch information
rhubarbselleven committed Feb 27, 2015
2 parents aefec1c + 9c60408 commit 3c6c7a5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 32 deletions.
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ To begin ensure that you have installed the project dev dependencies via:
### Via Grunt

Running `grunt` alone will default to running the tests once.
Running `grunt watch` will rerun the tests after any file change.

## Documentation Fixes

Expand Down
68 changes: 39 additions & 29 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ module.exports = function(grunt) {

meta: {
version: '<%= pkg.version %>',
banner: (
banner:
'// Backbone.Syphon, v<%= meta.version %>\n' +
'// ----------------------------------\n' +
'//\n' +
'// Copyright (c) <%= grunt.template.today("yyyy") %> Derick Bailey, Muted Solutions, LLC.\n' +
'// Distributed under MIT license\n' +
'//\n' +
'// http://github.com/marionettejs/backbone.syphon\n'
)
},

clean: {
lib: 'lib/'
lib: 'lib/',
tmp: 'tmp/'
},

preprocess: {
Expand All @@ -42,6 +45,16 @@ module.exports = function(grunt) {
}
},

concat: {
options: {
banner: '<%= meta.banner %>'
},
lib: {
src: '<%= preprocess.lib.dest %>',
dest: '<%= preprocess.lib.dest %>'
}
},

uglify: {
options: {
banner: '<%= meta.banner %>',
Expand Down Expand Up @@ -69,24 +82,27 @@ module.exports = function(grunt) {
}
},

jasmine: {
tests: {
lintspaces: {
all: {
src: [
'tmp/backbone.syphon.js'
'src/*.js'
],
options: {
specs: 'spec/javascripts/*.spec.js',
vendor: [
'bower_components/jquery/dist/jquery.js',
'bower_components/underscore/underscore.js',
'bower_components/backbone/backbone.js',
'spec/javascripts/helpers/jasmine-jquery.js',
'spec/javascripts/helpers/SpecHelper.js'
]
editorconfig: '.editorconfig'
}
}
},

watch: {
syphon: {
options: {
spawn: false
},
files: ['src/**/*.js', 'spec/**/*.js'],
tasks: ['test']
}
},

mochaTest: {
spec: {
options: {
Expand All @@ -103,22 +119,16 @@ module.exports = function(grunt) {
}
});

grunt.registerTask('build', [
'jshint:src',
'clean:lib',
'preprocess:lib',
'template:lib',
'uglify'
]);

grunt.registerTask('test', [
'jshint',
'preprocess:tmp',
'mochaTest'
]);
grunt.registerTask('default', 'An alias task for running tests.', ['test']);

grunt.registerTask('lint', 'Lints our sources', ['lintspaces', 'jshint']);

grunt.registerTask('test', 'Run the unit tests.', ['lint', 'preprocess:tmp', 'mochaTest']);

grunt.registerTask('dev', 'Auto-lints while writing code.', ['test', 'watch:syphon']);

grunt.registerTask('default', [
'build',
'test'
grunt.registerTask('build', 'Builds the library', [
'clean', 'lint', 'preprocess', 'template', 'concat', 'uglify'
]);
};
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@
"chai-jquery": "^1.2.3",
"grunt": "^0.4.4",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-jasmine": "^0.6.3",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.4.0",
"grunt-contrib-watch": "0.6.1",
"grunt-mocha-test": "^0.11.0",
"grunt-preprocess": "^4.0.0",
"grunt-template": "^0.2.3",
"grunt-lintspaces": "0.4.1",
"jsdom": "^0.11.0",
"load-grunt-tasks": "^0.4.0",
"mocha": "^1.20.1",
"sinon": "^1.10.2",
"sinon-chai": "^2.5.0"
"sinon-chai": "^2.5.0"
}
}

0 comments on commit 3c6c7a5

Please sign in to comment.