rename toTarget to gotoTarget
This commit is contained in:
parent
23c98bcd00
commit
6168e3ed33
12
deploy.js
12
deploy.js
@ -10,7 +10,7 @@ const wo = { global.wo = {
|
|||||||
envi: {
|
envi: {
|
||||||
deploy: {
|
deploy: {
|
||||||
fromDist: './dist',
|
fromDist: './dist',
|
||||||
toTarget: 'github',
|
gotoTarget: 'github',
|
||||||
|
|
||||||
vultr: {
|
vultr: {
|
||||||
targetType: 'ssh',
|
targetType: 'ssh',
|
||||||
@ -46,15 +46,15 @@ try {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Loading config files failed: ' + err.message)
|
console.error('Loading config files failed: ' + err.message)
|
||||||
}
|
}
|
||||||
wo.envi.deploy.connection = wo.envi.deploy[wo.envi.deploy.toTarget]
|
wo.envi.deploy.connection = wo.envi.deploy[wo.envi.deploy.gotoTarget]
|
||||||
|
|
||||||
// 读取命令行参数
|
// 读取命令行参数
|
||||||
commander
|
commander
|
||||||
.version('1.0', '-v, --version') // 默认是 -V。如果要 -v,就要加 '-v --version'
|
.version('1.0', '-v, --version') // 默认是 -V。如果要 -v,就要加 '-v --version'
|
||||||
.option('-f, --fromDist <fromDist>', `local distribution path to copy from. Default to ${wo.envi.deploy.fromDist}`)
|
.option('-f, --fromDist <fromDist>', `local distribution path to copy from. Default to ${wo.envi.deploy.fromDist}`)
|
||||||
.option('-t, --toTarget <toTarget>', `connection section in config. Default to ${wo.envi.deploy.toTarget}`)
|
.option('-g, --gotoTarget <gotoTarget>', `connection section in config. Default to ${wo.envi.deploy.gotoTarget}`)
|
||||||
|
|
||||||
.option('-T, --targetType <targetType>', `target type, git or ssh. Default to ${wo.envi.deploy.connection.targetType}`)
|
.option('-t, --targetType <targetType>', `target type, git or ssh. Default to ${wo.envi.deploy.connection.targetType}`)
|
||||||
|
|
||||||
.option('-H, --host <host>', `Host IP or domain name of the target server. Default to ${wo.envi.deploy.connection.host}`)
|
.option('-H, --host <host>', `Host IP or domain name of the target server. Default to ${wo.envi.deploy.connection.host}`)
|
||||||
.option('-P, --port <port>', `Ssh port number of the target server. Default to ${wo.envi.deploy.connection.port}`)
|
.option('-P, --port <port>', `Ssh port number of the target server. Default to ${wo.envi.deploy.connection.port}`)
|
||||||
@ -64,7 +64,7 @@ commander
|
|||||||
.option('-r, --repo <repo>', `git repo address. Default to ${wo.envi.deploy.connection.repo}`)
|
.option('-r, --repo <repo>', `git repo address. Default to ${wo.envi.deploy.connection.repo}`)
|
||||||
.option('-b, --branch <branch>', `git repo branch. Default to ${wo.envi.deploy.connection.branch}`)
|
.option('-b, --branch <branch>', `git repo branch. Default to ${wo.envi.deploy.connection.branch}`)
|
||||||
.option('-n, --gitname <gitname>', `git user name. Default to ${wo.envi.deploy.connection.gitname}`)
|
.option('-n, --gitname <gitname>', `git user name. Default to ${wo.envi.deploy.connection.gitname}`)
|
||||||
.option('-e, --gitemail <gitemail>', `git user email. Default to ${wo.envi.deploy.connection.gitemail}`)
|
.option('-m, --gitemail <gitemail>', `git user email. Default to ${wo.envi.deploy.connection.gitemail}`)
|
||||||
|
|
||||||
.option('-u, --user <user>', `User id to login the target server. Default to ${wo.envi.deploy.connection.user}`)
|
.option('-u, --user <user>', `User id to login the target server. Default to ${wo.envi.deploy.connection.user}`)
|
||||||
.option('-k, --key <key>', `User private key file to login the target server. Default to ${wo.envi.deploy.connection.key}`)
|
.option('-k, --key <key>', `User private key file to login the target server. Default to ${wo.envi.deploy.connection.key}`)
|
||||||
@ -73,7 +73,7 @@ commander
|
|||||||
|
|
||||||
wo.envi.deploy.fromDist = commander.fromDist || wo.envi.deploy.fromDist
|
wo.envi.deploy.fromDist = commander.fromDist || wo.envi.deploy.fromDist
|
||||||
|
|
||||||
wo.envi.deploy.connection = wo.envi.deploy[commander.toTarget || wo.envi.deploy.toTarget] // 使用用户指定的连接
|
wo.envi.deploy.connection = wo.envi.deploy[commander.gotoTarget || wo.envi.deploy.gotoTarget] // 使用用户指定的连接
|
||||||
// 可以用命令行参数覆盖掉配置文件
|
// 可以用命令行参数覆盖掉配置文件
|
||||||
const connection = {
|
const connection = {
|
||||||
targetType: commander.targetType || wo.envi.deploy.connection.targetType,
|
targetType: commander.targetType || wo.envi.deploy.connection.targetType,
|
||||||
|
Loading…
Reference in New Issue
Block a user