Skip to content

Commit

Permalink
upgrade(redash): ^0.16.0 -> ^0.17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
David Zukowski committed Dec 21, 2016
1 parent 28f4c1e commit 04b5088
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -63,7 +63,7 @@
"log-symbols": "^1.0.2",
"minimist": "^1.2.0",
"ora": "^0.3.0",
"redash": "^0.16.0",
"redash": "^0.17.0",
"shortid": "^2.2.6"
},
"standard": {
Expand Down
6 changes: 3 additions & 3 deletions src/args.js
Expand Up @@ -34,7 +34,7 @@ const args = {
let help = ''
help += ` ${pkg.name} v.${pkg.version}\n\n`
help += ` Usage: [${_.keys(pkg.bin).join('|')}] task [options]\n\n`
help += _.pipe(_.toPairs, _.map(([k, v]) => ` -${k} -- ${v.help}`), _.join('\n'))(args.available)
help += _.pipe([_.toPairs, _.map(([k, v]) => ` -${k} -- ${v.help}`), _.join('\n')])(args.available)
console.log(`${help}\n`)
process.exit(0)
},
Expand Down Expand Up @@ -77,7 +77,7 @@ const args = {
* Parse arguments and call (action) or append to config (prop)
* @returns {object}
*/
parse: () => _.pipe(
parse: () => _.pipe([
_.omit(['_']),
_.keys,
_.filter(args.isArg),
Expand All @@ -90,7 +90,7 @@ const args = {
return acc
}, {}),
_.merge({ run: args.getTask() })
)(args.raw)
])(args.raw)
}

module.exports = args
12 changes: 6 additions & 6 deletions src/command.js
Expand Up @@ -41,7 +41,7 @@ const command = {
* @param {object} cfg Config object of instance or service
* @returns {array} Command arguments
*/
getArgs: (cfg) => _.pipe(
getArgs: (cfg) => _.pipe([
_.keys,
_.filter((key) => !!command.args[key]),
_.chain(_.cond([
Expand All @@ -50,7 +50,7 @@ const command = {
}],
[_.T, (key) => command.parseArgs(key, cfg[key])]
]))
)(cfg),
])(cfg),
/**
* Formats task by replacing line breaks with double-ampersands
* @param {string} task The task command(s)
Expand All @@ -76,25 +76,25 @@ const command = {
// Ensure a task is passed
if (!cfg.run) throw new Error('No task has been specified')
// Use predefined task(s)
const run = _.pipe(
const run = _.pipe([
tasks => _.pick(tasks, cfg.tasks),
_.toPairs,
_.map(([name, command]) => {
if (!command) throw new Error(`Task '${name}' does not exist.`)
return command
}),
_.join(' && ')
)(cfg.run)
])(cfg.run)
return cmd.concat([command.formatTask(before + run + after)])
},
/**
* Returns array of link arguments
* @param {object} cfg Config object for the container
* @returns {array} Link arguments
*/
getLinks: (cfg) => _.chain(_.pipe(_.toPairs, _.head, ([key, value]) => {
getLinks: (cfg) => _.chain(_.pipe([_.toPairs, _.head, ([key, value]) => {
return ['--link', `${command.getName(key, value)}:${key}`]
}))(cfg.services || []),
}]))(cfg.services || []),
/**
* Returns full command arguments array
* @param {object} cfg Config object for instance
Expand Down
9 changes: 5 additions & 4 deletions src/services.js
Expand Up @@ -12,14 +12,14 @@ const services = {
* @param {array} cfg Instance config object
* @returns {array} Array of services names, persistence and run args
*/
get: (cfg) => !cfg.services ? false : _.map(_.pipe(
get: (cfg) => !cfg.services ? false : _.map(_.pipe([
_.toPairs,
_.head,
([name, value]) => ({
name,
persist: value.persist || false,
args: command.get(value, name)
})), cfg.services),
})]), cfg.services),
/**
* Runs services and resolves or rejects
* @param {array} svc Array of service command arrays
Expand All @@ -37,12 +37,13 @@ const services = {
*/
stop: () => _.unless(
_.isEmpty,
_.pipe(
_.pipe([
_.filter(_.test(/dl_/)),
_.map(svc => `docker stop ${svc} && docker rm ${svc}`),
_.join(' && '),
proc.runDetached
))(services.running)
])
)(services.running)
}

module.exports = services
8 changes: 4 additions & 4 deletions src/utils.js
Expand Up @@ -14,14 +14,14 @@ const utils = {
const ids = cp.execSync(findCmd).toString()
/* istanbul ignore else */
if (ids.length) {
cp.execSync(_.pipe(
cp.execSync(_.pipe([
_.split(/\r?\n/),
_.filter((id) => id.length > 0),
_.map((id) => {
return `docker stop ${id} && docker rm ${id}`
}),
_.join(' && ')
)(ids))
])(ids))
}
},
/**
Expand All @@ -30,7 +30,7 @@ const utils = {
* no primary container running - deteremined by InstanceId suffix
* @returns {array} Names of orphaned containers
*/
parseOrphans: (ps) => _.pipe(
parseOrphans: (ps) => _.pipe([
_.split(/\r?\n/),
_.drop(1),
_.map((row) => {
Expand All @@ -51,7 +51,7 @@ const utils = {
return true
}),
_.map(_.prop('name'))
)(ps),
])(ps),
/**
* Outputs warning if any orphaned containers are found
* @returns {object} promise
Expand Down

0 comments on commit 04b5088

Please sign in to comment.