Skip to content

Commit

Permalink
Merge pull request #4675 from spalger/fix/build
Browse files Browse the repository at this point in the history
Fix build
  • Loading branch information
w33ble committed Aug 17, 2015
2 parents 649cbfe + 3d2812c commit ce19ecc
Show file tree
Hide file tree
Showing 43 changed files with 617 additions and 680 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
trash
bundles
target
/build
.jruby
.idea
*.iml
Expand Down
38 changes: 27 additions & 11 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@ module.exports = function (grunt) {
}
}()),

nodeVersion: '0.10.35',
platforms: ['darwin-x64', 'linux-x64', 'linux-x86', 'windows'],
services: [
['launchd', '10.9'],
['upstart', '1.5'],
['systemd', 'default'],
['sysv', 'lsb-3.1']
],

devPlugins: 'devMode',
nodeVersion: '2.5.0',

meta: {
banner: '/*! <%= package.name %> - v<%= package.version %> - ' +
Expand All @@ -44,16 +35,40 @@ module.exports = function (grunt) {
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= package.author.company %>;' +
' Licensed <%= package.license %> */\n'
},

lintThese: [
'Gruntfile.js',
'<%= root %>/tasks/**/*.js',
'<%= src %>/**/*.js',
'!<%= src %>/fixtures/**/*.js'
]
],

deepModules: {
'caniuse-db': '1.0.30000265',
'chalk': '1.1.0',
'glob': '4.5.3',
'har-validator': '1.8.0',
'json5': '0.4.0',
'loader-utils': '0.2.11',
'micromatch': '2.2.0',
'postcss-normalize-url': '2.1.1',
'postcss-reduce-idents': '1.0.2',
'postcss-unique-selectors': '1.0.0',
'postcss-minify-selectors': '1.4.6',
'postcss-single-charset': '0.3.0',
'regenerator': '0.8.36'
}
};

grunt.config.merge(config);

config.userScriptsDir = __dirname + '/build/userScripts';
// ensure that these run first, other configs need them
config.services = require('./tasks/config/services')(grunt);
config.platforms = require('./tasks/config/platforms')(grunt);

grunt.config.merge(config);

// load plugins
require('load-grunt-config')(grunt, {
configPath: __dirname + '/tasks/config',
Expand All @@ -66,4 +81,5 @@ module.exports = function (grunt) {

// load task definitions
grunt.task.loadTasks('tasks');
grunt.task.loadTasks('tasks/build');
};
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@
"angular-nvd3": "panda01/angular-nvd3#kibana",
"angular-route": "1.2.28",
"ansicolors": "^0.3.2",
"auto-preload-rjscommon-deps-loader": "^1.0.4",
"autoprefixer": "^5.2.0",
"autoprefixer-loader": "^2.0.0",
"babel": "^5.8.21",
"babel-core": "^5.8.21",
"babel-loader": "^5.3.2",
"babel-runtime": "^5.8.20",
"bluebird": "^2.9.27",
"boom": "^2.8.0",
"bootstrap": "^3.3.5",
Expand Down Expand Up @@ -96,7 +96,7 @@
"less": "^2.5.1",
"less-loader": "^2.2.0",
"lodash": "^3.10.0",
"marked": "^0.3.3",
"marked": "0.3.3",
"memory-fs": "^0.2.0",
"minimatch": "^2.0.8",
"mkdirp": "^0.5.1",
Expand All @@ -106,9 +106,10 @@
"numeral": "^1.5.3",
"nvd3": "panda01/nvd3#kibana",
"raw-loader": "^0.5.1",
"request": "^2.40.0",
"request": "^2.60.0",
"requirefrom": "^0.2.0",
"rimraf": "^2.4.1",
"rjs-repack-loader": "^1.0.6",
"script-loader": "^0.6.1",
"semver": "^4.3.6",
"style-loader": "^0.12.3",
Expand All @@ -126,9 +127,9 @@
"expect.js": "^0.3.1",
"faker": "^1.1.0",
"grunt": "^0.4.5",
"grunt-babel": "^5.0.1",
"grunt-cli": "0.1.13",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-esvm": "^1.1.3",
"grunt-karma": "^0.12.0",
Expand All @@ -154,7 +155,8 @@
"portscanner": "^1.0.0",
"simple-git": "^1.3.0",
"sinon": "^1.15.4",
"source-map": "^0.4.4"
"source-map": "^0.4.4",
"wreck": "^6.1.0"
},
"engines": {
"node": ">=2"
Expand Down
12 changes: 12 additions & 0 deletions src/cli/index.build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var _ = require('lodash');
var fromRoot = require('requirefrom')('src/utils')('fromRoot');

var babelOpts = _.defaults({
ignore: [
fromRoot('src'),
/[\\\/](node_modules|bower_components)[\\\/]/
]
}, require('../optimize/babelOptions'));

require('babel/register')(babelOpts);
require('./cli');
69 changes: 0 additions & 69 deletions src/cli/plugin/__tests__/npmInstall.js

This file was deleted.

35 changes: 0 additions & 35 deletions src/cli/plugin/npmInstall.js

This file was deleted.

4 changes: 0 additions & 4 deletions src/cli/plugin/pluginInstaller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var pluginDownloader = require('./pluginDownloader');
var pluginCleaner = require('./pluginCleaner');
var npmInstall = require('./npmInstall');
var fs = require('fs');

module.exports = {
Expand All @@ -26,9 +25,6 @@ function install(settings, logger) {
.then(function () {
return downloader.download();
})
.then(function () {
return npmInstall(settings.workingPath, logger);
})
.then(function (curious) {
fs.renameSync(settings.workingPath, settings.pluginPath);
logger.log('Plugin installation complete');
Expand Down
27 changes: 21 additions & 6 deletions src/cli/serve/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ let cwd = process.cwd();
let src = require('requirefrom')('src');
let fromRoot = src('utils/fromRoot');

let canCluster;
try {
require.resolve('../cluster/ClusterManager');
canCluster = true;
} catch (e) {
canCluster = false;
}

let pathCollector = function () {
let paths = [];
return function (path) {
Expand All @@ -18,8 +26,9 @@ let pluginDirCollector = pathCollector();
let pluginPathCollector = pathCollector();

module.exports = function (program) {
program
.command('serve')
let command = program.command('serve');

command
.description('Run the kibana server')
.collectUnknownOptions()
.option('-e, --elasticsearch <uri>', 'Elasticsearch instance')
Expand Down Expand Up @@ -47,11 +56,17 @@ module.exports = function (program) {
pluginPathCollector,
[]
)
.option('--plugins <path>', 'an alias for --plugin-dir', pluginDirCollector)
.option('--dev', 'Run the server with development mode defaults')
.option('--no-watch', 'Prevents automatic restarts of the server in --dev mode')
.option('--plugins <path>', 'an alias for --plugin-dir', pluginDirCollector);

if (canCluster) {
command
.option('--dev', 'Run the server with development mode defaults')
.option('--no-watch', 'Prevents automatic restarts of the server in --dev mode');
}

command
.action(async function (opts) {
if (opts.dev && !isWorker) {
if (canCluster && opts.dev && !isWorker) {
// stop processing the action and handoff to cluster manager
let ClusterManager = require('../cluster/ClusterManager');
new ClusterManager(opts);
Expand Down
2 changes: 1 addition & 1 deletion src/optimize/BaseOptimizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class BaseOptimizer {
{ test: /\.(html|tmpl)$/, loader: 'raw' },
{ test: /\.png$/, loader: 'url?limit=10000&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}` },
{ test: /[\/\\]src[\/\\](plugins|ui)[\/\\].+\.js$/, loader: `rjs-repack${mapQ}` },
{
test: /\.js$/,
exclude: /[\/\\](node_modules|bower_components)[\/\\]/,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/kibana/public/visualize/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@

}

@import "../editor/styles/.editor.less";
@import "../editor/styles/_editor.less";
26 changes: 0 additions & 26 deletions tasks/build.js

This file was deleted.

39 changes: 39 additions & 0 deletions tasks/build/archives.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module.exports = function createPackages(grunt) {
let { config } = grunt;
let { resolve } = require('path');
let { execFile } = require('child_process');
let { all, fromNode } = require('bluebird');

let buildPath = resolve(config.get('root'), 'build');
let exec = async (cmd, args) => {
grunt.log.writeln(` > ${cmd} ${args.join(' ')}`);
await fromNode(cb => execFile(cmd, args, { cwd: buildPath }, cb));
};


let archives = async (platform) => {
// kibana.tar.gz
await exec('tar', ['-zchf', platform.tarPath, platform.buildName]);

// kibana.zip
if (/windows/.test(platform.name)) {
await exec('zip', ['-rq', '-ll', platform.zipPath, platform.buildName]);
} else {
await exec('zip', ['-rq', platform.zipPath, platform.buildName]);
}
};

grunt.registerTask('_build:archives', function () {

all(
grunt.config.get('platforms')
.map(async platform => {

grunt.file.mkdir('target');
await archives(platform);
})
)
.nodeify(this.async());

});
};
Loading

0 comments on commit ce19ecc

Please sign in to comment.