2016-06-02 15:57:01 +00:00
|
|
|
"use strict";
|
2016-07-18 14:56:53 +00:00
|
|
|
const plugins = require("./npmci.plugins");
|
|
|
|
const paths = require("./npmci.paths");
|
|
|
|
const smartstring_1 = require("smartstring");
|
2016-06-10 06:07:04 +00:00
|
|
|
if (process.env.CI_BUILD_REPO)
|
|
|
|
exports.repo = new smartstring_1.GitRepo(process.env.CI_BUILD_REPO);
|
2016-06-05 20:51:59 +00:00
|
|
|
exports.buildStage = process.env.CI_BUILD_STAGE;
|
2016-07-18 16:39:04 +00:00
|
|
|
exports.setDockerRegistry = (dockerRegistryArg) => {
|
|
|
|
exports.dockerRegistry = dockerRegistryArg;
|
|
|
|
};
|
2016-06-05 03:16:14 +00:00
|
|
|
exports.dockerFilesBuilt = [];
|
|
|
|
exports.dockerFiles = [];
|
2016-06-26 02:40:58 +00:00
|
|
|
exports.config = {
|
2016-06-26 03:21:24 +00:00
|
|
|
dockerRegistry: undefined,
|
2016-06-26 02:40:58 +00:00
|
|
|
dockerFilesBuilt: exports.dockerFilesBuilt,
|
|
|
|
dockerFiles: exports.dockerFiles,
|
|
|
|
project: undefined
|
|
|
|
};
|
2016-07-18 14:56:53 +00:00
|
|
|
exports.configStore = () => {
|
2016-06-26 03:21:24 +00:00
|
|
|
exports.config.dockerRegistry = exports.dockerRegistry;
|
2016-06-26 02:40:58 +00:00
|
|
|
plugins.smartfile.memory.toFsSync(JSON.stringify(exports.config), paths.NpmciPackageConfig);
|
2016-06-05 21:53:01 +00:00
|
|
|
};
|
2016-07-18 14:56:53 +00:00
|
|
|
let configLoad = () => {
|
2016-06-19 00:30:50 +00:00
|
|
|
// internal config to transfer information in between npmci shell calls
|
2016-06-05 21:53:01 +00:00
|
|
|
try {
|
2016-11-24 23:07:20 +00:00
|
|
|
plugins.lodash.assign(exports.config, plugins.smartfile.fs.toObjectSync(paths.NpmciPackageConfig, 'json'));
|
2016-06-05 21:53:01 +00:00
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
exports.configStore();
|
2016-11-24 23:07:20 +00:00
|
|
|
plugins.beautylog.log('config initialized!');
|
2016-06-05 21:53:01 +00:00
|
|
|
}
|
2016-06-19 00:30:50 +00:00
|
|
|
// project config
|
|
|
|
try {
|
|
|
|
if (!exports.config.project) {
|
2016-11-24 23:07:20 +00:00
|
|
|
exports.config.project = plugins.smartfile.fs.toObjectSync(paths.NpmciProjectDir, 'npmci.json');
|
|
|
|
plugins.beautylog.ok('project config found!');
|
2016-06-19 00:30:50 +00:00
|
|
|
}
|
|
|
|
;
|
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
exports.config.project = {};
|
2016-11-24 23:07:20 +00:00
|
|
|
plugins.beautylog.log('no project config found, so proceeding with default behaviour!');
|
2016-06-19 00:30:50 +00:00
|
|
|
}
|
|
|
|
exports.config.dockerRegistry ? exports.dockerRegistry = exports.config.dockerRegistry : void (0);
|
|
|
|
exports.config.dockerFilesBuilt ? exports.dockerFilesBuilt = exports.config.dockerFilesBuilt : void (0);
|
2016-06-05 21:24:11 +00:00
|
|
|
};
|
2016-06-19 00:30:50 +00:00
|
|
|
configLoad();
|
2017-02-19 13:46:05 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuZW52LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuZW52LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBQ3RDLDZDQUFtQztBQUluQyxFQUFFLENBQUMsQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLGFBQWEsQ0FBQztJQUFDLFlBQUksR0FBRyxJQUFJLHFCQUFPLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUMsQ0FBQTtBQUVqRSxRQUFBLFVBQVUsR0FBVyxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMs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