tscoverage/ts/npmts.options.ts

29 lines
1.1 KiB
TypeScript
Raw Normal View History

2016-01-30 04:29:54 +00:00
/// <reference path="./index.ts" />
module NpmtsOptions {
2016-02-04 19:41:34 +00:00
export var config:any = {};
2016-01-30 04:29:54 +00:00
export var run = function(){
var done = plugins.q.defer();
2016-02-04 19:41:34 +00:00
var configPath = plugins.path.join(paths.cwd,"npmts.json");
if(plugins.smartfile.checks.fileExistsSync(configPath)){
plugins.beautylog.info("npmts.json".blue + " config file found!");
config = plugins.smartfile.readFileToObject(configPath);
switch (config.mode){
case "default":
plugins.beautylog.log("mode is " + config.mode.yellow);
done.resolve();
break;
case "custom":
plugins.beautylog.log("mode is " + config.mode.yellow);
done.resolve();
break;
default:
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
};
} else {
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
config.mode = "default";
done.resolve();
};
2016-01-30 04:29:54 +00:00
return done.promise;
}
}