This repository has been archived by the owner on Oct 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
136 lines (128 loc) · 2.78 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
128
129
130
131
132
133
134
135
136
module.exports = function (grunt) {
grunt.loadNpmTasks( 'grunt-contrib-compress' );
grunt.loadNpmTasks( 'grunt-contrib-clean' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-git' );
grunt.loadNpmTasks( 'grunt-text-replace' );
grunt.loadNpmTasks( 'grunt-svn-checkout' );
grunt.loadNpmTasks( 'grunt-push-svn' );
grunt.loadNpmTasks( 'grunt-remove' );
copy_files = [
'**',
'!node_modules/**',
'!release/**',
'!.git/**',
'!.sass-cache/**',
'!Gruntfile.js',
'!package.json',
'!.gitignore',
'!.gitmodules'
];
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
clean: {
post_build: [
'.build',
'release/<%= pkg.name %>',
'release/build/<%= pkg.version %>',
'release/build/'
]
},
copy: {
main: {
src: copy_files,
dest: 'release/build/<%= pkg.version %>/'
},
svn_trunk: {
options : {
mode :true
},
src: copy_files,
dest: 'release/<%= pkg.name %>/trunk/'
},
svn_tag: {
options : {
mode :true
},
src: copy_files,
dest: 'release/<%= pkg.name %>/tags/<%= pkg.version %>/'
}
},
compress: {
main: {
options: {
mode: 'zip',
archive: './release/<%= pkg.name %>-<%= pkg.version %>.zip'
},
expand: true,
cwd: 'release/build/<%= pkg.version %>/',
src: [ '**/*' ],
dest: '<%= pkg.name %>-<%= pkg.version %>/'
}
},
gittag: {
addtag: {
options: {
tag: '<%= pkg.version %>',
message: 'Version <%= pkg.version %>'
}
}
},
gitcommit: {
commit: {
options: {
message: 'Version <%= pkg.version %>',
noVerify: true,
noStatus: false,
allowEmpty: true
},
files: {
src: [ 'acknowledge-me.php', 'readme.txt', 'README.md', 'package.json' ]
}
}
},
gitpush: {
push: {
options: {
tags: true,
remote: 'origin',
branch: 'master'
}
}
},
replace: {
version: {
src: [ 'acknowledge-me.php', 'readme.txt', 'README.md' ],
overwrite: true,
replacements: [{
from: "<%= pkg.last_version %>",
to: "<%= pkg.version %>"
}]
}
},
svn_checkout: {
make_local: {
repos: [
{
path: [ 'release' ],
repo: 'http://plugins.svn.wordpress.org/acknowledge-me'
}
]
}
},
push_svn: {
options: {
remove: true,
},
main: {
src: 'release/<%= pkg.name %>',
dest: 'http://plugins.svn.wordpress.org/acknowledge-me',
tmp: './.build'
}
}
});
grunt.registerTask( 'pre_vcs', [ 'replace:version', 'copy:main', 'compress' ] );
grunt.registerTask( 'do_svn', [ 'svn_checkout', 'copy:svn_trunk', 'copy:svn_tag', 'push_svn' ] );
grunt.registerTask( 'do_git', [ 'gitcommit', 'gittag', 'gitpush' ] );
grunt.registerTask( 'release', [ 'pre_vcs', 'do_svn', 'do_git', 'clean:post_build' ] );
};