diff --git a/install/generator-cyphernode/generators/app/features/000_cyphernode.js b/install/generator-cyphernode/generators/app/features/000_cyphernode.js new file mode 100644 index 0000000..7ee54c6 --- /dev/null +++ b/install/generator-cyphernode/generators/app/features/000_cyphernode.js @@ -0,0 +1,32 @@ +const name = 'cyphernode'; + +module.exports = { + name: function() { + return name; + }, + prompts: function( utils ) { + return [{ + // https://github.com/SBoudrias/Inquirer.js#question + // input, confirm, list, rawlist, expand, checkbox, password, editor + type: 'checkbox', + name: 'features', + message: 'What features do you want to add to your cyphernode?'+'\n', + choices: utils._featureChoices() + }, + { + type: 'confirm', + name: 'cyphernode_rocks0', + default: utils._getDefault( 'cyphernode_rocks0' ), + message: 'Does cyphernode rock?'+'\n', + }, + { + type: 'confirm', + name: 'cyphernode_rocks1', + default: utils._getDefault( 'cyphernode_rocks1' ), + message: 'Does cyphernode rock?'+'\n', + }]; + }, + env: function( props ) { + return 'VAR0=VALUE0\nVAR1=VALUE1' + } +}; \ No newline at end of file diff --git a/install/generator-cyphernode/generators/app/features/bitcoin.js b/install/generator-cyphernode/generators/app/features/100_bitcoin.js similarity index 100% rename from install/generator-cyphernode/generators/app/features/bitcoin.js rename to install/generator-cyphernode/generators/app/features/100_bitcoin.js diff --git a/install/generator-cyphernode/generators/app/features/lightning.js b/install/generator-cyphernode/generators/app/features/200_lightning.js similarity index 100% rename from install/generator-cyphernode/generators/app/features/lightning.js rename to install/generator-cyphernode/generators/app/features/200_lightning.js diff --git a/install/generator-cyphernode/generators/app/features/electrum.js b/install/generator-cyphernode/generators/app/features/300_electrum.js similarity index 100% rename from install/generator-cyphernode/generators/app/features/electrum.js rename to install/generator-cyphernode/generators/app/features/300_electrum.js diff --git a/install/generator-cyphernode/generators/app/features/opentimestamps.js b/install/generator-cyphernode/generators/app/features/400_opentimestamps.js similarity index 100% rename from install/generator-cyphernode/generators/app/features/opentimestamps.js rename to install/generator-cyphernode/generators/app/features/400_opentimestamps.js diff --git a/install/generator-cyphernode/generators/app/index.js b/install/generator-cyphernode/generators/app/index.js index b5fe620..4d742aa 100644 --- a/install/generator-cyphernode/generators/app/index.js +++ b/install/generator-cyphernode/generators/app/index.js @@ -34,16 +34,9 @@ module.exports = class extends Generator { prompting() { const splash = fs.readFileSync(this.templatePath('splash.txt')); this.log(splash.toString()); - - var prompts = [{ - // https://github.com/SBoudrias/Inquirer.js#question - // input, confirm, list, rawlist, expand, checkbox, password, editor - type: 'checkbox', - name: 'features', - message: wrap('What features do you want to add to your cyphernode?')+'\n', - choices: this.featureChoices - }]; + let prompts = []; + for( let m of featurePromptModules ) { prompts = prompts.concat(m.prompts(this)); } @@ -57,9 +50,7 @@ module.exports = class extends Generator { fs.writeFileSync('/data/props.json', JSON.stringify(this.props, null, 2)); for( let m of featurePromptModules ) { - const name = m.name(); - const env = m.env(); - fs.writeFileSync('/data/'+name+'.sh', env); + fs.writeFileSync('/data/'+m.name(), m.env()); } /* this.fs.copy( @@ -93,4 +84,8 @@ module.exports = class extends Generator { return wrap(text); } + _featureChoices() { + return this.featureChoices; + } + };