forked from cceh/capitularia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
162 lines (144 loc) · 6.23 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
module.exports = function (grunt) {
var php_files = ['themes/**/*.php', 'plugins/**/*.php'];
var afs = grunt.option ('afs') || process.env.GRUNT_CAPITULARIA_AFS || "/afs/rrz/vol/www/projekt/capitularia";
var localfs = grunt.option ('localfs') || process.env.GRUNT_CAPITULARIA_LOCALFS ||
"/var/www/capitularia";
var git_user = grunt.option ('gituser') || process.env.GRUNT_CAPITULARIA_GITUSER;
var browser = grunt.option ('browser') || process.env.GRUNT_BROWSER || "iceweasel";
grunt.initConfig ({
afs: afs,
localfs: localfs,
browser: browser,
rsync: "rsync -rlptz --exclude='*~' --exclude='.*' --exclude='*.less' --exclude='node_modules'",
wpcontent: afs + "/http/docs/wp-content",
wpcontentlocal: localfs + "/wp-content",
gituser: git_user,
pkg: grunt.file.readJSON ('package.json'),
less: {
options: {
banner: "/* Generated file. Do not edit. */\n",
plugins: [
new (require ('less-plugin-autoprefix')) ({ browsers: ["last 2 versions"] })
]
},
production: {
files: [
{
expand: true,
src: ['themes/Capitularia/css/*.less', 'plugins/**/*.less'],
ext: '.css',
extDot: 'last'
}
]
}
},
jshint: {
options: {
globals: {
jQuery: true
}
},
files: ['Gruntfile.js', 'themes/Capitularia/js/*.js', 'plugins/**/*.js']
},
phplint: {
themes: ['themes/**/*.php'],
plugins: ['plugins/**/*.php']
},
csslint: {
options: {
"adjoining-classes": false, // concerns IE6
"box-sizing": false, // concerns IE6,7
"ids": false,
"overqualified-elements": false,
"qualified-headings": false,
},
src: ['themes/Capitularia/css/*.css', 'plugins/**/*.css']
},
pot: {
options: {
text_domain: "capitularia",
encoding: "utf-8",
dest: 'themes/Capitularia/languages/',
keywords: ['__', '_e', '_n:1,2', '_x:1,2c'],
msgmerge: true,
},
files: {
src: php_files,
expand: true,
}
},
potomo: {
themes: {
options: {
poDel: false
},
files: [{
expand: true,
src: ['themes/Capitularia/languages/*.po'],
dest: './',
ext: '.mo',
nonull: true,
}]
}
},
shell: {
options: {
cwd: ".",
failOnError: false,
},
deploy: {
command: '<%= rsync %> themes/Capitularia/* <%= wpcontent %>/themes/Capitularia/ ; <%= rsync %> plugins/cap-* <%= wpcontent %>/plugins/',
},
testdeploy: {
command: '<%= rsync %> themes/Capitularia/* <%= wpcontentlocal %>/themes/Capitularia/ ; <%= rsync %> plugins/cap-* <%= wpcontentlocal %>/plugins/',
},
phpcs: {
/* PHP_CodeSniffer https://github.com/squizlabs/PHP_CodeSniffer */
command: 'vendor/bin/phpcs --standard=tools/phpcs --report=emacs -s --extensions=php themes plugins',
},
phpdoc: {
/* phpDocumentor http://www.phpdoc.org/ */
command: 'vendor/bin/phpdoc run --directory="themes,plugins" --target="tools/reports/phpdoc" --template="responsive-twig" --title="Capitularia" && <%= browser %> tools/reports/phpdoc/index.html',
},
phpmd: {
/* PHP Mess Detector http://phpmd.org/ */
command: 'vendor/bin/phpmd "themes,plugins" html tools/phpmd/ruleset.xml --reportfile "tools/reports/phpmd/index.html" ; <%= browser %> tools/reports/phpmd/index.html',
},
phpmetrics: {
/* PhpMetrics http://www.phpmetrics.org/ */
command: 'vendor/bin/phpmetrics --config="tools/phpmetrics/config.yml" . && <%= browser %> tools/reports/phpmetrics/index.html',
},
sami: {
/* Sami Documentation Generator https://github.com/FriendsOfPHP/Sami */
command: 'vendor/bin/sami.php update tools/sami/config.php && <%= browser %> tools/reports/sami/build/index.html',
},
'git-fetch-collation': {
command: 'git clone https://<%= gituser %>@github.com/cceh/capitularia-collation.git <%= afs %>/local/capitularia-collation',
},
},
watch: {
files: ['<%= less.production.files %>'],
tasks: ['less']
}
});
grunt.loadNpmTasks ('grunt-contrib-csslint');
grunt.loadNpmTasks ('grunt-contrib-jshint');
grunt.loadNpmTasks ('grunt-contrib-less');
grunt.loadNpmTasks ('grunt-contrib-watch');
grunt.loadNpmTasks ('grunt-phplint');
grunt.loadNpmTasks ('grunt-pot');
grunt.loadNpmTasks ('grunt-potomo');
grunt.loadNpmTasks ('grunt-shell');
grunt.registerTask ('phpcs', ['shell:phpcs']);
grunt.registerTask ('phpdoc', ['shell:phpdoc']);
grunt.registerTask ('phpmd', ['shell:phpmd']);
grunt.registerTask ('phpmetrics', ['shell:phpmetrics']);
grunt.registerTask ('sami', ['shell:sami']);
grunt.registerTask ('git', ['shell:git-fetch-collation']);
grunt.registerTask ('lint', ['phplint', 'jshint']);
grunt.registerTask ('mo', ['pot', 'potomo']);
grunt.registerTask ('doc', ['phpdoc', 'phpmd', 'phpmetrics', 'sami']);
grunt.registerTask ('testdeploy', ['lint', 'less', 'mo', 'shell:testdeploy']);
grunt.registerTask ('deploy', ['lint', 'less', 'mo', 'shell:deploy']);
grunt.registerTask ('default', ['lint', 'less']);
};