-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31b7d9a
commit 9e6a65f
Showing
5 changed files
with
218 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
node_modules/ | ||
public/assets/js/*.min.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"boss": true, | ||
"curly": true, | ||
"eqeqeq": true, | ||
"eqnull": true, | ||
"es3": true, | ||
"expr": true, | ||
"immed": true, | ||
"noarg": true, | ||
"onevar": true, | ||
"quotmark": "single", | ||
"trailing": true, | ||
"undef": true, | ||
"unused": true, | ||
|
||
"browser": true, | ||
|
||
"globals": { | ||
"_": false, | ||
"Backbone": false, | ||
"jQuery": false, | ||
"wp": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
/* jshint node:true */ | ||
'use strict'; | ||
|
||
module.exports = function( grunt ) { | ||
|
||
// auto load grunt tasks | ||
require( 'load-grunt-tasks' )( grunt ); | ||
|
||
var pluginConfig = { | ||
|
||
// gets the package vars | ||
pkg: grunt.file.readJSON( 'package.json' ), | ||
|
||
// plugin directories | ||
dirs: { | ||
front: { | ||
js: 'public/assets/js' | ||
} | ||
}, | ||
|
||
// svn settings | ||
svn_settings: { | ||
path: '../../../../wp_plugins/<%= pkg.name %>', | ||
tag: '<%= svn_settings.path %>/tags/<%= pkg.version %>', | ||
trunk: '<%= svn_settings.path %>/trunk', | ||
exclude: [ | ||
'.editorconfig', | ||
'.git/', | ||
'.gitignore', | ||
'.jshintrc', | ||
'node_modules/', | ||
'public/assets/js/update-checkout.js', | ||
'Gruntfile.js', | ||
'README.md', | ||
'package.json', | ||
'*.zip' | ||
] | ||
}, | ||
|
||
// javascript linting with jshint | ||
jshint: { | ||
options: { | ||
jshintrc: '.jshintrc' | ||
}, | ||
all: [ | ||
'Gruntfile.js', | ||
'<%= dirs.front.js %>/update-checkout.js' | ||
] | ||
}, | ||
|
||
// uglify to concat and minify | ||
uglify: { | ||
dist: { | ||
files: { | ||
'<%= dirs.front.js %>/update-checkout.min.js': ['<%= dirs.front.js %>/update-checkout.js'] | ||
} | ||
} | ||
}, | ||
|
||
// watch for changes and trigger compass, jshint and uglify | ||
watch: { | ||
js: { | ||
files: [ | ||
'<%= jshint.all %>' | ||
], | ||
tasks: ['jshint', 'uglify'] | ||
} | ||
}, | ||
|
||
// image optimization | ||
imagemin: { | ||
dist: { | ||
options: { | ||
optimizationLevel: 7, | ||
progressive: true | ||
}, | ||
files: [ | ||
{ | ||
expand: true, | ||
cwd: './', | ||
src: 'screenshot-*.png', | ||
dest: './' | ||
} | ||
] | ||
} | ||
}, | ||
|
||
// rsync commands used to take the files to svn repository | ||
rsync: { | ||
options: { | ||
args: ['--verbose'], | ||
exclude: '<%= svn_settings.exclude %>', | ||
syncDest: true, | ||
recursive: true | ||
}, | ||
tag: { | ||
options: { | ||
src: './', | ||
dest: '<%= svn_settings.tag %>' | ||
} | ||
}, | ||
trunk: { | ||
options: { | ||
src: './', | ||
dest: '<%= svn_settings.trunk %>' | ||
} | ||
} | ||
}, | ||
|
||
// shell command to commit the new version of the plugin | ||
shell: { | ||
// Remove delete files. | ||
svn_remove: { | ||
command: 'svn st | grep \'^!\' | awk \'{print $2}\' | xargs svn --force delete', | ||
options: { | ||
stdout: true, | ||
stderr: true, | ||
execOptions: { | ||
cwd: '<%= svn_settings.path %>' | ||
} | ||
} | ||
}, | ||
// Add new files. | ||
svn_add: { | ||
command: 'svn add --force * --auto-props --parents --depth infinity -q', | ||
options: { | ||
stdout: true, | ||
stderr: true, | ||
execOptions: { | ||
cwd: '<%= svn_settings.path %>' | ||
} | ||
} | ||
}, | ||
// Commit the changes. | ||
svn_commit: { | ||
command: 'svn commit -m "updated the plugin version to <%= pkg.version %>"', | ||
options: { | ||
stdout: true, | ||
stderr: true, | ||
execOptions: { | ||
cwd: '<%= svn_settings.path %>' | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
|
||
// initialize grunt config | ||
// -------------------------- | ||
grunt.initConfig( pluginConfig ); | ||
|
||
// register tasks | ||
// -------------------------- | ||
|
||
// default task | ||
grunt.registerTask( 'default', [ | ||
'jshint', | ||
'uglify' | ||
] ); | ||
|
||
// deploy task | ||
grunt.registerTask( 'deploy', [ | ||
'default', | ||
'rsync:tag', | ||
'rsync:trunk', | ||
'shell:svn_remove', | ||
'shell:svn_add', | ||
'shell:svn_commit' | ||
] ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "woocommerce-payment-discounts", | ||
"description": "WooCommerce Discounts Per Payment Method", | ||
"version": "2.0.0", | ||
"main": "Gruntfile.js", | ||
"devDependencies": { | ||
"grunt": "~0.4.1", | ||
"load-grunt-tasks": "0.2.0", | ||
"grunt-contrib-watch": "~0.5.3", | ||
"grunt-contrib-jshint": "~0.7.2", | ||
"grunt-contrib-uglify": "~0.2.7", | ||
"grunt-contrib-imagemin": "~0.4.0", | ||
"grunt-rsync": "~0.2.1", | ||
"grunt-shell": "~0.6.1" | ||
}, | ||
"engines": { | ||
"node": ">=0.8.0", | ||
"npm": ">=1.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters