Skip to content

Commit

Permalink
add travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Mar 11, 2016
1 parent f0aaff5 commit cd11af7
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
language: node_js
node_js: 4
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8

install:
- npm install
- npm run setup_kibana

cache:
directories:
- node_modules
- ../kibana

script: npm test
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,5 @@ module.exports = function (grunt) {

require('./tasks/build')(grunt);
require('./tasks/release')(grunt);
require('./tasks/setup_kibana')(grunt);
};
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"build": "grunt build",
"release": "grunt release",
"lint": "grunt eslint:source",
"setup_kibana": "grunt setup_kibana",
"test": "npm run test:server",
"test:server": "plugin-helpers test:server"
},
"devDependencies": {
Expand Down
28 changes: 28 additions & 0 deletions tasks/setup_kibana.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const exec = require('child_process').execFileSync;
const stat = require('fs').statSync;

const fromRoot = require('path').resolve.bind(null, __dirname, '../');

module.exports = function (grunt) {
grunt.registerTask('setup_kibana', function () {
const kbnDir = fromRoot('../kibana');
const kbnGitDir = fromRoot('../kibana/.git');

try {
if (stat(kbnGitDir).isDirectory()) {
exec('git', ['pull', 'origin', 'master'], { cwd: kbnDir });
} else {
throw new Error(`${kbnGitDir} is not a directory??`);
}
} catch (error) {
if (error.code === 'ENOENT') {
exec('git', ['clone', 'https://github.com/elastic/kibana.git', kbnDir]);
} else {
throw error;
}
}

exec('npm', ['prune'], { cwd: kbnDir });
exec('npm', ['install'], { cwd: kbnDir });
});
};

0 comments on commit cd11af7

Please sign in to comment.