mirror of
https://github.com/elastic/kibana.git
synced 2025-04-20 07:48:52 -04:00
28 lines
840 B
JavaScript
28 lines
840 B
JavaScript
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 });
|
|
});
|
|
};
|