Skip to content

Commit

Permalink
Just some plumbing.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneseymour committed Feb 5, 2020
1 parent fe14e45 commit c9bcff6
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .ci/Jenkinsfile_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
# Check my work :)
cat src/dev/code_coverage/shell_scripts/bootstrapped.txt
node src/dev/code_coverage/node_scripts/cc_app_bootstrap/index.js ${BUILD_NUMBER} src/dev/code_coverage/shell_scripts/bootstrapped.txt
node src/dev/code_coverage/node_scripts/cc_app_bootstrap/index.js ${BUILD_NUMBER} \
src/dev/code_coverage/shell_scripts/bootstrapped.txt \
src/dev/code_coverage/cc_app/public/initial_data.js
""",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@
*/

import { run } from '@kbn/dev-utils';
import { parseAndPopulate } from './parse_and_populate';

const description = 'Populate the initial data for the code coverage static site.';

const exec = buildNumber => outFile => ({ log }) => {
log.info(`### Job Num: ${buildNumber}`);
log.info(`### Dat file: ${outFile}`);
// Parse it
// Populate cc_app/public/inital_data.js
const exec = buildNumber => srcFile => destFile => ({ log }) =>
parseAndPopulate(buildNumber)(srcFile)(destFile)(log);

};

export const populate = (buildNumber, outFile) =>
run(exec(buildNumber)(outFile), { description });
export const populate = (buildNumber, srcFile, destFile) =>
run(exec(buildNumber)(srcFile)(destFile), { description });
4 changes: 2 additions & 2 deletions src/dev/code_coverage/node_scripts/cc_app_bootstrap/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require('../../../../../src/setup_node_env');

const [ , , buildNumber, outFile ] = process.argv;
const [ , , buildNumber, srcFile, destFile ] = process.argv;

require('./bootstrap_app_initial_data').populate(buildNumber, outFile);
require('./bootstrap_app_initial_data').populate(buildNumber, srcFile, destFile);
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import * as Rx from 'rxjs';
import * as readline from 'readline';
import * as fs from 'fs';
import { resolve } from 'path';


const KIBANA_ROOT_PATH = '../../../../..';
const KIBANA_ROOT = resolve(__dirname, KIBANA_ROOT_PATH);

const resolvePaths = (...xs) => xs.map(x => resolve(KIBANA_ROOT, x));


export const parseAndPopulate = buildNumber => srcFile => destFile => log => {
initPrint(buildNumber, srcFile, destFile)(log)

const [resolvedSrcFile, resolvedDestFile] = resolvePaths(srcFile, destFile);
log.verbose(`\n### resolvedSrcFile: \n\t${resolvedSrcFile}`);
log.verbose(`\n### resolvedDestFile: \n\t${resolvedDestFile}`);

// const input = fs.createReadStream(srcFile)
// const rl = readline.createInterface({ input });
//
//
// const lines$ = Rx.Observable.fromEvent(rl, 'line')
// .takeUntil(Rx.Observable.fromEvent(rl, 'close'))
// .subscribe(
// console.log,
// err => console.log("Error: %s", err),
// () => console.log("Completed"));
};

function initPrint(...args) {
return function initPrintInner(log) {
log.verbose(`Job Num: ${args[0]}`);
log.verbose(`### Dat file: ${args[1]}`);
log.verbose(`### Dest file: ${args[2]}`);
}
}

0 comments on commit c9bcff6

Please sign in to comment.