Skip to content

Commit

Permalink
Merge pull request #26 from playground/refactor
Browse files Browse the repository at this point in the history
up version
  • Loading branch information
playground authored Jan 20, 2022
2 parents f153f64 + fb2d7c2 commit 498e6c4
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 61 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hzn-cli",
"version": "0.2.2",
"version": "0.2.3",
"description": "Open Horizon CLI toolkit helps streamline the process of preparing node agents and perform tasks between orgs environments",
"main": "./build/index.js",
"bin": {
Expand Down
122 changes: 62 additions & 60 deletions src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,68 +92,70 @@ export const handler = (argv: Arguments<Options>): void => {

if(action) {
console.log('$$$ ', action, env);
utils.checkDefaultConfig()
.subscribe({
complete: () => {
if(runDirectly.indexOf(action) >= 0) {
utils[action]()
.subscribe({
complete: () => process.exit(0),
error: (err) => {
console.log(err);
process.exit(0);
}
})
} else if(skipInitialize.indexOf(action) >= 0) {
proceed();
} else if(justRun.indexOf(action) >= 0) {
utils.orgCheck(env, true)
.subscribe({
complete: () => proceed(),
error: (err) => {
console.log(err);
process.exit(0);
}
})
} else if(promptForUpdate.indexOf(action) < 0 || skip_config_update) {
utils.orgCheck(env, skip_config_update === 'true')
.subscribe({
complete: () => proceed(),
error: (err) => {
console.log(err);
process.exit(0);
}
})
} else {
utils.updateEnvFiles(env)
.subscribe({
complete: () => {
proceed()
}, error: (err) => {
console.log(err)
process.exit(0);
}
})
if(runDirectly.indexOf(action) >= 0) {
utils[action]()
.subscribe({
complete: () => process.exit(0),
error: (err) => {
console.log(err);
process.exit(0);
}
}, error: (err) => {
if(skipInitialize.indexOf(action) < 0) {
console.log(err, 'Initialising...')
utils.setupEnvFiles(env)
.subscribe({
complete: () => {
proceed();
}, error: () => process.exit(0)
})
} else {
utils.uninstallHorizon()
.subscribe({
complete:() => {
console.log('process completed.');
process.exit(0)
}
})
})
} else {
utils.checkDefaultConfig()
.subscribe({
complete: () => {
if(skipInitialize.indexOf(action) >= 0) {
proceed();
} else if(justRun.indexOf(action) >= 0) {
utils.orgCheck(env, true)
.subscribe({
complete: () => proceed(),
error: (err) => {
console.log(err);
process.exit(0);
}
})
} else if(promptForUpdate.indexOf(action) < 0 || skip_config_update) {
utils.orgCheck(env, skip_config_update === 'true')
.subscribe({
complete: () => proceed(),
error: (err) => {
console.log(err);
process.exit(0);
}
})
} else {
utils.updateEnvFiles(env)
.subscribe({
complete: () => {
proceed()
}, error: (err) => {
console.log(err)
process.exit(0);
}
})
}
}, error: (err) => {
if(skipInitialize.indexOf(action) < 0) {
console.log(err, 'Initialising...')
utils.setupEnvFiles(env)
.subscribe({
complete: () => {
proceed();
}, error: () => process.exit(0)
})
} else {
utils.uninstallHorizon()
.subscribe({
complete:() => {
console.log('process completed.');
process.exit(0)
}
})
}
}
}
}
})
} else {
console.log('specify an action you would like to perform, ex: "oh deploy test" or "oh deploy -h" for help')
Expand Down

0 comments on commit 498e6c4

Please sign in to comment.