lib/pdk/generate/module.rb in pdk-1.6.1 vs lib/pdk/generate/module.rb in pdk-1.7.0
- old
+ new
@@ -111,17 +111,11 @@
end
def self.prepare_metadata(opts = {})
opts[:username] = (opts[:username] || PDK.answers['forge_username'] || username_from_login).downcase
- defaults = {
- 'version' => '0.1.0',
- 'dependencies' => [],
- 'requirements' => [
- { 'name' => 'puppet', 'version_requirement' => '>= 4.7.0 < 6.0.0' },
- ],
- }
+ defaults = PDK::Module::Metadata::DEFAULTS.dup
defaults['name'] = "#{opts[:username]}-#{opts[:module_name]}" unless opts[:module_name].nil?
defaults['author'] = PDK.answers['author'] unless PDK.answers['author'].nil?
defaults['license'] = PDK.answers['license'] unless PDK.answers['license'].nil?
defaults['license'] = opts[:license] if opts.key? :license
@@ -197,60 +191,14 @@
{
name: 'operatingsystem_support',
question: _('What operating systems does this module support?'),
help: _('Use the up and down keys to move between the choices, space to select and enter to continue.'),
required: true,
- choices: {
- 'RedHat based Linux' => [
- {
- 'operatingsystem' => 'CentOS',
- 'operatingsystemrelease' => ['7'],
- },
- {
- 'operatingsystem' => 'OracleLinux',
- 'operatingsystemrelease' => ['7'],
- },
- {
- 'operatingsystem' => 'RedHat',
- 'operatingsystemrelease' => ['7'],
- },
- {
- 'operatingsystem' => 'Scientific',
- 'operatingsystemrelease' => ['7'],
- },
- ],
- 'Debian based Linux' => [
- {
- 'operatingsystem' => 'Debian',
- 'operatingsystemrelease' => ['8'],
- },
- {
- 'operatingsystem' => 'Ubuntu',
- 'operatingsystemrelease' => ['16.04'],
- },
- ],
- 'Fedora' => {
- 'operatingsystem' => 'Fedora',
- 'operatingsystemrelease' => ['25'],
- },
- 'OSX' => {
- 'operatingsystem' => 'Darwin',
- 'operatingsystemrelease' => ['16'],
- },
- 'SLES' => {
- 'operatingsystem' => 'SLES',
- 'operatingsystemrelease' => ['12'],
- },
- 'Solaris' => {
- 'operatingsystem' => 'Solaris',
- 'operatingsystemrelease' => ['11'],
- },
- 'Windows' => {
- 'operatingsystem' => 'windows',
- 'operatingsystemrelease' => ['2008 R2', '2012 R2', '10'],
- },
- },
- default: [1, 2, 7],
+ choices: PDK::Module::Metadata::OPERATING_SYSTEMS,
+ default: PDK::Module::Metadata::DEFAULT_OPERATING_SYSTEMS.map do |os_name|
+ # tty-prompt uses a 1-index
+ PDK::Module::Metadata::OPERATING_SYSTEMS.keys.index(os_name) + 1
+ end,
},
{
name: 'summary',
question: _('Summarize the purpose of this module in a single sentence.'),
help: _('This helps other Puppet users understand what the module does.'),