Skip to content

Commit

Permalink
Update gruntfile and package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenharris committed Dec 7, 2013
1 parent 12b3c4c commit 47966d0
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 16 deletions.
150 changes: 137 additions & 13 deletions Gruntfile.js
@@ -1,8 +1,11 @@
module.exports = function(grunt) {

require('load-grunt-tasks')(grunt);

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

uglify: {
options: {
compress: {
Expand All @@ -14,28 +17,33 @@ module.exports = function(grunt) {
banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd HH:MM") %> */\n'
},
build: {
files: {
'js/frontend.min.js': ['js/frontend.js'],
'js/fullcalendar.min.js': ['js/fullcalendar.js'],
}
files: [{
expand: true, // Enable dynamic expansion.
src: ['js/*.js', '!js/*.min.js' ],
ext: '.min.js', // Dest filepaths will have this extension.
}]
}
},

jshint: {
options: {
globals: {
"WP_MARKDOWN_SCRIPT_DEBUG": false,
},
reporter: require('jshint-stylish'),
'-W020': true, //Read only - error when assigning WP_MARKDOWN_SCRIPT_DEBUG a value.
},
all: [ 'js/*.js', '!js/*.min.js' ]
},

wp_readme_to_markdown: {
convert:{
files: {
'readme.md': 'readme.txt'
},
},
},

phpunit: {
classes: {
dir: 'tests/php/'
Expand All @@ -45,21 +53,137 @@ module.exports = function(grunt) {
bootstrap: 'tests/php/phpunit.php',
colors: true
}
}
});

},

clean: {
//Clean up build folder
main: ['build/wp-markdown']
},

copy: {
// Copy the plugin to a versioned release directory
main: {
src: [
'**',
'!node_modules/**',
'!build/**',
'!.git/**',
'!tests/**',
'!vendor/**',
'!Gruntfile.js',
'!package.json',
'!.gitignore',
'!.gitmodules',
'!*~',
'!composer.lock',
'!composer.phar',
'!composer.json',
'!CONTRIBUTING.md'
],
dest: 'build/wp-markdown/'
}
},

checkrepo: {
deploy: {
tag: {
eq: '<%= pkg.version %>', // Check if highest repo tag is equal to pkg.version
},
tagged: true, // Check if last repo commit (HEAD) is not tagged
clean: true, // Check if the repo working directory is clean
}
},

wp_deploy: {
deploy:{
options: {
svn_user: 'stephenharris',
plugin_slug: 'wp-markdown',
build_dir: 'build/wp-markdown/'
},
}
},

po2mo: {
files: {
src: 'languages/*.po',
expand: true,
},
},

grunt.loadNpmTasks('grunt-contrib-uglify');
pot: {
options:{
text_domain: 'wp-markdown',
dest: 'languages/',
keywords: ['__:1',
'_e:1',
'_x:1,2c',
'esc_html__:1',
'esc_html_e:1',
'esc_html_x:1,2c',
'esc_attr__:1',
'esc_attr_e:1',
'esc_attr_x:1,2c',
'_ex:1,2c',
'_n:1,2',
'_nx:1,2,4c',
'_n_noop:1,2',
'_nx_noop:1,2,3c'
],
},
files:{
src: [
'**/*.php',
'!node_modules/**',
'!build/**',
'!tests/**',
'!vendor/**',
'!*~',
],
expand: true,
}
},

grunt.loadNpmTasks('grunt-contrib-jshint');
checktextdomain: {
options:{
text_domain: 'wp-markdown',
keywords: ['__:1,2d',
'_e:1,2d',
'_x:1,2c,3d',
'esc_html__:1,2d',
'esc_html_e:1,2d',
'esc_html_x:1,2c,3d',
'esc_attr__:1,2d',
'esc_attr_e:1,2d',
'esc_attr_x:1,2c,3d',
'_ex:1,2c,3d',
'_n:1,2,4d',
'_nx:1,2,4c,5d',
'_n_noop:1,2,3d',
'_nx_noop:1,2,3c,4d'
],
},
files: {
src: [
'**/*.php',
'!node_modules/**',
'!build/**',
'!tests/**',
'!vendor/**',
'!*~',
],
expand: true,
},
},

});

grunt.loadNpmTasks('grunt-wp-readme-to-markdown');

grunt.loadNpmTasks('grunt-phpunit');
//Tasks
grunt.registerTask( 'test', [ 'phpunit', 'jshint' ] );
grunt.registerTask( 'build', [ 'test', 'newer:uglify', 'pot', 'po2mo', 'wp_readme_to_markdown', 'clean', 'copy' ] );
grunt.registerTask( 'deploy', [ 'checkbranch:master', 'checkrepo:deploy', 'build', 'wp_deploy' ] );

// Default task(s).
grunt.registerTask('default', ['uglify']);

grunt.registerTask('readme', ['wp_readme_to_markdown']);
};
16 changes: 13 additions & 3 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "wp-markdown",
"version": "1.4.0",
"version": "1.5.0",
"description": "Allows you to use MarkDown in posts, BBPress forums and comments",
"main": "Gruntfile.js",
"repository": {
Expand All @@ -16,7 +16,17 @@
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-jshint": "~0.6.3",
"grunt-wp-readme-to-markdown": "~0.1.0",
"grunt-phpunit": "~0.3.0"
"grunt-wp-readme-to-markdown": "~0.4.0",
"grunt-phpunit": "~0.3.0",
"grunt-checktextdomain": "~0.1.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-copy": "~0.4.1",
"load-grunt-tasks": "~0.2.0",
"jshint-stylish": "~0.1.3",
"grunt-checkrepo": "~0.1.0",
"grunt-checkbranch": "~0.2.2",
"grunt-wp-deploy": "~0.2.0",
"grunt-po2mo": "~0.1.0",
"grunt-pot": "~0.1.0"
}
}

0 comments on commit 47966d0

Please sign in to comment.