拷贝 url 到 connection 中
This commit is contained in:
parent
3e9680a295
commit
541bb5c302
16
deploy.js
16
deploy.js
@ -50,7 +50,6 @@ try {
|
||||
} catch (err) {
|
||||
console.error('Loading config files failed: ' + err.message)
|
||||
}
|
||||
wo.envi.deploy.connection = wo.envi.deploy[wo.envi.deploy.gotoTarget]
|
||||
|
||||
// 读取命令行参数
|
||||
commander
|
||||
@ -76,8 +75,8 @@ commander
|
||||
.parse(process.argv)
|
||||
|
||||
wo.envi.deploy.fromPath = commander.fromPath || wo.envi.deploy.fromPath
|
||||
|
||||
wo.envi.deploy.connection = wo.envi.deploy[commander.gotoTarget || wo.envi.deploy.gotoTarget] // 使用用户指定的连接
|
||||
|
||||
// 可以用命令行参数覆盖掉配置文件
|
||||
const connection = {
|
||||
targetType: commander.targetType || wo.envi.deploy.connection.targetType,
|
||||
@ -94,7 +93,7 @@ const connection = {
|
||||
gitemail: commander.gitemail || wo.envi.deploy.connection.gitemail,
|
||||
// common
|
||||
username: commander.user || wo.envi.deploy.connection.user,
|
||||
privateKey: fs.existsSync(commander.key || wo.envi.deploy.key) ? (commander.key || wo.envi.deploy.key) : undefined,
|
||||
privateKey: fs.existsSync(commander.key || wo.envi.deploy.connection.key) ? (commander.key || wo.envi.deploy.connection.key) : undefined,
|
||||
password: commander.password || wo.envi.deploy.connection.password,
|
||||
tryKeyboard: true,
|
||||
onKeyboardInteractive: (name, instructions, lang, prompts, finish) => { // 不起作用
|
||||
@ -102,6 +101,7 @@ const connection = {
|
||||
finish([password])
|
||||
}
|
||||
},
|
||||
url: wo.envi.deploy.connection.url
|
||||
}
|
||||
|
||||
console.log(` deploy from ${wo.envi.deploy.fromPath} to ${JSON.stringify(connection)}`)
|
||||
@ -164,10 +164,10 @@ function deployToSsh(connection){
|
||||
})
|
||||
ssh.dispose()
|
||||
if (err) {
|
||||
console.error(`🙁️🙁️🙁️ Failed deploy ${connection.fromPath} to ${connection.targetPath}/${connection.targetDir} 🙁️🙁️🙁️`)
|
||||
console.error(`🙁️🙁️🙁️ Failed deploy ${wo.envi.deploy.fromPath} to ${connection.targetPath}/${connection.targetDir} 🙁️🙁️🙁️`)
|
||||
process.exit(1)
|
||||
} else {
|
||||
console.info(`😊😊😊 Successfully deployed ${connection.fromPath} to ${connection.targetPath}/${connection.targetDir} 😊😊😊`)
|
||||
console.info(`😊😊😊 Successfully deployed [${wo.envi.deploy.fromPath}] to [${connection.targetPath}/${connection.targetDir}] 😊😊😊`)
|
||||
if (connection.url){
|
||||
console.info(`*** ${connection.url} ***`)
|
||||
}
|
||||
@ -176,7 +176,7 @@ function deployToSsh(connection){
|
||||
}).catch(err => {
|
||||
console.error(err)
|
||||
ssh.dispose()
|
||||
console.error(`🙁️🙁️🙁️ Failed deploy ${connection.fromPath} to ${connection.targetPath}/${connection.targetDir} 🙁️🙁️🙁️`)
|
||||
console.error(`🙁️🙁️🙁️ Failed deploy [${wo.envi.deploy.fromPath}] to [${connection.targetPath}/${connection.targetDir}] 🙁️🙁️🙁️`)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
@ -300,12 +300,12 @@ function deployToGit(connection){
|
||||
}).then(() => {
|
||||
return git('push', '-u', repo.url, 'HEAD:' + repo.branch, '--force')
|
||||
}).then(()=>{
|
||||
console.info(`😊😊😊 Successfully deployed ${connection.fromPath} to ${connection.repo}#${connection.branch} 😊😊😊`)
|
||||
console.info(`😊😊😊 Successfully deployed [${wo.envi.deploy.fromPath}] to [${connection.repo}#${connection.branch}] 😊😊😊`)
|
||||
if (connection.url){
|
||||
console.info(`*** ${connection.url} ***`)
|
||||
}
|
||||
}).catch((err)=>{
|
||||
console.error(`🙁️🙁️🙁️ Failed deploy ${connection.fromPath} to ${connection.targetPath}/${connection.targetDir} 🙁️🙁️🙁️`)
|
||||
console.error(`🙁️🙁️🙁️ Failed deploy [${wo.envi.deploy.fromPath}] to [${connection.targetPath}/${connection.targetDir}] 🙁️🙁️🙁️`)
|
||||
process.exit(1)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user