npmci/dist/npmci.env.js

38 lines
4.7 KiB
JavaScript
Raw Permalink Normal View History

2016-06-02 15:57:01 +00:00
"use strict";
require("typings-global");
var plugins = require("./npmci.plugins");
var paths = require("./npmci.paths");
var smartstring_1 = require("smartstring");
if (process.env.CI_BUILD_REPO)
exports.repo = new smartstring_1.GitRepo(process.env.CI_BUILD_REPO);
exports.buildStage = process.env.CI_BUILD_STAGE;
exports.dockerFilesBuilt = [];
exports.dockerFiles = [];
2016-06-05 21:53:01 +00:00
exports.configStore = function () {
2016-06-07 10:36:00 +00:00
var config = {
dockerRegistry: exports.dockerRegistry,
dockerFilesBuilt: exports.dockerFilesBuilt,
dockerFiles: exports.dockerFiles
};
plugins.smartfile.memory.toFsSync(JSON.stringify(config), {
2016-06-05 21:53:01 +00:00
fileName: "config.json",
filePath: paths.NpmciPackageRoot
});
};
exports.configLoad = function () {
2016-06-07 10:36:00 +00:00
var config;
2016-06-05 21:53:01 +00:00
try {
2016-06-07 10:36:00 +00:00
config = plugins.smartfile.local.toObjectSync(paths.NpmciPackageConfig, "json");
2016-06-05 21:53:01 +00:00
}
catch (err) {
2016-06-07 10:36:00 +00:00
config = {};
2016-06-05 21:53:01 +00:00
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-07 10:36:00 +00:00
config.dockerRegistry ? exports.dockerRegistry = config.dockerRegistry : void (0);
config.dockerFilesBuilt ? exports.dockerFilesBuilt = config.dockerFilesBuilt : void (0);
};
2016-06-05 21:53:01 +00:00
exports.configLoad();
2016-06-02 15:57:01 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLmVudi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7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