Skip to content

Commit cd11af7

Browse files
committed
add travis config
1 parent f0aaff5 commit cd11af7

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

.travis.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: node_js
2+
node_js: 4
3+
env:
4+
- CXX=g++-4.8
5+
addons:
6+
apt:
7+
sources:
8+
- ubuntu-toolchain-r-test
9+
packages:
10+
- g++-4.8
11+
12+
install:
13+
- npm install
14+
- npm run setup_kibana
15+
16+
cache:
17+
directories:
18+
- node_modules
19+
- ../kibana
20+
21+
script: npm test

Gruntfile.js

+1
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,5 @@ module.exports = function (grunt) {
126126

127127
require('./tasks/build')(grunt);
128128
require('./tasks/release')(grunt);
129+
require('./tasks/setup_kibana')(grunt);
129130
};

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"build": "grunt build",
1414
"release": "grunt release",
1515
"lint": "grunt eslint:source",
16+
"setup_kibana": "grunt setup_kibana",
17+
"test": "npm run test:server",
1618
"test:server": "plugin-helpers test:server"
1719
},
1820
"devDependencies": {

tasks/setup_kibana.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const exec = require('child_process').execFileSync;
2+
const stat = require('fs').statSync;
3+
4+
const fromRoot = require('path').resolve.bind(null, __dirname, '../');
5+
6+
module.exports = function (grunt) {
7+
grunt.registerTask('setup_kibana', function () {
8+
const kbnDir = fromRoot('../kibana');
9+
const kbnGitDir = fromRoot('../kibana/.git');
10+
11+
try {
12+
if (stat(kbnGitDir).isDirectory()) {
13+
exec('git', ['pull', 'origin', 'master'], { cwd: kbnDir });
14+
} else {
15+
throw new Error(`${kbnGitDir} is not a directory??`);
16+
}
17+
} catch (error) {
18+
if (error.code === 'ENOENT') {
19+
exec('git', ['clone', 'https://github.com/elastic/kibana.git', kbnDir]);
20+
} else {
21+
throw error;
22+
}
23+
}
24+
25+
exec('npm', ['prune'], { cwd: kbnDir });
26+
exec('npm', ['install'], { cwd: kbnDir });
27+
});
28+
};

0 commit comments

Comments
 (0)