2016-06-02 15:57:01 +00:00
|
|
|
"use strict";
|
2016-06-03 00:56:20 +00:00
|
|
|
require("typings-global");
|
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-06-26 02:40:58 +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-06-07 10:36:00 +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-06-23 20:22:03 +00:00
|
|
|
exports.config.project = plugins.smartfile.fs.toObjectSync(paths.NpmciProjectDir, "npmci.json");
|
2016-06-19 00:30:50 +00:00
|
|
|
plugins.beautylog.ok("project config found!");
|
|
|
|
}
|
|
|
|
;
|
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
exports.config.project = {};
|
|
|
|
plugins.beautylog.log("no project config found, so proceeding with default behaviour!");
|
|
|
|
}
|
|
|
|
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();
|
2016-07-18 16:39:04 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuZW52LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuZW52LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsTUFBWSxPQUFPLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUMzQyxNQUFZLEtBQUssV0FBTSxlQUFlLENBQUMsQ0FBQTtBQUN2Qyw4QkFBc0IsYUFBYSxDQUFDLENBQUE7QUFJcEMsRUFBRSxDQUFBLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhLENBQUM7SUFBQyxZQUFJLEdBQUcsSUFBSSxxQkFBTy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