Skip to content
Browse files

Add Builder

Add a Grunt `build` task that will create a zipped deployment package for
the plugin by first Grunting the project, then copying the files to a
release directory, cleaning up source files, and compressing the project.
Also tag v0.1.6.
  • Loading branch information...
1 parent 988ec16 commit 6a385ac251e4d7c390e8d270e2b4b3014674256e @ericmann ericmann committed Aug 13, 2013
Showing with 52 additions and 8 deletions.
  1. +1 −0 README.md
  2. +43 −3 root/Gruntfile.js
  3. +8 −5 template.js
View
1 README.md
@@ -77,6 +77,7 @@ The `/images/src` directory exists only to allow you to keep track of source fil
## Release History
+ * 2013-08-13 v0.1.6 Add deployment builder. Remove dates from Grunt headers.
* 2013-07-18 v0.1.5 Remove /extend references (props @trepmal).
* 2013-05-30 v0.1.4 Fix broken package.json generator.
* 2013-05-06 v0.1.3 Several I18N updates (props @bradyvercher)
View
46 root/Gruntfile.js
@@ -6,7 +6,7 @@ module.exports = function( grunt ) {
concat: {
options: {
stripBanners: true,
- banner: '/*! <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
@@ -48,7 +48,7 @@ module.exports = function( grunt ) {
'assets/js/{%= js_safe_name %}.min.js': ['assets/js/{%= js_safe_name %}.js']
},
options: {
- banner: '/*! <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
@@ -81,7 +81,7 @@ module.exports = function( grunt ) {
{% } %}
cssmin: {
options: {
- banner: '/*! <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
+ banner: '/*! <%= pkg.title %> - v<%= pkg.version %>\n' +
' * <%= pkg.homepage %>\n' +
' * Copyright (c) <%= grunt.template.today("yyyy") %>;' +
' * Licensed GPLv2+' +
@@ -133,6 +133,41 @@ module.exports = function( grunt ) {
debounceDelay: 500
}
}
+ },
+ clean: {
+ main: ['release/<%= pkg.version %>']
+ },
+ copy: {
+ // Copy the plugin to a versioned release directory
+ main: {
+ src: [
+ '**',
+ '!node_modules/**',
+ '!release/**',
+ '!.git/**',
+ '!.sass-cache/**',
+ '!css/src/**',
+ '!js/src/**',
+ '!img/src/**',
+ '!Gruntfile.js',
+ '!package.json',
+ '!.gitignore',
+ '!.gitmodules'
+ ],
+ dest: 'release/<%= pkg.version %>/'
+ }
+ },
+ compress: {
+ main: {
+ options: {
+ mode: 'zip',
+ archive: './release/{%= js_safe_name %}.<%= pkg.version %>.zip'
+ },
+ expand: true,
+ cwd: 'release/<%= pkg.version %>/',
+ src: ['**/*'],
+ dest: '{%= js_safe_name %}/'
+ }
}
} );
@@ -147,6 +182,9 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks('grunt-contrib-less');
{% } %}
grunt.loadNpmTasks('grunt-contrib-watch');
+ grunt.loadNpmTasks( 'grunt-contrib-clean' );
+ grunt.loadNpmTasks( 'grunt-contrib-copy' );
+ grunt.loadNpmTasks( 'grunt-contrib-compress' );
// Default task.
{% if ('sass' === css_type) { %}
@@ -156,6 +194,8 @@ module.exports = function( grunt ) {
{% } else { %}
grunt.registerTask( 'default', ['jshint', 'concat', 'uglify', 'cssmin'] );
{% } %}
+
+ grunt.registerTask( 'build', ['default', 'clean', 'copy', 'compress'] );
grunt.util.linefeed = '\n';
};
View
13 template.js
@@ -45,12 +45,15 @@ exports.template = function( grunt, init, done ) {
props.version = '0.1.0';
props.devDependencies = {
'grunt': '~0.4.1',
- 'grunt-contrib-concat': '~0.1.2',
- 'grunt-contrib-uglify': '~0.1.1',
- 'grunt-contrib-cssmin': '~0.6.0',
- 'grunt-contrib-jshint': '~0.1.1',
+ 'grunt-contrib-concat': '~0.1.2',
+ 'grunt-contrib-uglify': '~0.1.1',
+ 'grunt-contrib-cssmin': '~0.6.0',
+ 'grunt-contrib-jshint': '~0.1.1',
'grunt-contrib-nodeunit': '~0.1.2',
- 'grunt-contrib-watch': '~0.2.0',
+ 'grunt-contrib-watch': '~0.2.0',
+ 'grunt-contrib-clean': '~0.5.0',
+ 'grunt-contrib-copy': '~0.4.1',
+ 'grunt-contrib-compress': '~0.5.2'
};
// Sanitize names where we need to for PHP/JS

0 comments on commit 6a385ac

Please sign in to comment.
Something went wrong with that request. Please try again.