mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-26 00:55:08 +01:00
integrated initial feature choice into prompts modules
This commit is contained in:
@@ -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'
|
||||
}
|
||||
};
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user