-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
85 lines (80 loc) · 3.06 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
makepot: {
target: {
options: {
cwd: '',
domainPath: '/languages',
exclude: ['wc-skroutz-analytics.php'],
include: [],
mainFile: 'wc-skroutz-analytics.php',
potComments: '',
potFilename: 'wc-skroutz-analytics.pot',
potHeaders: {
poedit: true,
'x-poedit-keywordslist': true,
'x-poedit-country': 'Greece',
'last-translator': 'Skroutz SA <[email protected]>',
'language-team': 'Skroutz SA <[email protected]>'
},
processPot: function( pot ) {
var translation,
excluded_meta = [
'Plugin Name of the plugin/theme',
'Plugin URI of the plugin/theme',
'Author of the plugin/theme',
'Author URI of the plugin/theme'
];
for ( translation in pot.translations[''] ) {
if ( 'undefined' !== typeof pot.translations[''][ translation ].comments.extracted ) {
if ( excluded_meta.indexOf( pot.translations[''][ translation ].comments.extracted ) >= 0 ) {
console.log( 'Excluded meta: ' + pot.translations[''][ translation ].comments.extracted );
delete pot.translations[''][ translation ];
}
}
}
return pot;
},
type: 'wp-plugin',
updateTimestamp: true,
updatePoFiles: false
}
}
},
wp_plugin: {
deploy: {
options: {
assets_dir: 'assets/wp',
deploy_dir: 'deploy', // Relative path to your deploy directory (required).
plugin_slug: 'wc-skroutz-analytics',
svn_username: 'skroutz',
svn_repository: 'https://plugins.svn.wordpress.org/skroutz-analytics-woocommerce/'
}
}
},
copy: {
main: {
files: [
{
expand: true,
src: ['**', '!tmp/**', '!Gruntfile.js', '!node_modules/**', '!package.json', '!README.md', '!*.sublime*', '!assets/wp/**', '!deploy/**'],
dest: 'deploy/'
},
],
},
},
clean: ['deploy/**', 'tmp/**']
});
// Load plugins
grunt.loadNpmTasks('grunt-wp-i18n');
grunt.loadNpmTasks('grunt-wp-plugin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.registerTask('deploy', 'Create a deploy dir, deploy to wordpress svn and clean up', function() {
grunt.log.ok('Start deploying...');
grunt.task.run(['clean', 'copy', 'wp_plugin', 'clean']);
grunt.log.ok('Deploy finished!');
});
};