forked from felixarntz/options-definitely
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
59 lines (54 loc) · 1.42 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
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
pluginheader: '/*\n' +
'Plugin Name: Options Definitely\n' +
'Plugin URI: <%= pkg.homepage %>\n' +
'Description: <%= pkg.description %>\n' +
'Version: <%= pkg.version %>\n' +
'Author: <%= pkg.author.name %>\n' +
'Author URI: <%= pkg.author.url %>\n' +
'License: <%= pkg.license.name %>\n' +
'License URI: <%= pkg.license.url %>\n' +
'Text Domain: options-definitely\n' +
'Tags: <%= pkg.keywords.join(", ") %>\n' +
'*/',
fileheader: '/**\n' +
' * @package WPOD\n' +
' * @version <%= pkg.version %>\n' +
' * @author <%= pkg.author.name %> <<%= pkg.author.email %>>\n' +
' */',
replace: {
header: {
src: [
'options-definitely.php'
],
overwrite: true,
replacements: [{
from: /((?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:\/\/.*))/,
to: '<%= pluginheader %>'
}]
},
version: {
src: [
'options-definitely.php',
'inc/**/*.php'
],
overwrite: true,
replacements: [{
from: /\/\*\*\s+\*\s@package\s[^*]+\s+\*\s@version\s[^*]+\s+\*\s@author\s[^*]+\s\*\//,
to: '<%= fileheader %>'
}]
}
}
});
grunt.loadNpmTasks('grunt-text-replace');
grunt.registerTask('plugin', [
'replace:version',
'replace:header'
]);
grunt.registerTask('build', [
'plugin'
]);
};