2016-06-02 15:57:01 +00:00
|
|
|
"use strict";
|
2016-06-03 00:56:20 +00:00
|
|
|
require("typings-global");
|
2016-06-05 21:24:11 +00:00
|
|
|
var plugins = require("./npmci.plugins");
|
|
|
|
var paths = require("./npmci.paths");
|
2016-06-03 00:56:20 +00:00
|
|
|
var 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-06-05 03:16:14 +00:00
|
|
|
exports.dockerFilesBuilt = [];
|
|
|
|
exports.dockerFiles = [];
|
2016-06-26 02:40:58 +00:00
|
|
|
exports.config = {
|
|
|
|
dockerRegistry: exports.dockerRegistry,
|
|
|
|
dockerFilesBuilt: exports.dockerFilesBuilt,
|
|
|
|
dockerFiles: exports.dockerFiles,
|
|
|
|
project: undefined
|
|
|
|
};
|
2016-06-05 21:53:01 +00:00
|
|
|
exports.configStore = function () {
|
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-06-19 00:30:50 +00:00
|
|
|
var configLoad = function () {
|
|
|
|
// 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-06-02 15:57:01 +00:00
|
|
|
|
2016-06-26 02:40:58 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmVudi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFDM0MsSUFBWSxLQUFLLFdBQU0sZUFBZSxDQUFDLENBQUE7QUFDdkMsNEJBQXNCLGFBQWEsQ0FBQyxDQUFBO0FBSXBDLEVBQUUsQ0FBQSxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsYUFBYSxDQUFDO0lBQUMsWUFBSSxHQUFHLElBQUkscUJBQU8sQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLGFBQWEsQ0FBQyxDQUFDO0FBRWpFLGtCQUFVLEdBQVUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxjQUFjLENBQUM7QUFJL0Msd0JBQWdCLEdBQWdCLEVBQUUsQ0FBQztBQUNuQyxtQkFBVyxHQUFnQixFQUFFLENBQU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