-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
98 lines (83 loc) · 2.77 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
/**
* Copyright by Vyatcheslav Suharnikov and sypexgeo-vyvid contributors
* See contributors list in AUTHORS
*
* See license text in LICENSE file
*/
'use strict';
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-shell');
var downloadBaseCommand = 'mkdir -p tests/runtime/;test -f tests/runtime/SxGeoCity.dat || (\
wget -nc http://sypexgeo.net/files/SxGeoCity_utf8.zip -O tests/runtime/SxGeoCity_utf8.zip\
&& unzip tests/runtime/SxGeoCity_utf8.zip -d tests/runtime/)';
var downloadPHPApiCommand = 'mkdir -p tests/runtime/php/;test -f tests/runtime/php/SxGeo.php || (\
wget -nc https://sypexgeo.net/files/SxGeo22_API.zip -O tests/runtime/php/SxGeo22_API.zip\
&& unzip tests/runtime/php/SxGeo22_API.zip -d tests/runtime/php/)';
grunt.initConfig({
pkg: '<json:package.json>',
cpplint: {
files: [
'src/xyz/vyvid/sypexgeo/bindings/nodejs/sypexgeo_node.cc',
'src/xyz/vyvid/sypexgeo/bindings/nodejs/sypexgeo_node.h',
'src/xyz/vyvid/sypexgeo/db.cc',
'src/xyz/vyvid/sypexgeo/db.h',
'src/xyz/vyvid/sypexgeo/errors.h',
'src/xyz/vyvid/sypexgeo/header.h',
'src/xyz/vyvid/sypexgeo/location.cc',
'src/xyz/vyvid/sypexgeo/location.h',
'src/xyz/vyvid/sypexgeo/raw_city_access.h',
'src/xyz/vyvid/sypexgeo/raw_country_access.h',
'src/xyz/vyvid/sypexgeo/raw_region_access.h',
'src/xyz/vyvid/sypexgeo/util/string_builder.h',
'src/xyz/vyvid/sypexgeo/util/uint24_t.h'
],
reporter: 'spec',
verbosity: 0,
filters: {
whitespace: {
braces: false,
include_alpha: true
},
readability: {
streams: false
}
},
linelength: 120,
// This could be an array of strings or a comma separated string
extensions: [
'cc',
'h'
]
},
shell: {
build: {
command: 'node-gyp build .',
stdout: true,
stderr: true
},
removebase: {
command: 'rm test/runtime/SxGeoCity.dat'
},
downloadbase: {
command: downloadBaseCommand,
stdout: true,
stderr: true
},
downloadphpapi: {
command: downloadPHPApiCommand,
stdout: true,
stderr: true
},
runtests: {
command: './node_modules/.bin/mocha --timeout 3000 --ui exports --reporter tap --check-leaks ./tests/sypexgeo_test.js'
}
}
});
grunt.loadNpmTasks('node-cpplint');
grunt.registerTask('chaihelper', 'Register chai helpers', function () {
global.expect = require('chai').expect;
});
grunt.registerTask('test', ['shell:downloadbase', 'shell:downloadphpapi', 'chaihelper', 'shell:runtests']);
// Default task.
grunt.registerTask('default', ['cpplint', 'shell:build', 'test']);
};