fixed update script for checking out new repo's, removed elasticsearch and k4d3 from bower deps

This commit is contained in:
Spencer Alger 2014-05-07 16:39:01 -07:00
parent 0cb7240e8c
commit 232d45d0a3
7 changed files with 39 additions and 36 deletions

View file

@ -1,6 +1,3 @@
{
"directory": "./src/bower_components",
"scripts": {
"postinstall": "grunt update"
}
"directory": "./src/bower_components"
}

View file

@ -20,9 +20,6 @@
"tests"
],
"dependencies": {
"elasticsearch": "git@github.com:elasticsearch/elasticsearch-js.git#master",
"K4D3": "git@github.com:elasticsearch/K4D3.git#master",
"requirejs": "~2.1.10",
"angular": "~1.2.14",
"lodash": "~2.4.1",

View file

@ -6,19 +6,20 @@
"main": "Gulpfile.js",
"dependencies": {},
"devDependencies": {
"lodash": "~2.4.1",
"expect.js": "~0.2.0",
"grunt": "~0.4.2",
"grunt-contrib-connect": "~0.6.0",
"grunt-contrib-jshint": "~0.8.0",
"grunt-mocha": "~0.4.10",
"load-grunt-config": "~0.7.0",
"mocha": "~1.17.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-jade": "~0.10.0",
"grunt-contrib-less": "~0.10.0",
"grunt-cli": "~0.1.13",
"istanbul": "~0.2.4"
"grunt-contrib-connect": "~0.6.0",
"grunt-contrib-jade": "~0.10.0",
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-less": "~0.10.0",
"grunt-contrib-requirejs": "~0.4.4",
"grunt-contrib-watch": "~0.5.3",
"grunt-mocha": "~0.4.10",
"istanbul": "~0.2.4",
"load-grunt-config": "~0.7.0",
"lodash": "~2.4.1",
"mocha": "~1.17.1"
},
"scripts": {
"test": "grunt test",

View file

@ -1,6 +1,6 @@
define(function (require) {
return function FieldTypesComponent(Private) {
return {
var fieldTypes = {
number: Private(require('./types/number')),
date: Private(require('./types/date')),
boolean: Private(require('./types/boolean')),
@ -10,5 +10,9 @@ define(function (require) {
geo_shape: Private(require('./types/geo_shape')),
string: Private(require('./types/string'))
};
window.kibanaFieldTypes = fieldTypes;
return fieldTypes;
};
});

View file

@ -47,7 +47,8 @@ require.config({
'angular-mocks': ['angular'],
'elasticsearch': ['angular'],
'angular-bootstrap': ['angular'],
'angular-bindonce': ['angular']
'angular-bindonce': ['angular'],
'k4d3': ['field_types/field_types']
},
waitSeconds: 60
});

View file

@ -3,6 +3,11 @@ var spawn = require('./spawn');
var grunt = require('grunt');
module.exports = function (repo, dir) {
// store the previous and new hash from the repo
// to know if there was an update from fetch
var prevHash;
var newHash;
return Promise.resolve()
.then(function () {
if (!grunt.file.isDir(dir + '/.git')) {
@ -10,27 +15,24 @@ module.exports = function (repo, dir) {
throw new Error(dir + ' needs to be removed so that we can replace it with a git-repo');
}
return spawn('git', ['clone', repo, dir])()
.then(function () {
return true;
});
return spawn('git', ['clone', repo, dir])();
} else {
var prevHash;
return spawn.silent('git', ['log', '-1', '--pretty=%H'], dir)()
.then(function (out) {
prevHash = out.trim();
})
.then(spawn('git', ['fetch', 'origin', 'master'], dir))
.then(spawn.silent('git', ['log', '-1', '--pretty=%H'], dir))
.then(function (out) {
var newHash = out.trim();
if (newHash !== prevHash) {
spawn('git', ['reset', '--hard', 'origin/master'], dir)()
.then(spawn('npm', ['install'], dir))
.then(function () {
return true;
});
}
.then(spawn('git', ['reset', '--hard', 'origin/master'], dir))
.then(spawn.silent('git', ['log', '-1', '--pretty=%H'], dir));
}
})
.then(function (out) {
if (prevHash) newHash = out.trim();
if (!prevHash || newHash !== prevHash) {
return spawn('npm', ['install'], dir)()
.then(spawn('bower', ['install'], dir))
.then(function () {
return true;
});
}
});

View file

@ -2,6 +2,7 @@ var Promise = require('bluebird');
var grunt = require('grunt');
var estream = require('event-stream');
var cp = require('child_process');
var path = require('path');
// create a function that will spawn another process based on the args when called
module.exports = function (cmd, args, cwd, silent) {
@ -13,8 +14,8 @@ module.exports = function (cmd, args, cwd, silent) {
};
var endsWithNlRE = /\n\r?$/;
if (!silent) grunt.log.writeln('$ ' + cmd + ' ' + args.join(' ') + (opts.cwd ? ' in ' + opts.cwd : ''));
var relDir = opts.cwd ? path.relative(process.cwd(), opts.cwd) + ' ' : '';
if (!silent) grunt.log.writeln(relDir + '$ ' + cmd + ' ' + args.join(' '));
var childProc = cp.spawn(cmd, args, opts);
// track when we are in a series of empty lines, and use this info to limit empty lines to one