-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
127 lines (121 loc) · 2.5 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*jslint node: true */
"use strict";
module.exports = function( grunt ) {
// Grab package as variable for later use/
var pkg = grunt.file.readJSON( 'package.json' );
// Load all tasks.
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});
// Project configuration
grunt.initConfig( {
pkg: pkg,
devUpdate: {
main: {
options: {
updateType: 'prompt',
packages: {
devDependencies: true
},
}
}
},
prompt: {
version: {
options: {
questions: [
{
config: 'newVersion',
type: 'input',
message: 'What specific version would you like',
default: '<%= pkg.version %>'
}
]
}
}
},
replace: {
package: {
src: ['package.json'],
overwrite: true,
replacements: [
{
"version": "1.0.0",
from: /("version":\s*).*,\n/g,
to: '$1"<%= newVersion %>",\n'
}
]
},
readme: {
src: ['readme.txt'],
overwrite: true,
replacements: [
{
from: /(Stable tag:\s*).*\n/g,
to: '$1<%= newVersion %>\n'
}
]
},
php: {
src: ['custom-post-type-parents.php'],
overwrite: true,
replacements: [
{
from: /(\*\s*Version:\s*).*\n/g,
to: '$1<%= newVersion %>\n'
}
]
}
},
makepot: {
target: {
options: {
domainPath: '/languages/', // Where to save the POT file.
potFilename: 'custom-post-type-parents.pot', // Name of the POT file.
type: 'wp-plugin' // Type of project (wp-plugin or wp-theme).
}
}
},
copy: {
svnAssets: {
cwd: 'assets/',
src: ['**'],
dest: 'svn/assets/',
expand: true,
},
svnTrunk: {
src: [
'**',
'!node_modules/**',
'!svn/**',
'!.git/**',
'!.sass-cache/**',
'!css/src/**',
'!js/src/**',
'!img/src/**',
'!assets/**',
'!design/**',
'!Gruntfile.js',
'!package.json',
'!.gitignore',
'!.gitmodules',
'!composer*',
'!vendor/autoload.php',
'!vendor/composer/**'
],
dest: 'svn/trunk/',
},
svnTags: {
cwd: 'svn/trunk/',
src: ['**'],
dest: 'svn/tags/<%= newVersion %>/',
expand: true,
}
}
} );
grunt.registerTask( 'build', [
'prompt',
'replace',
'makepot',
'copy'
] );
grunt.util.linefeed = '\n';
};