remove bower, nice people matter

This commit is contained in:
spalger 2015-07-27 17:13:45 -07:00
parent f9f4b0e2c6
commit cfc398b37d
34 changed files with 123 additions and 944 deletions

1
.gitignore vendored
View file

@ -2,7 +2,6 @@
.DS_Store
.node_binaries
node_modules
bower_components
trash
bundles
target

View file

@ -1,5 +1,5 @@
{
"esprima": "./node_modules/babel-jscs",
"esnext": true,
"maximumLineLength": {
"value": 140,
"allowComments": true

View file

@ -6,7 +6,6 @@ sudo: false
cache:
directories:
- esvm
- bower_components
- node_modules
before_cache:
- rm -rf esvm/*/logs esvm/data_dir

View file

@ -17,12 +17,6 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
nvm install 0.10
```
- Install grunt and bower globally (as root if not using nvm)
```sh
npm install -g grunt-cli bower
```
- Clone the kibana repo and move into it
```sh
@ -30,16 +24,16 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
cd kibana
```
- Install node and bower dependencies
- Install dependencies
```sh
npm install && bower install
npm install
```
- Start the development server.
```sh
grunt dev # use the "--with-es" flag to install & start elasticsearch too
./node_modules/.bin/grunt dev # use the "--with-es" flag to install & start elasticsearch too
```
#### Linting
@ -65,7 +59,7 @@ Before running the tests you will need to install the projects dependencies as d
Once that is complete just run:
```sh
grunt test build
./node_modules/.bin/grunt test build
```
Distributable, built packages can be found in `target/` after the build completes.

View file

@ -17,8 +17,6 @@ module.exports = function (grunt) {
platforms: ['darwin-x64', 'linux-x64', 'linux-x86', 'windows'],
services: [ [ 'launchd', '10.9'], [ 'upstart', '1.5'], [ 'systemd', 'default'], [ 'sysv', 'lsb-3.1' ] ],
bowerComponentsDir: __dirname + '/bower_components',
devPlugins: 'devMode',
meta: {

View file

@ -1,36 +0,0 @@
{
"name": "kibana",
"authors": [
"Spencer Alger <spencer@spenceralger.com>"
],
"description": "Browser based analytics and search interface to Logstash and other timestamped data sets stored in ElasticSearch",
"main": "src/index.html",
"keywords": [
"kibana",
"elasticsearch"
],
"license": "Apache 2.0",
"homepage": "http://www.elastic.co/products/kibana",
"dependencies": {
"angular-bindonce": "0.3.3",
"angular-bootstrap": "0.10.0",
"angular-elastic": "2.4.2",
"angular-mocks": "1.2.28",
"angular-route": "1.2.28",
"angular-ui-ace": "0.2.3",
"bluebird": "~2.9.27",
"d3": "3.5.5",
"elasticsearch": "~5.0.0",
"gridster": "0.5.6",
"jquery": "2.1.4",
"leaflet": "0.7.3",
"Leaflet.heat": "Leaflet/Leaflet.heat#627ede7c11bbe43",
"lodash": "3.9.3",
"moment": "2.10.3",
"moment-timezone": "0.4.0",
"ng-clip": "0.2.6",
"marked": "0.3.3",
"numeral": "1.5.3",
"leaflet-draw": "0.2.4"
}
}

View file

@ -31,7 +31,6 @@
"scripts": {
"test": "grunt test",
"start": "node ./src/server/cli/index.js --dev",
"postinstall": "bower install && grunt licenses --check-validity",
"precommit": "grunt lintStagedFiles"
},
"repository": {
@ -39,59 +38,63 @@
"url": "https://github.com/elastic/kibana.git"
},
"dependencies": {
"@spalger/filesaver": "^1.1.0",
"@spalger/angular-bootstrap": "^0.10.0",
"@spalger/filesaver": "^1.1.2",
"@spalger/leaflet-draw": "^0.2.3",
"@spalger/leaflet-heat": "^0.1.3",
"@spalger/ui-ace": "^0.2.3",
"Nonsense": "^0.1.2",
"angular": "1.2.28",
"angular-bindonce": "0.3.1",
"angular-elastic": "2.5.0",
"angular-mocks": "1.2.28",
"angular-nvd3": "panda01/angular-nvd3#kibana",
"angular-route": "1.2.28",
"ansicolors": "^0.3.2",
"auto-preload-rjscommon-deps-loader": "^1.0.3",
"autoprefixer": "^5.2.0",
"autoprefixer-loader": "^2.0.0",
"babel-jscs": "^1.0.3",
"base64-js": "0.0.8",
"bluebird": "^2.9.27",
"body-parser": "^1.10.1",
"boom": "^2.8.0",
"bootstrap": "^3.3.5",
"brace": "^0.5.1",
"bunyan": "^1.2.3",
"chokidar": "^1.0.4",
"commander": "^2.8.1",
"compression": "^1.3.0",
"cookie-parser": "^1.3.3",
"css-loader": "^0.15.1",
"d3": "^3.5.6",
"debug": "^2.1.1",
"elasticsearch": "^5.0.0",
"elasticsearch-browser": "^5.0.0",
"expiry-js": "^0.1.7",
"exports-loader": "^0.6.2",
"expose-loader": "^0.7.0",
"express": "^4.10.6",
"extract-text-webpack-plugin": "^0.8.2",
"file-loader": "^0.8.4",
"font-awesome": "^4.3.0",
"glob": "^4.3.2",
"good": "^6.2.0",
"good-squeeze": "^2.1.0",
"gridster": "^0.5.6",
"hapi": "^8.6.1",
"ieee754": "^1.1.6",
"imports-loader": "^0.6.4",
"is-array": "^1.0.1",
"jade": "^1.8.2",
"jade": "^1.7.2",
"jade-loader": "^0.7.1",
"joi": "^6.4.3",
"jquery": "^2.1.4",
"js-yaml": "^3.2.5",
"json-stringify-safe": "^5.0.1",
"leaflet": "^0.7.3",
"less": "^2.5.1",
"less-loader": "^2.2.0",
"loader-utils": "^0.2.10",
"lodash": "^3.10.0",
"marked": "^0.3.3",
"memory-fs": "^0.2.0",
"minimatch": "^2.0.8",
"mkdirp": "^0.5.1",
"moment": "^2.10.3",
"node-libs-browser": "spalger/node-libs-browser",
"moment-timezone": "^0.4.0",
"ng-clip": "^0.2.6",
"numeral": "^1.5.3",
"nvd3": "panda01/nvd3#kibana",
"raw-loader": "^0.5.1",
@ -100,19 +103,14 @@
"rimraf": "^2.4.1",
"script-loader": "^0.6.1",
"semver": "^4.3.6",
"serve-favicon": "^2.2.0",
"style-loader": "^0.12.3",
"tempfile": "^1.1.1",
"through": "^2.3.6",
"url-loader": "^0.5.6",
"webpack": "^1.10.0",
"webpack-directory-name-as-main": "^1.0.0"
"webpack-directory-name-as-main": "^1.0.0",
"zeroclipboard": "^2.2.0"
},
"devDependencies": {
"auto-release-sinon": "^1.0.2",
"bower": "^1.4.1",
"bower-license": "^0.2.6",
"event-stream": "^3.1.5",
"expect.js": "^0.3.1",
"faker": "^1.1.0",
"grunt": "^0.4.5",
@ -121,11 +119,9 @@
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-jshint": "^0.11",
"grunt-contrib-watch": "^0.6.1",
"grunt-esvm": "^1.0.1",
"grunt-jscs": "^1.8.0",
"grunt-karma": "^0.12.0",
"grunt-mocha": "^0.4.10",
"grunt-replace": "^0.7.9",
"grunt-run": "^0.3.0",
"grunt-s3": "^0.2.0-alpha.3",
@ -133,7 +129,6 @@
"html-entities": "^1.1.1",
"http-proxy": "^1.8.1",
"husky": "^0.8.1",
"istanbul": "^0.3.15",
"karma": "^0.13.3",
"karma-chrome-launcher": "^0.2.0",
"karma-growl-reporter": "^0.1.1",
@ -142,17 +137,11 @@
"libesvm": "^1.0.1",
"license-checker": "^3.1.0",
"load-grunt-config": "^0.7.0",
"lolex": "^1.2.2",
"marked": "^0.3.3",
"marked-text-renderer": "^0.1.0",
"mocha": "^2.2.5",
"mocha-loader": "^0.7.1",
"nock": "^2.7.0",
"npm": "^2.11.0",
"opn": "^1.0.0",
"path-browserify": "0.0.0",
"portscanner": "^1.0.0",
"progress": "^1.1.8",
"simple-git": "^1.3.0",
"sinon": "^1.15.4",
"source-map": "^0.4.4",

View file

@ -71,7 +71,7 @@ class BaseOptimizer extends EventEmitter {
{ test: /\.jade$/, loader: 'jade' },
{ test: /\.(html|tmpl)$/, loader: 'raw' },
{ test: /\.png$/, loader: 'url?limit=10000&name=[path][name].[ext]' },
{ test: /\.(woff|woff2|ttf|eot|svg)(\?|$)/, loader: 'file?name=[path][name].[ext]' },
{ test: /\.(woff|woff2|ttf|eot|svg|ico)(\?|$)/, loader: 'file?name=[path][name].[ext]' },
{ test: /\/src\/(plugins|ui)\/.+\.js$/, loader: `auto-preload-rjscommon-deps${mapQ}` }
].concat(this.modules.loaders),
noParse: this.modules.noParse,

View file

@ -22,7 +22,7 @@ class WatchingOptimizer extends BaseOptimizer {
}
init(autoEnable) {
return this.bundles.synchronize().then(autoEnable ? this.enable : this.setupCompiler);
return this.bundles.ensureDir().then(autoEnable ? this.enable : this.setupCompiler);
}
setupCompiler(autoEnable) {

View file

@ -1,7 +1,9 @@
require('plugins/appSwitcher/appSwitcher.less');
var kibanaLogoUrl = require('ui/images/kibana.png');
require('ui/chrome')
.setLogo('url(/ui/images/kibana.png) left no-repeat', true)
.setLogo('url(' + kibanaLogoUrl + ') left no-repeat', true)
.setShowAppsLink(false)
.setTabs([
{

View file

@ -15,21 +15,12 @@ module.exports = function (kibana) {
modules[name] = resolve(metaLibs, file);
});
var bowerComponentsDir = fromRoot('bower_components');
return new kibana.Plugin({
init: false,
uiExports: {
modules: modules,
noParse: [
/node_modules\/angular\//,
{
test: function (request) {
return _.endsWith(request, '.js')
&& _.includes(request, bowerComponentsDir)
&& !_.includes(request, 'bower_components/gridster');
}
}
/node_modules\/(angular|elasticsearch-browser|mocha)\//
]
}
});

View file

@ -1,6 +1,6 @@
require('brace');
require('brace/mode/json');
require('bower_components/angular-ui-ace/ui-ace');
require('node_modules/@spalger/ui-ace/ui-ace');
require('ui/modules').get('kibana', ['ui.ace']);

View file

@ -2,8 +2,8 @@ require('jquery');
require('node_modules/angular/angular');
module.exports = window.angular;
require('bower_components/angular-bindonce/bindonce');
require('bower_components/angular-elastic/elastic');
require('bower_components/angular-route/angular-route');
require('node_modules/angular-bindonce/bindonce');
require('node_modules/angular-elastic/elastic');
require('node_modules/angular-route/angular-route');
require('ui/modules').get('kibana', ['ngRoute', 'monospaced.elastic', 'pasvaz.bindonce']);

View file

@ -1,3 +1,3 @@
require('angular');
module.exports = require('bower_components/elasticsearch/elasticsearch.angular.min');
module.exports = require('node_modules/elasticsearch/elasticsearch.angular.min');
require('ui/modules').get('kibana', ['elasticsearch']);

View file

@ -1,3 +1,3 @@
require('jquery');
require('bower_components/gridster/dist/jquery.gridster.css');
require('script!bower_components/gridster/dist/jquery.gridster');
require('node_modules/gridster/dist/jquery.gridster.css');
require('script!node_modules/gridster/dist/jquery.gridster');

View file

@ -1 +1 @@
window.jQuery = window.$ = module.exports = require('bower_components/jquery/dist/jquery');
window.jQuery = window.$ = module.exports = require('node_modules/jquery/dist/jquery');

View file

@ -1,6 +1,7 @@
require('bower_components/leaflet-draw/dist/leaflet.draw.css');
require('bower_components/leaflet/dist/leaflet.css');
require('node_modules/leaflet/dist/leaflet.css');
window.L = module.exports = require('node_modules/leaflet/dist/leaflet');
window.L = module.exports = require('bower_components/leaflet/dist/leaflet');
require('bower_components/Leaflet.heat/dist/leaflet-heat');
require('bower_components/leaflet-draw/dist/leaflet.draw');
require('node_modules/@spalger/leaflet-heat/dist/leaflet-heat.js');
require('node_modules/@spalger/leaflet-draw/dist/leaflet.draw.css');
require('node_modules/@spalger/leaflet-draw/dist/leaflet.draw.js');

View file

@ -5,7 +5,7 @@
* var _ = require('lodash');
*/
var _ = require('bower_components/lodash/lodash').runInContext();
var _ = require('node_modules/lodash/index.js').runInContext();
require('ui/utils/lodash-mixins/string')(_);
require('ui/utils/lodash-mixins/lang')(_);
require('ui/utils/lodash-mixins/object')(_);

View file

@ -1 +0,0 @@
module.exports = require('bower_components/moment/moment');

View file

@ -1,10 +1,10 @@
require('angular');
// ng-clip expects ZeroClipboard to be global, but it's UMD, so it never is
window.ZeroClipboard = require('bower_components/zeroclipboard/dist/ZeroClipboard.js');
window.ZeroClipboard.SWF_URL = require('file!bower_components/zeroclipboard/dist/ZeroClipboard.swf');
window.ZeroClipboard = require('node_modules/zeroclipboard/dist/ZeroClipboard.js');
window.ZeroClipboard.SWF_URL = require('file!node_modules/zeroclipboard/dist/ZeroClipboard.swf');
require('bower_components/ng-clip/src/ngClip');
require('node_modules/ng-clip/src/ngClip');
require('ui/modules').get('kibana', ['ngClipboard']);
module.exports = window.ZeroClipboard;

View file

@ -1,6 +1,6 @@
define(function (require) {
require('angular');
require('bower_components/angular-bootstrap/ui-bootstrap-tpls');
require('node_modules/@spalger/angular-bootstrap/ui-bootstrap-tpls');
return require('ui/modules')
.get('kibana', ['ui.bootstrap'])

View file

@ -1,49 +1,48 @@
define(function (require) {
require('plugins/kibana/discover/index');
require('plugins/kibana/visualize/index');
require('plugins/kibana/dashboard/index');
require('plugins/kibana/settings/index');
require('plugins/kibana/doc/index');
require('plugins/kibana/discover/index');
require('plugins/kibana/visualize/index');
require('plugins/kibana/dashboard/index');
require('plugins/kibana/settings/index');
require('plugins/kibana/doc/index');
require('ui/routes')
.otherwise({
redirectTo: '/discover'
});
require('ui/chrome')
.setLogo('url(/ui/images/kibana.png) left no-repeat', true)
.setNavBackground('#222222')
.setTabDefaults({
resetWhenActive: true,
trackLastPath: true,
activeIndicatorColor: '#656a76'
})
.setTabs([
{
id: 'discover',
title: 'Discover'
},
{
id: 'visualize',
title: 'Visualize',
activeIndicatorColor: function () {
return (String(this.lastUrl).indexOf('/visualize/step/') === 0) ? 'white' : '#656a76';
}
},
{
id: 'dashboard',
title: 'Dashboard'
},
{
id: 'settings',
title: 'Settings'
}
])
.setRootController('kibana', function ($scope, courier) {
// wait for the application to finish loading
$scope.$on('application.load', function () {
courier.start();
});
});
var kibanaLogoUrl = require('ui/images/kibana.png');
require('ui/routes')
.otherwise({
redirectTo: '/discover'
});
require('ui/chrome')
.setLogo('url(' + kibanaLogoUrl + ') left no-repeat', true)
.setNavBackground('#222222')
.setTabDefaults({
resetWhenActive: true,
trackLastPath: true,
activeIndicatorColor: '#656a76'
})
.setTabs([
{
id: 'discover',
title: 'Discover'
},
{
id: 'visualize',
title: 'Visualize',
activeIndicatorColor: function () {
return (String(this.lastUrl).indexOf('/visualize/step/') === 0) ? 'white' : '#656a76';
}
},
{
id: 'dashboard',
title: 'Dashboard'
},
{
id: 'settings',
title: 'Settings'
}
])
.setRootController('kibana', function ($scope, courier) {
// wait for the application to finish loading
$scope.$on('application.load', function () {
courier.start();
});
});

File diff suppressed because one or more lines are too long

View file

@ -1,238 +0,0 @@
// fake process obejct to make browserify-path happy
window.process = window.process || { cwd: function () { return '.'; }};
var _ = require('lodash');
var $ = require('jquery');
var InsertionText = require('istanbul/lib/util/insertion-text.js');
var objUtils = require('istanbul/lib/object-utils.js');
// var annotate = require('istanbul/lib/annotate.js');
var Progress = require('mocha/lib/browser/progress.js');
var path = require('path-browserify/index.js');
var template = require('./report.jade');
var Base = window.Mocha.reporters.Base;
var covGrepQueryParamRE = /cov_grep=([^&]+)/;
var afterDraw = window.requestAnimationFrame || function (cb) { setTimeout(cb, 500); };
function IstanbulReporter(runner) {
// "inherit" the base reporters characteristics
Base.call(this, runner);
var stats = this.stats;
var gotoFile = window.location.hash;
if (gotoFile) window.location.hash = '';
$(document.body)
.html('<center><canvas width="40" height="40"></canvas></center>');
var canvas = document.getElementsByTagName('canvas')[0];
var ctx;
var progress;
if (canvas.getContext) {
var ratio = window.devicePixelRatio || 1;
canvas.style.width = canvas.width;
canvas.style.height = canvas.height;
canvas.width *= ratio;
canvas.height *= ratio;
ctx = canvas.getContext('2d');
ctx.scale(ratio, ratio);
progress = new Progress();
progress.size(40);
}
runner.on('test end', function () {
if (progress) {
progress
.update((stats.tests / this.total) * 100 || 0)
.draw(ctx);
}
});
runner.on('end', function () {
var stats = _.omit(this.stats, 'start', 'end', 'suites');
stats['create report'] = Date.now();
$(document.body).empty().append($(createReport())); // attempt to force parsing immediately
stats['create report'] = Date.now() - stats['create report'];
toSec(stats, 'create report');
toSec(stats, 'duration');
console.log(JSON.stringify(stats, null, ' '));
linkNav();
if (gotoFile) {
afterDraw(function () {
window.location.hash = gotoFile;
});
}
});
}
function createReport() {
var covResults = window.__coverage__;
var grep = window.location.search.match(covGrepQueryParamRE);
if (grep) {
grep = decodeURIComponent(grep[1]);
covResults = _.transform(covResults, function (results, cov, filename) {
if (~filename.indexOf(grep)) {
results[filename] = cov;
}
});
}
var summary = objUtils.summarizeCoverage(covResults);
var dirs = _(covResults)
.map(convertFile)
.groupBy(function (file) {
var dir = path.dirname(file.filename);
return dir === '.' ? '' : dir;
})
.transform(function (dirs, files, dirname) {
_.each(files, function (file) {
file.relname = dirname ? path.relative(dirname, file.filename) : file.filename;
});
dirs.push({
name: dirname,
files: files,
coverage: _.reduce(files, function (sum, file) {
return sum + file.coverage;
}, 0) / files.length
});
}, [])
.sortBy('name')
.value();
return template({
cov: {
dirs: dirs,
coverage: summary.lines.pct,
sloc: summary.lines.total,
hits: summary.lines.covered,
misses: summary.lines.total - summary.lines.covered
},
dirname: path.dirname,
relative: path.relative,
coverageClass: function (coverage) {
if (coverage >= 75) return 'high';
if (coverage >= 50) return 'medium';
if (coverage >= 25) return 'low';
return 'terrible';
}
});
}
function convertFile(file) {
var summary = objUtils.summarizeFileCoverage(file);
var count = 0;
var structured = file.code.map(function (str) {
count += 1;
return {
line: count,
covered: null,
text: new InsertionText(str, true)
};
});
var html = '';
structured.unshift({
line: 0,
covered: null,
text: new InsertionText('')
});
_.forOwn(file.l, function (count, lineNumber) {
structured[lineNumber].covered = count > 0 ? true : false;
});
// annotate.Lines(file, structured);
//note: order is important, since statements typically result in spanning the whole line and doing branches late
//causes mismatched tags
// annotate.Branches(file, structured);
// annotate.Functions(file, structured);
// annotate.Statements(file, structured);
structured.shift();
var context = {
filename: file.path,
sloc: summary.lines.total,
coverage: summary.lines.pct,
hits: summary.lines.covered,
misses: summary.lines.total - summary.lines.covered,
source: _.map(structured, function (line, lineNumber) {
return {
coverage: file.l[line.line],
source: line.text + ''
};
})
};
return context;
// writer.write(detailTemplate(context));
// writer.write('</table></pre>\n');
// writer.write(footerTemplate(templateData));
}
function linkNav() {
var headings = $('h2').toArray();
// when scrolling, highlight the related menu item
$(window).scroll(function (e) {
var heading = find(window.scrollY);
if (!heading) return;
var links = document.querySelectorAll('#menu a');
var link;
for (var i = 0, len = links.length; i < len; ++i) {
link = links[i];
link.className = link.getAttribute('href') === '#' + heading.id
? 'active'
: '';
}
});
// find the file they are probably looking at
function find(y) {
var i = headings.length;
var heading;
while (i--) {
heading = headings[i];
if (y >= heading.offsetTop) {
return heading;
}
}
}
$('#menu').on('click', '.dirname .cov', function () {
var dir = $(this).parent()[0].childNodes[0].textContent;
var loc = window.location;
var proto = loc.protocol;
var host = loc.host;
var path = loc.pathname;
var search = loc.search;
var hash = loc.hash;
var grep = 'cov_grep=' + encodeURIComponent(dir);
if (search && search.match(covGrepQueryParamRE)) {
search = search.replace(covGrepQueryParamRE, grep);
} else {
search = (search ? search + '&' : '?') + grep;
}
window.location = path + search + hash;
});
}
function toSec(stats, prop) {
return stats[prop] = (stats[prop] / 1000).toFixed(2) + ' sec';
}
module.exports = IstanbulReporter;

View file

@ -73,7 +73,7 @@ module.exports = function (kbnServer, server, config) {
let payload = {
app: app,
appCount: kbnServer.uiExports.apps.length,
appCount: apps.length,
version: kbnServer.version,
buildSha: _.get(kbnServer, 'build.sha', '@@buildSha'),
buildNumber: _.get(kbnServer, 'build.number', '@@buildNum'),

View file

@ -25,6 +25,11 @@ var internals = _.assign(
}
);
$('<link>').attr({
href: require('ui/images/elk.ico'),
rel: 'shortcut icon'
}).appendTo('head');
require('./api/apps')(chrome, internals);
require('./api/angular')(chrome, internals);
require('./api/tabs')(chrome, internals);

View file

@ -1,5 +1,5 @@
define(function (require) {
require('elasticsearch');
require('elasticsearch-browser/elasticsearch.angular.js');
var _ = require('lodash');
var es; // share the client amoungst all apps

View file

@ -9,7 +9,6 @@ html(lang='en')
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1')
meta(name='viewport', content='width=device-width')
link(rel='shortcut icon', href='/ui/images/elk.ico')
title Kibana
block head
body(kbn-chrome, id='#{appName}-body')

View file

@ -1,16 +1,7 @@
module.exports = function (grunt) {
var Promise = require('bluebird');
var spawn = require('./utils/spawn');
var exec = require('child_process').execSync;
grunt.registerTask('get_build_props', function () {
Promise.props({
sha: spawn.silent('git', ['rev-parse', 'HEAD'])(),
num: spawn.silent('sh', ['-c', 'git log --format="%h" | wc -l'])()
})
.then(function (props) {
grunt.config.set('commitSha', props.sha.trim());
grunt.config.set('buildNum', props.num.trim());
})
.nodeify(this.async());
grunt.config.set('commitSha', String(exec('git rev-parse HEAD')).trim());
grunt.config.set('buildNum', String(exec('git log --format="%h" | wc -l')).trim());
});
};

View file

@ -1,6 +1,5 @@
var _ = require('lodash');
var npm = require('npm');
var bowerLicense = require('bower-license');
var npmLicense = require('license-checker');
module.exports = function (grunt) {
@ -28,32 +27,6 @@ module.exports = function (grunt) {
return pkgInfo;
}
function dequeue(output) {
checkQueueLength--;
_.extend(result, output);
if (!checkQueueLength) {
var licenseStats = _.map(result, processPackage);
var invalidLicenses = _.filter(licenseStats, function (pkg) { return !pkg.valid;});
if (!grunt.option('only-invalid')) {
grunt.log.debug(JSON.stringify(licenseStats, null, 2));
}
if (invalidLicenses.length) {
grunt.log.debug(JSON.stringify(invalidLicenses, null, 2));
grunt.fail.warn(
'Non-confirming licenses: ' + _.pluck(invalidLicenses, 'name').join(', '),
invalidLicenses.length
);
}
done();
}
}
bowerLicense.init(options, dequeue);
npmLicense.init(options, function (allDependencies) {
// Only check production NPM dependencies, not dev
npm.load({production: true}, function () {
@ -75,8 +48,24 @@ module.exports = function (grunt) {
_.each(getDependencies(npmList.dependencies), function (packageAndVersion) {
productionDependencies[packageAndVersion] = allDependencies[packageAndVersion];
});
dequeue(productionDependencies);
var licenseStats = _.map(productionDependencies, processPackage);
var invalidLicenses = _.filter(licenseStats, function (pkg) { return !pkg.valid;});
if (!grunt.option('only-invalid')) {
grunt.log.debug(JSON.stringify(licenseStats, null, 2));
}
if (invalidLicenses.length) {
grunt.log.debug(JSON.stringify(invalidLicenses, null, 2));
grunt.fail.warn(
'Non-confirming licenses: ' + _.pluck(invalidLicenses, 'name').join(', '),
invalidLicenses.length
);
}
done();
});
});
});

View file

@ -1,31 +0,0 @@
var os = require('os');
module.exports = function (grunt) {
grunt.registerTask('run_build', [
'build',
'_extract_built',
'run:built_kibana',
'_open_built_kibana',
'wait:built_kibana'
]);
var arch = os.arch();
var platform = os.platform();
var join = require('path').join;
var extract = require('./utils/spawn')(
'tar',
[
'-xzf',
grunt.config.process('<%= pkg.name %>-<%= pkg.version %>-' + platform + '-' + arch + '.tar.gz')
],
join(__dirname, '../target')
);
grunt.registerTask('_extract_built', function () {
extract().nodeify(this.async());
});
grunt.registerTask('_open_built_kibana', function () {
require('opn')('http://localhost:5601');
});
};

View file

@ -6,18 +6,15 @@ module.exports = function (grunt) {
return;
}
var tasks = [
grunt.task.run(_.compact([
process.env.TRAVIS && 'esvm:dev',
'licenses',
'jshint:source',
'jscs:source',
'maybeStartKibana',
'simplemocha:all',
'mocha:unit'
];
if (process.env.TRAVIS) tasks.unshift('esvm:dev');
grunt.task.run(tasks);
]));
});
grunt.registerTask('quick-test', function () {

View file

@ -1,60 +0,0 @@
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) {
return function () {
var defer = Promise.defer();
var opts = {
stdio: 'pipe',
cwd: cwd || path.join(__dirname, '../..')
};
var endsWithNlRE = /\n\r?$/;
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
var empty = 0;
var maxEmpty = 1;
var buffer = '';
['stdout', 'stderr'].forEach(function (stream) {
var out = childProc[stream]
.pipe(estream.split())
.pipe(
estream.map(function (line, cb) {
if (!line) { empty++; if (empty > maxEmpty) return; }
else empty = 0;
buffer += line + '\n';
cb(null, ' ' + line + '\n');
})
);
if (!silent) {
out.pipe(process[stream]);
}
});
childProc.on('close', function (code) {
if (code > 0) {
var err = new Error('Process exitted with non-zero code ' + code);
err.outpur = buffer;
defer.reject(err);
}
else defer.resolve(buffer);
});
return defer.promise;
};
};
module.exports.silent = function (cmd, args, cwd) {
return module.exports(cmd, args, cwd, true);
};

View file

@ -1,2 +0,0 @@
FILES=$(glob-cli src/**/__tests__/**/*.js '!src/**/public/**' '!src/ui/**')
mocha --bail --reporter spec --timeout 10000 $FILES