add lamassu-coins script
This commit is contained in:
parent
44ea450ec5
commit
ab58908de0
5 changed files with 254 additions and 34 deletions
|
|
@ -24,6 +24,8 @@ const PLUGINS = {
|
|||
ZEC: require('./zcash.js')
|
||||
}
|
||||
|
||||
module.exports = {run}
|
||||
|
||||
function installedFilePath (crypto) {
|
||||
return path.resolve(options.blockchainDir, crypto.code, '.installed')
|
||||
}
|
||||
|
|
@ -32,32 +34,18 @@ function isInstalled (crypto) {
|
|||
return fs.existsSync(installedFilePath(crypto))
|
||||
}
|
||||
|
||||
const choices = _.map(c => {
|
||||
const checked = isInstalled(c)
|
||||
return {
|
||||
name: c.display,
|
||||
value: c.code,
|
||||
checked,
|
||||
disabled: checked && 'Installed'
|
||||
}
|
||||
}, cryptos)
|
||||
|
||||
const questions = []
|
||||
|
||||
questions.push({
|
||||
type: 'checkbox',
|
||||
name: 'crypto',
|
||||
message: 'Which cryptocurrencies would you like to install?',
|
||||
choices
|
||||
})
|
||||
|
||||
function processCryptos (codes) {
|
||||
if (_.isEmpty(codes)) {
|
||||
logger.info('No cryptos selected. Exiting.')
|
||||
process.exit(0)
|
||||
}
|
||||
|
||||
doVolume.prepareVolume()
|
||||
const goodVolume = doVolume.prepareVolume()
|
||||
|
||||
if (!goodVolume) {
|
||||
logger.error('There was an error preparing the disk volume. Exiting.')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
logger.info('Thanks! Installing: %s. Will take a while...', _.join(', ', codes))
|
||||
|
||||
|
|
@ -67,15 +55,6 @@ function processCryptos (codes) {
|
|||
logger.info('Installation complete.')
|
||||
}
|
||||
|
||||
inquirer.prompt(questions)
|
||||
.then(answers => processCryptos(answers.crypto))
|
||||
|
||||
function plugin (crypto) {
|
||||
const plugin = PLUGINS[crypto.cryptoCode]
|
||||
if (!plugin) throw new Error(`No such plugin: ${crypto.cryptoCode}`)
|
||||
return plugin
|
||||
}
|
||||
|
||||
function setupCrypto (crypto) {
|
||||
logger.info(`Installing ${crypto.display}...`)
|
||||
const cryptoDir = path.resolve(options.blockchainDir, crypto.code)
|
||||
|
|
@ -93,3 +72,33 @@ function setupCrypto (crypto) {
|
|||
process.chdir(oldDir)
|
||||
}
|
||||
|
||||
function plugin (crypto) {
|
||||
const plugin = PLUGINS[crypto.cryptoCode]
|
||||
if (!plugin) throw new Error(`No such plugin: ${crypto.cryptoCode}`)
|
||||
return plugin
|
||||
}
|
||||
|
||||
function run () {
|
||||
const choices = _.map(c => {
|
||||
const checked = isInstalled(c)
|
||||
return {
|
||||
name: c.display,
|
||||
value: c.code,
|
||||
checked,
|
||||
disabled: checked && 'Installed'
|
||||
}
|
||||
}, cryptos)
|
||||
|
||||
const questions = []
|
||||
|
||||
questions.push({
|
||||
type: 'checkbox',
|
||||
name: 'crypto',
|
||||
message: 'Which cryptocurrencies would you like to install?',
|
||||
choices
|
||||
})
|
||||
|
||||
inquirer.prompt(questions)
|
||||
.then(answers => processCryptos(answers.crypto))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue