mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[build] Style cleanup
This commit is contained in:
parent
db5ac1e72f
commit
6189c19de8
2 changed files with 28 additions and 32 deletions
|
@ -1,17 +1,16 @@
|
|||
module.exports = function (grunt) {
|
||||
const { resolve } = require('path');
|
||||
const { indexBy } = require('lodash');
|
||||
const { config } = grunt;
|
||||
const exec = require('../utils/exec');
|
||||
import { resolve } from 'path';
|
||||
import { indexBy } from 'lodash';
|
||||
import exec from '../utils/exec';
|
||||
|
||||
const targetDir = config.get('target');
|
||||
const packageScriptsDir = config.get('packageScriptsDir');
|
||||
const servicesByName = indexBy(config.get('services'), 'name');
|
||||
const packageConfig = config.get('packages');
|
||||
export default (grunt) => {
|
||||
const targetDir = grunt.config.get('target');
|
||||
const packageScriptsDir = grunt.config.get('packageScriptsDir');
|
||||
const servicesByName = indexBy(grunt.config.get('services'), 'name');
|
||||
const config = grunt.config.get('packages');
|
||||
const fpm = args => exec('fpm', args);
|
||||
|
||||
grunt.registerTask('_build:osPackages', function () {
|
||||
config.get('platforms')
|
||||
grunt.config.get('platforms')
|
||||
.filter(({ name }) => /linux-x(86|64)$/.test(name))
|
||||
.map(({ name, buildDir }) => {
|
||||
const architecture = /x64$/.test(name) ? 'x86_64' : 'i386';
|
||||
|
@ -26,24 +25,24 @@ module.exports = function (grunt) {
|
|||
'--package', targetDir,
|
||||
'-s', 'dir', // input type
|
||||
'--architecture', architecture,
|
||||
'--name', packageConfig.name,
|
||||
'--description', packageConfig.description,
|
||||
'--version', packageConfig.version,
|
||||
'--url', packageConfig.site,
|
||||
'--vendor', packageConfig.vendor,
|
||||
'--maintainer', packageConfig.maintainer,
|
||||
'--license', packageConfig.license,
|
||||
'--name', config.name,
|
||||
'--description', config.description,
|
||||
'--version', config.version,
|
||||
'--url', config.site,
|
||||
'--vendor', config.vendor,
|
||||
'--maintainer', config.maintainer,
|
||||
'--license', config.license,
|
||||
'--after-install', resolve(packageScriptsDir, 'post_install.sh'),
|
||||
'--before-install', resolve(packageScriptsDir, 'pre_install.sh'),
|
||||
'--before-remove', resolve(packageScriptsDir, 'pre_remove.sh'),
|
||||
'--after-remove', resolve(packageScriptsDir, 'post_remove.sh'),
|
||||
'--config-files', packageConfig.path.kibanaConfig,
|
||||
'--template-value', 'user=kibana',
|
||||
'--template-value', 'group=kibana'
|
||||
'--config-files', config.path.kibanaConfig,
|
||||
'--template-value', `user=${config.user}`,
|
||||
'--template-value', `group=${config.group}`,
|
||||
|
||||
//config folder is moved to path.conf, exclude {path.home}/config
|
||||
//uses relative path to --prefix, strip the leading /
|
||||
'--exclude', `${packageConfig.path.home.slice(1)}/config`
|
||||
'--exclude', `${config.path.home.slice(1)}/config`
|
||||
];
|
||||
const debOptions = [
|
||||
'-t', 'deb',
|
||||
|
@ -54,14 +53,14 @@ module.exports = function (grunt) {
|
|||
'--rpm-os', 'linux'
|
||||
];
|
||||
const args = [
|
||||
`${buildDir}/=${packageConfig.path.home}/`,
|
||||
`${buildDir}/config/=${packageConfig.path.conf}/`,
|
||||
`${buildDir}/=${config.path.home}/`,
|
||||
`${buildDir}/config/=${config.path.conf}/`,
|
||||
`${servicesByName.sysv.outputDir}/etc/=/etc/`,
|
||||
`${servicesByName.systemd.outputDir}/lib/=/lib/`
|
||||
];
|
||||
|
||||
//Manually find flags, multiple args without assignment are not entirely parsed
|
||||
const flags = grunt.option.flags().join(',');
|
||||
const flags = grunt.option.flags().filter(flag => /deb|rpm/.test(flag)).join(',');
|
||||
const buildDeb = flags.includes('deb') || !flags.length;
|
||||
const buildRpm = flags.includes('rpm') || !flags.length;
|
||||
if (buildDeb) {
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
module.exports = function createServices(grunt) {
|
||||
const { resolve } = require('path');
|
||||
const { appendFileSync } = require('fs');
|
||||
const exec = require('../utils/exec');
|
||||
import { resolve } from 'path';
|
||||
import { appendFileSync } from 'fs';
|
||||
import exec from '../utils/exec';
|
||||
|
||||
export default (grunt) => {
|
||||
const userScriptsDir = grunt.config.get('userScriptsDir');
|
||||
const { path, user, group } = grunt.config.get('packages');
|
||||
|
||||
grunt.registerTask('_build:pleaseRun', function () {
|
||||
// TODO(sissel): Detect if 'pleaserun' is found, and provide a useful error
|
||||
// to the user if it is missing.
|
||||
|
||||
grunt.config.get('services').forEach(function (service) {
|
||||
grunt.config.get('services').forEach((service) => {
|
||||
grunt.file.mkdir(service.outputDir);
|
||||
exec('pleaserun', [
|
||||
'--install',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue