Comparing version 0.1.1 to 0.2.0
43
index.js
@@ -5,9 +5,36 @@ /** | ||
module.exports = { | ||
cmdList: require('./lib/cmd-list'), | ||
deploy: require('./lib/deploy'), | ||
environment: require('./lib/environment'), | ||
execute: require('./lib/execute'), | ||
firstCommit: require('./lib/first-commit'), | ||
previousCommit: require('./lib/previous-commit') | ||
}; | ||
var use = require('use-plugin')({ | ||
"module": module, | ||
"prefix": 'deploytool', | ||
"builtin": './plugins' | ||
}); | ||
var plugins = {}; | ||
module.exports = {}; | ||
function usePlugin(pluginName) { | ||
if (plugins[pluginName]) { | ||
return plugins[pluginName]; | ||
} | ||
var pluginDescription = use(pluginName); | ||
pluginDescription.init(); | ||
plugins[pluginName] = pluginDescription; | ||
return pluginDescription; | ||
} | ||
// Set up exposed utility functions | ||
module.exports.use = usePlugin; | ||
module.exports.cmd = require('./lib/cmd'); | ||
module.exports.cmdList = require('./lib/cmd-list'); | ||
module.exports.cmdList = require('./lib/environment'); | ||
module.exports.firstCommit = require('./lib/first-commit'); | ||
module.exports.previousCommit = require('./lib/previous-commit'); | ||
// Load core plugins | ||
var deployPlugin = usePlugin("deploy"); | ||
module.exports.deploy = require(deployPlugin.requirepath).deploy; |
@@ -8,3 +8,3 @@ /** | ||
var async = require('async'); | ||
var execute = require('./execute'); | ||
var execute = require('./cmd'); | ||
@@ -11,0 +11,0 @@ module.exports = function (commands, callback) { |
@@ -7,9 +7,15 @@ /** | ||
// Private | ||
var objectAssign = require('object-assign'); | ||
var yaml_config = require('node-yaml-config'); | ||
module.exports = DeployToolEnvironment; | ||
// Public | ||
module.exports = DeploytoolEnvironment; | ||
function DeployToolEnvironment(id, config) { | ||
var defaults = { branch: 'master', remote: 'origin', name: id }; | ||
function DeploytoolEnvironment(id, config, defaults) { | ||
defaults = objectAssign({ | ||
branch: 'master', | ||
remote: 'origin', | ||
name: id | ||
}, defaults || {}); | ||
@@ -20,7 +26,25 @@ this.id = id; | ||
DeployToolEnvironment.initialize = function (idOrEnv, defaults) { | ||
DeploytoolEnvironment.prototype.applyDefaults = function (defaults) { | ||
this.config = objectAssign(defaults, this.config); | ||
return env.config; | ||
}; | ||
DeploytoolEnvironment.prototype.validate = function (required, callback) { | ||
var error = null; | ||
required.forEach(function (key) { | ||
if (!this.config[key]) { | ||
error = new Error('Environment key ' + key + ' is required but not set'); | ||
} | ||
}, this); | ||
callback(error, !error); | ||
}; | ||
DeploytoolEnvironment.init = function (idOrEnv, defaults) { | ||
var environment = idOrEnv; | ||
if (typeof environment === 'string') { | ||
environment = DeployToolEnvironment.load(environment); | ||
environment = DeploytoolEnvironment.load(environment); | ||
} | ||
@@ -35,7 +59,10 @@ | ||
DeployToolEnvironment.load = function(id, configFile, defaults, configDir) { | ||
configDir = configDir || __dirname; | ||
configFile = configFile || '.deploytool.yml'; | ||
DeploytoolEnvironment.load = function (id, options) { | ||
options = objectAssign({ | ||
configFile: '.deploytool.yml', | ||
configDir: __dirname, | ||
defaults: {} | ||
}, options); | ||
var path = configDir + '/' + configFile; | ||
var path = options.configDir + '/' + options.configFile; | ||
var config = yaml_config.load(path); | ||
@@ -47,11 +74,3 @@ | ||
return new DeployToolEnvironment(id, config, defaults); | ||
return new DeploytoolEnvironment(id, config, options.defaults); | ||
}; | ||
DeployToolEnvironment.create = function(id, config, defaults) { | ||
return new DeployToolEnvironment(id, config, defaults); | ||
}; | ||
DeployToolEnvironment.applyDefaults = function(defaults) { | ||
this.config = objectAssign(defaults, this.config); | ||
}; |
{ | ||
"name": "deploytool", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "A Node tool for deploying things like code to places like remote servers and services", | ||
@@ -25,8 +25,9 @@ "license": "MIT", | ||
}, | ||
"keywords": [ | ||
], | ||
"keywords": [], | ||
"dependencies": { | ||
"async": "^2.0.0-rc.6", | ||
"eraro": "^0.4.1", | ||
"node-yaml-config": "0.0.4", | ||
"object-assign": "^4.1.0" | ||
"object-assign": "^4.1.0", | ||
"use-plugin": "^0.3.1" | ||
}, | ||
@@ -33,0 +34,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7107
158
1
5
9
+ Addederaro@^0.4.1
+ Addeduse-plugin@^0.3.1
+ Addederaro@0.4.1(transitive)
+ Addedlodash@2.4.24.15.0(transitive)
+ Addednid@0.3.2(transitive)
+ Addednorma@0.3.0(transitive)
+ Addeduse-plugin@0.3.2(transitive)