Skip to content

Commit

Permalink
Updating Gruntfile
Browse files Browse the repository at this point in the history
  • Loading branch information
darsain committed Dec 4, 2013
1 parent e8c4ba8 commit 87aa3ce
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 34 deletions.
36 changes: 10 additions & 26 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*jshint node:true */
module.exports = function(grunt) {
module.exports = function (grunt) {
'use strict';

// Override environment based line endings enforced by Grunt
grunt.util.linefeed = '\n';

// Grunt configuration
grunt.initConfig({
pkg: grunt.file.readJSON('bower.json'),
pkg: grunt.file.readJSON('meta.json'),
meta: {
banner: '/*!\n' +
' * <%= pkg.title %> <%= pkg.version %> - <%= grunt.template.today("dS mmm yyyy") %>\n' +
Expand All @@ -23,7 +23,7 @@ module.exports = function(grunt) {
// JSHint the code.
jshint: {
options: {
jshintrc: '.jshintrc'
jshintrc: true
},
all: ['src/*.js']
},
Expand Down Expand Up @@ -63,43 +63,28 @@ module.exports = function(grunt) {
}
},

// Compress files.
compress: {
// Bump up fields in JSON files.
bumpup: {
options: {
mode: 'gzip'
},
vanilla: {
src: 'dist/<%= pkg.name %>.min.js',
dest: 'dist/<%= pkg.name %>.min.js.gz'
updateProps: {
pkg: 'meta.json',
},
},
jquery: {
src: 'dist/jquery.<%= pkg.name %>.min.js',
dest: 'dist/jquery.<%= pkg.name %>.min.js.gz'
}
files: ['meta.json', '<%= pkg.name %>.jquery.json'],
},

// Bump up fields in JSON files.
bumpup: ['component.json', '<%= pkg.name %>.jquery.json'],

// Commit changes and tag the latest commit with a version from JSON file.
tagrelease: 'component.json'
tagrelease: '<%= pkg.version %>'
});

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-tagrelease');
grunt.loadNpmTasks('grunt-bumpup');
grunt.loadNpmTasks('grunt-gcc');

// Task for updating the pkg config property. Needs to be run after
// bumpup so the next tasks in queue can work with updated values.
grunt.registerTask('updatePkg', function () {
grunt.config.set('pkg', grunt.file.readJSON('component.json'));
});

// Build task.
grunt.registerTask('build', function () {
grunt.task.run('clean');
Expand All @@ -112,7 +97,6 @@ module.exports = function(grunt) {
type = type ? type : 'patch';
grunt.task.run('jshint');
grunt.task.run('bumpup:' + type);
grunt.task.run('updatePkg');
grunt.task.run('build');
grunt.task.run('tagrelease');
});
Expand Down
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"name": "motio",
"version": "0.0.0",
"devDependencies": {
"grunt-contrib-compress": "~0.4.1",
"grunt-contrib-jshint": "~0.2.0",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-clean": "~0.4.0",
"grunt-tagrelease": "~0.2.0",
"grunt-bumpup": "~0.2.0",
"grunt-gcc": "~0.2.0",
"grunt": "~0.4.0"
"grunt-contrib-jshint": "~0.7.2",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-tagrelease": "~0.2.1",
"grunt-bumpup": "~0.4.2",
"grunt-gcc": "~0.2.2",
"grunt": "~0.4.2"
}
}

0 comments on commit 87aa3ce

Please sign in to comment.