Skip to content

Commit

Permalink
Update composer and add Grunt support to handle build and deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
unfulvio committed Oct 18, 2015
1 parent 1e367fc commit 1ad3f0a
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 13 deletions.
17 changes: 5 additions & 12 deletions .gitignore
Expand Up @@ -11,28 +11,21 @@ sftp-config.json
.floo
.flooignore

### Node ###
### Dev ###
/build
/node_modules/
/deploy/

### Bower ###
/bower_components

### Sass ###
.sass-cache/

### Composer ###
/vendor/
composer.lock

### Unit tests ###
### Tests ###
/tmp
/tests/bin/tmp

### Logs ###
*.log
/logs

### VCS ###
### SVN ###
.svn
/svn

Expand Down
151 changes: 151 additions & 0 deletions Gruntfile.js
@@ -0,0 +1,151 @@
module.exports = function( grunt ) {

var pkg = grunt.file.readJSON( 'package.json' );

console.log( pkg.title + ' - ' + pkg.version );

// Files to include in a release.
var distFiles = [
'lib/**',
'LICENSE.txt',
'plugin.php',
'README.txt'
];

grunt.initConfig( {

pkg: pkg,

checktextdomain: {
options: {
text_domain : 'wp-api-menus',
correct_domain: false,
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',
' __ngettext:1,2,3d',
'__ngettext_noop:1,2,3d',
'_c:1,2d',
'_nc:1,2,4c,5d'
]
},
files : {
src : [
'lib/**/*.php',
'plugin.php'
],
expand: true
}
},

makepot: {
target: {
options: {
cwd : '',
domainPath : '/languages',
potFilename : 'wp-api-menus.pot',
mainFile : 'plugin.php',
include : [],
exclude : [
'assets/',
'build/',
'languages/',
'svn',
'tests',
'tmp',
'vendor'
],
potComments : '',
potHeaders : {
poedit : true,
'x-poedit-keywordslist': true,
'language' : 'en_US',
'report-msgid-bugs-to' : 'https://github.com/nekojira/wp-api-menus/issues',
'last-translator' : 'Fulvio Notarstefano <fulvio.notarstefano@gmail.com>',
'language-Team' : 'Fulvio Notarstefano <fulvio.notarstefano@gmail.com>'
},
type : 'wp-plugin',
updateTimestamp: true,
updatePoFiles : true,
processPot : null
}
}
},

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

clean: {
build: [ 'build' ]
},

copy: {
main: {
expand: true,
src : distFiles,
dest : 'build/wp-api-menus'
}
},

compress: {
main: {
options: {
mode : 'zip',
archive: './build/wp-api-menus-<%= pkg.version %>.zip'
},
expand : true,
src : distFiles,
dest : '/wp-api-menus'
}
},

wp_deploy: {
deploy: {
options: {
plugin_slug : 'wp-api-menus',
plugin_main_file: 'plugin.php',
build_dir : 'build/wp-api-menus',
max_buffer : 400 * 1024
}
}
},

phpunit: {
classes: {
dir: 'tests/phpunit/unit-tests'
},
options: {
bin : 'vendor/bin/phpunit',
configuration: 'phpunit.xml',
testSuffix : '.php'
}
},

} );

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

grunt.registerTask( 'build', ['clean:build', 'copy', 'compress'] );
grunt.registerTask( 'deploy', ['build', 'wp_deploy'] );

grunt.util.linefeed = '\n';
};
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -16,6 +16,6 @@
],
"require": {
"php": ">=5.3.2",
"composer/installers": "v1.0.19"
"composer/installers": "~1.0"
}
}
28 changes: 28 additions & 0 deletions package.json
@@ -0,0 +1,28 @@
{
"name": "wp-api-menus",
"title": "WP API Menus",
"description": "Extends the WordPress JSON REST WP API with new routes pointing to WordPress menus.",
"version": "1.2.0",
"license": "GPL-2.0+",
"homepage": "https://wordpress.org/plugins/wp-api-menus",
"repository": {
"type": "git",
"url": "https://github.com/nekojira/wp-api-menus"
},
"keywords": [],
"devDependencies": {
"autoprefixer": "^6.0.1",
"grunt": "^0.4.5",
"grunt-checktextdomain": "^1.0.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-copy": "^0.8.1",
"grunt-phpunit": "^0.3.6",
"grunt-po2mo": "^0.1.2",
"grunt-shell": "~1.1.2",
"grunt-wp-deploy": "^1.1.0",
"grunt-wp-i18n": "^0.5.2",
"load-grunt-tasks": "^3.2.0",
"reporter-plus": "jayeb/reporter-plus"
}
}

0 comments on commit 1ad3f0a

Please sign in to comment.