forked from Zodiac1978/tl-normalizer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
141 lines (126 loc) · 5.22 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
module.exports = function( grunt ) { //The wrapper function
require( 'load-grunt-tasks' )( grunt );
var shell = require( 'shelljs' );
var wp_tests_dir = '/var/www/wordpress-develop/tests/phpunit';
// Project configuration & task configuration
grunt.initConfig( {
pkg: grunt.file.readJSON( 'package.json' ),
// The uglify task and its configurations
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
files: [ {
expand: true, // Enable dynamic expansion.
src: [ 'js/*.js', '!js/*.min.js' ], // Actual pattern(s) to match.
ext: '.min.js' // Dest filepaths will have this extension.
} ]
}
},
// The jshint task and its configurations
jshint: {
all: [ 'js/*.js', '!js/*.min.js' ]
},
wp_readme_to_markdown: {
convert:{
files: {
'README.md': 'readme.txt'
},
options: {
'screenshot_url': 'https://ps.w.org/unfc-normalize/assets/{screenshot}.png',
'post_convert': function ( readme ) {
return '[![Build Status](https://travis-ci.org/gitlost/unfc-normalize.png?branch=master)](https://travis-ci.org/gitlost/unfc-normalize)\n'
+ '[![codecov.io](http://codecov.io/github/gitlost/unfc-normalize/coverage.svg?branch=master)](http://codecov.io/github/gitlost/unfc-normalize?branch=master)\n'
+ '[![WordPress plugin](https://img.shields.io/wordpress/plugin/v/unfc-normalize.svg)](https://wordpress.org/plugins/unfc-normalize/)\n'
+ readme;
}
}
}
},
makepot: {
target: {
options: {
cwd: '', // Directory of files to internationalize.
domainPath: '/languages', // Where to save the POT file.
exclude: [ 'perf/', 'tests/' ], // List of files or directories to ignore.
include: [], // List of files or directories to include.
mainFile: 'unfc-normalize.php', // Main project file.
potComments: '', // The copyright at the beginning of the POT file.
potFilename: '', // Name of the POT file.
potHeaders: {
poedit: true, // Includes common Poedit headers.
'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
}, // Headers to add to the generated POT file.
processPot: null, // A callback function for manipulating the POT file.
type: 'wp-plugin', // Type of project (wp-plugin or wp-theme).
updateTimestamp: false, // Whether the POT-Creation-Date should be updated without other changes.
updatePoFiles: false // Whether to update PO files in the same directory as the POT file.
}
}
},
po2mo: {
files: {
src: 'languages/*.po',
expand: true,
},
},
compress: {
main: {
options: {
archive: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip',
mode: 'zip'
},
files: [
{
src: [
'../unfc-normalize/readme.txt',
'../unfc-normalize/unfc-normalize.php',
'../unfc-normalize/includes/class-unfc-db_check-list-table.php',
'../unfc-normalize/includes/class-unfc-list-table.php',
'../unfc-normalize/includes/class-unfc-normalize.php',
'../unfc-normalize/includes/class-unfc-normalize-command.php',
'../unfc-normalize/includes/debug.php',
'../unfc-normalize/js/ie8.js',
'../unfc-normalize/js/ie8.min.js',
'../unfc-normalize/js/unfc-normalize.js',
'../unfc-normalize/js/unfc-normalize.min.js',
'../unfc-normalize/languages/unfc-normalize-fr_FR.mo',
'../unfc-normalize/languages/unfc-normalize-fr_FR.po',
'../unfc-normalize/languages/unfc-normalize.pot',
'../unfc-normalize/rangyinputs/rangyinputs-jquery.js',
'../unfc-normalize/rangyinputs/rangyinputs-jquery-src.js',
'../unfc-normalize/rangyinputs/README.md',
'../unfc-normalize/Symfony/LICENSE',
'../unfc-normalize/Symfony/BaseNormalizer.php',
'../unfc-normalize/Symfony/Normalizer.php',
'../unfc-normalize/Symfony/unfc_regex_alts.php',
'../unfc-normalize/Symfony/Resources/unidata/canonicalComposition.php',
'../unfc-normalize/Symfony/Resources/unidata/canonicalDecomposition.php',
'../unfc-normalize/Symfony/Resources/unidata/combiningClass.php',
'../unfc-normalize/Symfony/Resources/unidata/compatibilityDecomposition.php',
'../unfc-normalize/Symfony/Resources/unidata/kcCaseFolding.php',
'../unfc-normalize/Symfony/Resources/unidata/rawDecomposition.php',
'../unfc-normalize/unorm/LICENSE.md',
'../unfc-normalize/unorm/lib/unorm.js'
]
}
]
}
},
qunit: {
all: [ 'tests/qunit/index.html' ]
},
clean: {
js: [ 'js/*.min.js' ]
}
} );
// Default task(s), executed when you run 'grunt'
grunt.registerTask( 'default', [ 'uglify', 'wp_readme_to_markdown', 'makepot', 'compress' ] );
// Creating a custom task
grunt.registerTask( 'phpunit', function () {
shell.exec( 'PHPRC=. WP_TESTS_DIR=' + ( process.env.WP_TESTS_DIR || wp_tests_dir ) + ' phpunit' );
} );
grunt.registerTask( 'test', [ 'jshint', 'phpunit', 'qunit' ] );
grunt.registerTask( 'test_qunit', [ 'jshint', 'qunit' ] );
};