-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
96 lines (87 loc) · 1.82 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
86
87
88
89
90
91
92
93
94
95
96
module.exports = function( grunt ) {
require('load-grunt-tasks')(grunt);
var pkg = grunt.file.readJSON( 'package.json' );
// Project configuration
grunt.initConfig( {
pkg: pkg,
copy: {
magic: {
src: ['loader.php'],
dest: 'examples/wp-magic.php'
},
magicversion: {
src: ['examples/wp-magic.php'],
dest: 'examples/wp-magic-version-011.php'
}
},
replace: {
makemagic: {
src: ['examples/wp-magic.php'],
overwrite: true,
replacements: [
{
from: 'LIBCLASSNAME',
to: 'WP_Magic'
},
{
from: 'LIBNAMEUPPER',
to: 'WP_MAGIC'
},
{
from: 'LIBNAMELOWER',
to: 'wp_magic'
},
{
from: 'LIBURL',
to: 'https://wp-magic.io'
},
{
from: 'AUTHORNAME',
to: 'John Doe'
},
{
from: 'AUTHOREMAIL',
to: '[email protected]'
}
]
},
makemagicversion: {
src: ['examples/wp-magic-version-011.php'],
overwrite: true,
replacements: [
{
from: '@version 0.1.0',
to: '@version 0.1.1'
},
{
from: '@version 0.1.0',
to: '@version 0.1.1'
},
{
from: 'WP_Magic_010',
to: 'WP_Magic_011'
},
{
from: "const VERSION = '0.1.0';",
to: "const VERSION = '0.1.1';"
},
{
from: 'const PRIORITY = 9999;',
to: 'const PRIORITY = 9998;'
}
]
},
},
githooks: {
all: {
// create zip and deploy changes to ftp
'pre-push': 'allwpmagic'
}
}
} );
grunt.registerTask( 'wpmagic', [ 'copy:magic', 'replace:makemagic' ] );
grunt.registerTask( 'wpmagicversion', [ 'copy:magicversion', 'replace:makemagicversion' ] );
grunt.registerTask( 'allwpmagic', [ 'wpmagic', 'wpmagicversion' ] );
grunt.registerTask( 'default', [ 'allwpmagic' ] );
grunt.util.linefeed = '\n';
};