Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryanmtate committed Sep 11, 2017
1 parent 42d432e commit 9d5b9c9
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "git-token",
"version": "0.0.27",
"version": "0.0.28",
"description": "GitToken CLI Program",
"bin": {
"git-token": "./src/index.js",
Expand Down
19 changes: 15 additions & 4 deletions src/deploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ let variables = {}

inquirer.prompt(options['services']).then((answer) => {
return nextService(answer.service, {})
}).then((answer) => {
console.log('answer', answer)
}).then(() => {
console.log('variables', variables)
}).catch((error) => {
console.log(error)
})
Expand All @@ -22,9 +22,20 @@ function nextService(serviceList, envs) {
if (serviceList.length == 0 || !options[s]) {
resolve(null)
}
inquirer.prompt(options[s](envs)).then((answer) => {

if (s) {
console.log(`
Inquiring about service: ${s}
`)
}

const prompt = inquirer.createPromptModule()

prompt(options[s](envs)).then((answer) => {
variables = Object.assign(variables, answer)
resolve(nextService(serviceList, variables))
return nextService(serviceList, variables)
}).then(() => {
resolve(true)
}).catch((error) => {
reject(error)
})
Expand Down
51 changes: 51 additions & 0 deletions src/deploy/mysql-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
const Promise = require('bluebird')
const defaultFilter = require('../utils/filter')

const mysqlHost = ({ option }) => {
return {
type: 'input',
name: 'mysqlHost',
message: 'Please enter mysql IPv4 host address: ',
default: option ? option : '127.0.0.1:3306',
filter: defaultFilter
}
}

const mysqlUser = ({ option }) => {
return {
type: 'input',
name: 'mysqlUser',
message: 'Please enter mysql user name: ',
default: option ? option : 'root',
filter: defaultFilter
}
}

const mysqlRootPassword = ({ option }) => {
return {
type: 'password',
name: 'mysqlRootPassword',
message: 'Please enter mysql user password: ',
default: option ? option : null,
filter: defaultFilter
}
}

const mysqlDatabase = ({ option }) => {
return {
type: 'input',
name: 'mysqlDatabase',
message: 'Please enter mysql database name: ',
default: option ? option : 'git_token',
filter: defaultFilter
}
}

module.exports = (options) => {
return [
mysqlHost({ option: options['mysqlHost'] }),
mysqlUser({ option: options['mysqlUser'] }),
mysqlRootPassword({ option: options['mysqlRootPassword'] }),
mysqlDatabase({ option: options['mysqlDatabase'] })
]
}
1 change: 0 additions & 1 deletion src/deploy/signer-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ const recover = ({ option }) => {
}

module.exports = (options) => {
console.log('options', options)
return [
signerIpcPath({ option: options['signerIpcPath'] }),
dirPath({ option: options['dirPath'] }),
Expand Down
2 changes: 1 addition & 1 deletion src/deploy/webhook-options.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const signerIpcPath = ({ option }) => {
return {
type: 'input',
name: 'signerIpcPath',
message: 'Please enter path for GitToken signer IPC socket:',
message: 'Please enter an ipc socket path for the signer:',
default: option ? option : '/tmp/signer.sock',
filter: defaultFilter
}
Expand Down

0 comments on commit 9d5b9c9

Please sign in to comment.