pdk 2.6.1 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -1
  3. data/lib/pdk/analytics/client/google_analytics.rb +4 -2
  4. data/lib/pdk/cli/build.rb +17 -21
  5. data/lib/pdk/cli/bundle.rb +4 -5
  6. data/lib/pdk/cli/config/get.rb +6 -6
  7. data/lib/pdk/cli/config.rb +3 -3
  8. data/lib/pdk/cli/console.rb +7 -7
  9. data/lib/pdk/cli/convert.rb +11 -11
  10. data/lib/pdk/cli/env.rb +3 -4
  11. data/lib/pdk/cli/errors.rb +1 -1
  12. data/lib/pdk/cli/exec/command.rb +12 -14
  13. data/lib/pdk/cli/exec/interactive_command.rb +11 -11
  14. data/lib/pdk/cli/exec.rb +4 -4
  15. data/lib/pdk/cli/exec_group.rb +1 -3
  16. data/lib/pdk/cli/get/config.rb +5 -5
  17. data/lib/pdk/cli/get.rb +2 -2
  18. data/lib/pdk/cli/module/build.rb +3 -3
  19. data/lib/pdk/cli/module/generate.rb +4 -4
  20. data/lib/pdk/cli/module.rb +3 -3
  21. data/lib/pdk/cli/new/class.rb +4 -4
  22. data/lib/pdk/cli/new/defined_type.rb +4 -4
  23. data/lib/pdk/cli/new/fact.rb +3 -3
  24. data/lib/pdk/cli/new/function.rb +4 -4
  25. data/lib/pdk/cli/new/module.rb +10 -11
  26. data/lib/pdk/cli/new/provider.rb +3 -3
  27. data/lib/pdk/cli/new/task.rb +5 -5
  28. data/lib/pdk/cli/new/test.rb +7 -7
  29. data/lib/pdk/cli/new/transport.rb +3 -3
  30. data/lib/pdk/cli/new.rb +3 -3
  31. data/lib/pdk/cli/release/prep.rb +9 -9
  32. data/lib/pdk/cli/release/publish.rb +7 -11
  33. data/lib/pdk/cli/release.rb +35 -39
  34. data/lib/pdk/cli/remove/config.rb +15 -15
  35. data/lib/pdk/cli/remove.rb +2 -2
  36. data/lib/pdk/cli/set/config.rb +16 -16
  37. data/lib/pdk/cli/set.rb +2 -2
  38. data/lib/pdk/cli/test/unit.rb +13 -13
  39. data/lib/pdk/cli/test.rb +2 -2
  40. data/lib/pdk/cli/update.rb +19 -29
  41. data/lib/pdk/cli/util/command_redirector.rb +1 -1
  42. data/lib/pdk/cli/util/interview.rb +4 -4
  43. data/lib/pdk/cli/util/option_normalizer.rb +2 -2
  44. data/lib/pdk/cli/util/option_validator.rb +1 -1
  45. data/lib/pdk/cli/util.rb +19 -20
  46. data/lib/pdk/cli/validate.rb +16 -18
  47. data/lib/pdk/cli.rb +16 -33
  48. data/lib/pdk/config/ini_file_setting.rb +2 -2
  49. data/lib/pdk/config/json_schema_namespace.rb +3 -3
  50. data/lib/pdk/config/json_schema_setting.rb +1 -1
  51. data/lib/pdk/config/json_with_schema.rb +1 -1
  52. data/lib/pdk/config/namespace.rb +4 -4
  53. data/lib/pdk/config/setting.rb +5 -5
  54. data/lib/pdk/config/validator.rb +2 -2
  55. data/lib/pdk/config/yaml.rb +2 -2
  56. data/lib/pdk/config/yaml_with_schema.rb +3 -3
  57. data/lib/pdk/config.rb +18 -20
  58. data/lib/pdk/context/control_repo.rb +1 -1
  59. data/lib/pdk/context/module.rb +1 -1
  60. data/lib/pdk/context/none.rb +1 -1
  61. data/lib/pdk/generate/module.rb +52 -64
  62. data/lib/pdk/generate/puppet_object.rb +6 -6
  63. data/lib/pdk/generate/task.rb +1 -1
  64. data/lib/pdk/module/build.rb +11 -16
  65. data/lib/pdk/module/convert.rb +14 -16
  66. data/lib/pdk/module/metadata.rb +12 -12
  67. data/lib/pdk/module/release.rb +20 -19
  68. data/lib/pdk/module/update.rb +5 -5
  69. data/lib/pdk/module/update_manager.rb +6 -6
  70. data/lib/pdk/report/event.rb +11 -11
  71. data/lib/pdk/template/fetcher/git.rb +4 -4
  72. data/lib/pdk/template/fetcher.rb +1 -1
  73. data/lib/pdk/template/renderer/v1/legacy_template_dir.rb +1 -1
  74. data/lib/pdk/template/renderer/v1/renderer.rb +5 -7
  75. data/lib/pdk/template/renderer/v1/template_file.rb +3 -1
  76. data/lib/pdk/template/template_dir.rb +1 -1
  77. data/lib/pdk/template.rb +2 -2
  78. data/lib/pdk/tests/unit.rb +12 -12
  79. data/lib/pdk/util/bundler.rb +14 -14
  80. data/lib/pdk/util/changelog_generator.rb +6 -8
  81. data/lib/pdk/util/filesystem.rb +2 -2
  82. data/lib/pdk/util/git.rb +5 -5
  83. data/lib/pdk/util/puppet_strings.rb +2 -2
  84. data/lib/pdk/util/puppet_version.rb +24 -17
  85. data/lib/pdk/util/ruby_version.rb +2 -5
  86. data/lib/pdk/util/template_uri.rb +8 -8
  87. data/lib/pdk/util/vendored_file.rb +3 -3
  88. data/lib/pdk/util/windows/api_types.rb +3 -4
  89. data/lib/pdk/util/windows/file.rb +1 -1
  90. data/lib/pdk/util/windows/process.rb +5 -8
  91. data/lib/pdk/util.rb +2 -2
  92. data/lib/pdk/validate/control_repo/environment_conf_validator.rb +5 -5
  93. data/lib/pdk/validate/invokable_validator.rb +6 -6
  94. data/lib/pdk/validate/metadata/metadata_json_lint_validator.rb +2 -2
  95. data/lib/pdk/validate/metadata/metadata_syntax_validator.rb +2 -2
  96. data/lib/pdk/validate/puppet/puppet_epp_validator.rb +1 -1
  97. data/lib/pdk/validate/puppet/puppet_lint_validator.rb +1 -1
  98. data/lib/pdk/validate/puppet/puppet_plan_syntax_validator.rb +38 -0
  99. data/lib/pdk/validate/puppet/puppet_syntax_validator.rb +1 -1
  100. data/lib/pdk/validate/puppet/puppet_validator_group.rb +1 -0
  101. data/lib/pdk/validate/ruby/ruby_rubocop_validator.rb +1 -1
  102. data/lib/pdk/validate/tasks/tasks_metadata_lint_validator.rb +4 -4
  103. data/lib/pdk/validate/tasks/tasks_name_validator.rb +2 -5
  104. data/lib/pdk/validate/validator.rb +1 -1
  105. data/lib/pdk/validate/validator_group.rb +1 -1
  106. data/lib/pdk/validate/yaml/yaml_syntax_validator.rb +4 -4
  107. data/lib/pdk/validate.rb +2 -1
  108. data/lib/pdk/version.rb +2 -2
  109. data/lib/pdk.rb +0 -2
  110. metadata +32 -54
  111. data/lib/pdk/i18n.rb +0 -4
  112. data/locales/config.yaml +0 -21
  113. data/locales/pdk.pot +0 -2111
@@ -1,8 +1,8 @@
1
1
  module PDK::CLI
2
2
  @module_generate_cmd = @module_cmd.define_command do
3
3
  name 'generate'
4
- usage _('generate [options] <module_name>')
5
- summary _('This command is now \'pdk new module\'.')
4
+ usage 'generate [options] <module_name>'
5
+ summary 'This command is now \'pdk new module\'.'
6
6
 
7
7
  PDK::CLI.template_url_option(self)
8
8
  PDK::CLI.template_ref_option(self)
@@ -21,7 +21,7 @@ module PDK::CLI
21
21
 
22
22
  PDK::CLI::Util.validate_template_opts(opts)
23
23
 
24
- PDK.logger.info(_("New modules are created using the 'pdk new module' command."))
24
+ PDK.logger.info("New modules are created using the 'pdk new module' command.")
25
25
  prompt = TTY::Prompt.new(help_color: :cyan)
26
26
  redirect = PDK::CLI::Util::CommandRedirector.new(prompt)
27
27
  redirect.target_command('pdk new module')
@@ -37,7 +37,7 @@ module PDK::CLI
37
37
  end
38
38
  opts[:target_dir] = opts[:module_name]
39
39
 
40
- PDK.logger.info(_('Creating new module: %{modname}') % { modname: module_name })
40
+ PDK.logger.info('Creating new module: %{modname}' % { modname: module_name })
41
41
  PDK::Generate::Module.invoke(opts)
42
42
  else
43
43
  exit 1
@@ -1,9 +1,9 @@
1
1
  module PDK::CLI
2
2
  @module_cmd = @base_cmd.define_command do
3
3
  name 'module'
4
- usage _('module [options]')
5
- summary _('Provide CLI-backwards compatibility to the puppet module tool.')
6
- description _('This command is only for reminding you how to accomplish tasks with the PDK, when you were previously doing them with the puppet module command.')
4
+ usage 'module [options]'
5
+ summary 'Provide CLI-backwards compatibility to the puppet module tool.'
6
+ description 'This command is only for reminding you how to accomplish tasks with the PDK, when you were previously doing them with the puppet module command.'
7
7
  default_subcommand 'help'
8
8
  end
9
9
 
@@ -1,14 +1,14 @@
1
1
  module PDK::CLI
2
2
  @new_class_cmd = @new_cmd.define_command do
3
3
  name 'class'
4
- usage _('class [options] <class_name>')
5
- summary _('Create a new class named <class_name> using given options')
4
+ usage 'class [options] <class_name>'
5
+ summary 'Create a new class named <class_name> using given options'
6
6
 
7
7
  run do |opts, args, _cmd|
8
8
  require 'pdk/generate/puppet_class'
9
9
 
10
10
  PDK::CLI::Util.ensure_in_module!(
11
- message: _('Classes can only be created from inside a valid module directory.'),
11
+ message: 'Classes can only be created from inside a valid module directory.',
12
12
  log_level: :info,
13
13
  )
14
14
 
@@ -20,7 +20,7 @@ module PDK::CLI
20
20
  end
21
21
 
22
22
  unless Util::OptionValidator.valid_class_name?(class_name)
23
- raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid class name") % { name: class_name }
23
+ raise PDK::CLI::ExitWithError, "'%{name}' is not a valid class name" % { name: class_name }
24
24
  end
25
25
 
26
26
  PDK::CLI::Util.analytics_screen_view('new_class', opts)
@@ -1,12 +1,12 @@
1
1
  module PDK::CLI
2
2
  @new_define_cmd = @new_cmd.define_command do
3
3
  name 'defined_type'
4
- usage _('defined_type [options] <name>')
5
- summary _('Create a new defined type named <name> using given options')
4
+ usage 'defined_type [options] <name>'
5
+ summary 'Create a new defined type named <name> using given options'
6
6
 
7
7
  run do |opts, args, _cmd|
8
8
  PDK::CLI::Util.ensure_in_module!(
9
- message: _('Defined types can only be created from inside a valid module directory.'),
9
+ message: 'Defined types can only be created from inside a valid module directory.',
10
10
  log_level: :info,
11
11
  )
12
12
 
@@ -18,7 +18,7 @@ module PDK::CLI
18
18
  end
19
19
 
20
20
  unless Util::OptionValidator.valid_defined_type_name?(defined_type_name)
21
- raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid defined type name") % { name: defined_type_name }
21
+ raise PDK::CLI::ExitWithError, "'%{name}' is not a valid defined type name" % { name: defined_type_name }
22
22
  end
23
23
 
24
24
  PDK::CLI::Util.analytics_screen_view('new_defined_type', opts)
@@ -1,8 +1,8 @@
1
1
  module PDK::CLI
2
2
  @new_fact_cmd = @new_cmd.define_command do
3
3
  name 'fact'
4
- usage _('fact [options] <name>')
5
- summary _('Create a new custom fact named <name> using given options')
4
+ usage 'fact [options] <name>'
5
+ summary 'Create a new custom fact named <name> using given options'
6
6
 
7
7
  run do |opts, args, _cmd|
8
8
  PDK::CLI::Util.ensure_in_module!
@@ -15,7 +15,7 @@ module PDK::CLI
15
15
  end
16
16
 
17
17
  unless Util::OptionValidator.valid_fact_name?(fact_name)
18
- raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid fact name") % { name: fact_name }
18
+ raise PDK::CLI::ExitWithError, "'%{name}' is not a valid fact name" % { name: fact_name }
19
19
  end
20
20
 
21
21
  PDK::CLI::Util.analytics_screen_view('new_fact', opts)
@@ -1,9 +1,9 @@
1
1
  module PDK::CLI
2
2
  @new_function_cmd = @new_cmd.define_command do
3
3
  name 'function'
4
- usage _('function [options] <name>')
5
- summary _('Create a new function named <name> using given options')
6
- option :t, :type, _('The function type, (native or v4)'), argument: :required, default: 'native'
4
+ usage 'function [options] <name>'
5
+ summary 'Create a new function named <name> using given options'
6
+ option :t, :type, 'The function type, (native or v4)', argument: :required, default: 'native'
7
7
 
8
8
  run do |opts, args, _cmd|
9
9
  PDK::CLI::Util.ensure_in_module!
@@ -16,7 +16,7 @@ module PDK::CLI
16
16
  end
17
17
 
18
18
  unless Util::OptionValidator.valid_function_name?(function_name)
19
- raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid function name") % { name: function_name }
19
+ raise PDK::CLI::ExitWithError, "'%{name}' is not a valid function name" % { name: function_name }
20
20
  end
21
21
 
22
22
  PDK::CLI::Util.analytics_screen_view('new_function', opts)
@@ -1,17 +1,17 @@
1
1
  module PDK::CLI
2
2
  @new_module_cmd = @new_cmd.define_command do
3
3
  name 'module'
4
- usage _('module [options] [module_name] [target_dir]')
5
- summary _('Create a new module named [module_name] using given options')
4
+ usage 'module [options] [module_name] [target_dir]'
5
+ summary 'Create a new module named [module_name] using given options'
6
6
 
7
7
  PDK::CLI.template_url_option(self)
8
8
  PDK::CLI.template_ref_option(self)
9
9
  PDK::CLI.skip_interview_option(self)
10
10
  PDK::CLI.full_interview_option(self)
11
11
 
12
- option nil, 'license', _('Specifies the license this module is written under. ' \
13
- "This should be a identifier from https://spdx.org/licenses/. Common values are 'Apache-2.0', 'MIT', or 'proprietary'."), argument: :required
14
- option nil, 'skip-bundle-install', _('Do not automatically run `bundle install` after creating the module.'), hidden: true
12
+ option nil, 'license', 'Specifies the license this module is written under. ' \
13
+ "This should be a identifier from https://spdx.org/licenses/. Common values are 'Apache-2.0', 'MIT', or 'proprietary'.", argument: :required
14
+ option nil, 'skip-bundle-install', 'Do not automatically run `bundle install` after creating the module.', hidden: true
15
15
 
16
16
  run do |opts, args, _cmd|
17
17
  require 'pdk/generate/module'
@@ -24,16 +24,15 @@ module PDK::CLI
24
24
  PDK::CLI::Util.analytics_screen_view('new_module', opts)
25
25
 
26
26
  if opts[:'skip-interview'] && opts[:'full-interview']
27
- PDK.logger.info _('Ignoring --full-interview and continuing with --skip-interview.')
27
+ PDK.logger.info 'Ignoring --full-interview and continuing with --skip-interview.'
28
28
  opts[:'full-interview'] = false
29
29
  end
30
30
 
31
31
  if module_name.nil? || module_name.empty?
32
32
  if opts[:'skip-interview']
33
- raise PDK::CLI::ExitWithError, _(
34
- 'You must specify a module name on the command line when running ' \
35
- 'with --skip-interview.',
36
- )
33
+ raise PDK::CLI::ExitWithError,
34
+ 'You must specify a module name on the command line when running ' \
35
+ 'with --skip-interview.'
37
36
  end
38
37
  else
39
38
  module_name_parts = module_name.split('-', 2)
@@ -46,7 +45,7 @@ module PDK::CLI
46
45
  opts[:target_dir] = target_dir.nil? ? opts[:module_name] : target_dir
47
46
  end
48
47
 
49
- PDK.logger.info(_('Creating new module: %{modname}') % { modname: module_name })
48
+ PDK.logger.info('Creating new module: %{modname}' % { modname: module_name })
50
49
  PDK::Generate::Module.invoke(opts)
51
50
  end
52
51
  end
@@ -1,8 +1,8 @@
1
1
  module PDK::CLI
2
2
  @new_provider_cmd = @new_cmd.define_command do
3
3
  name 'provider'
4
- usage _('provider [options] <name>')
5
- summary _('[experimental] Create a new ruby provider named <name> using given options')
4
+ usage 'provider [options] <name>'
5
+ summary '[experimental] Create a new ruby provider named <name> using given options'
6
6
 
7
7
  run do |opts, args, _cmd|
8
8
  PDK::CLI::Util.ensure_in_module!
@@ -15,7 +15,7 @@ module PDK::CLI
15
15
  end
16
16
 
17
17
  unless Util::OptionValidator.valid_provider_name?(provider_name)
18
- raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid provider name") % { name: provider_name }
18
+ raise PDK::CLI::ExitWithError, "'%{name}' is not a valid provider name" % { name: provider_name }
19
19
  end
20
20
 
21
21
  PDK::CLI::Util.analytics_screen_view('new_provider', opts)
@@ -1,16 +1,16 @@
1
1
  module PDK::CLI
2
2
  @new_task_cmd = @new_cmd.define_command do
3
3
  name 'task'
4
- usage _('task [options] <name>')
5
- summary _('Create a new task named <name> using given options')
4
+ usage 'task [options] <name>'
5
+ summary 'Create a new task named <name> using given options'
6
6
 
7
- option nil, :description, _('A short description of the purpose of the task'), argument: :required
7
+ option nil, :description, 'A short description of the purpose of the task', argument: :required
8
8
 
9
9
  run do |opts, args, _cmd|
10
10
  require 'pdk/generate/task'
11
11
 
12
12
  PDK::CLI::Util.ensure_in_module!(
13
- message: _('Tasks can only be created from inside a valid module directory.'),
13
+ message: 'Tasks can only be created from inside a valid module directory.',
14
14
  log_level: :info,
15
15
  )
16
16
 
@@ -22,7 +22,7 @@ module PDK::CLI
22
22
  end
23
23
 
24
24
  unless Util::OptionValidator.valid_task_name?(task_name)
25
- raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid task name") % { name: task_name }
25
+ raise PDK::CLI::ExitWithError, "'%{name}' is not a valid task name" % { name: task_name }
26
26
  end
27
27
 
28
28
  PDK::CLI::Util.analytics_screen_view('new_task', opts)
@@ -1,9 +1,9 @@
1
1
  module PDK::CLI
2
2
  @new_define_cmd = @new_cmd.define_command do
3
3
  name 'test'
4
- usage _('test [options] <name>')
5
- summary _('Create a new test for the object named <name>')
6
- flag :u, :unit, _('Create a new unit test.')
4
+ usage 'test [options] <name>'
5
+ summary 'Create a new test for the object named <name>'
6
+ flag :u, :unit, 'Create a new unit test.'
7
7
  PDK::CLI.puppet_version_options(self)
8
8
  PDK::CLI.puppet_dev_option(self)
9
9
 
@@ -13,7 +13,7 @@ module PDK::CLI
13
13
 
14
14
  PDK::CLI::Util.validate_puppet_version_opts(opts)
15
15
  PDK::CLI::Util.ensure_in_module!(
16
- message: _('Tests can only be created from inside a valid module directory.'),
16
+ message: 'Tests can only be created from inside a valid module directory.',
17
17
  log_level: :info,
18
18
  )
19
19
 
@@ -27,7 +27,7 @@ module PDK::CLI
27
27
  unless opts[:unit]
28
28
  # At a future time, we'll replace this conditional with an interactive
29
29
  # question to choose the test type.
30
- PDK.logger.info _('Test type not specified, assuming unit.')
30
+ PDK.logger.info 'Test type not specified, assuming unit.'
31
31
  opts[:unit] = true
32
32
  end
33
33
 
@@ -43,9 +43,9 @@ module PDK::CLI
43
43
  updates = generator.new(PDK.context, obj['name'], opts.merge(spec_only: true)).run
44
44
  PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
45
45
  rescue PDK::Util::PuppetStrings::NoObjectError
46
- raise PDK::CLI::ExitWithError, _('Unable to find anything called "%{object}" to generate unit tests for.') % { object: object_name }
46
+ raise PDK::CLI::ExitWithError, 'Unable to find anything called "%{object}" to generate unit tests for.' % { object: object_name }
47
47
  rescue PDK::Util::PuppetStrings::NoGeneratorError => e
48
- raise PDK::CLI::ExitWithError, _('PDK does not support generating unit tests for "%{object_type}" objects.') % { object_type: e.message }
48
+ raise PDK::CLI::ExitWithError, 'PDK does not support generating unit tests for "%{object_type}" objects.' % { object_type: e.message }
49
49
  end
50
50
  end
51
51
  end
@@ -1,8 +1,8 @@
1
1
  module PDK::CLI
2
2
  @new_transport_cmd = @new_cmd.define_command do
3
3
  name 'transport'
4
- usage _('transport [options] <name>')
5
- summary _('[experimental] Create a new ruby transport named <name> using given options')
4
+ usage 'transport [options] <name>'
5
+ summary '[experimental] Create a new ruby transport named <name> using given options'
6
6
 
7
7
  run do |opts, args, _cmd|
8
8
  PDK::CLI::Util.ensure_in_module!
@@ -15,7 +15,7 @@ module PDK::CLI
15
15
  end
16
16
 
17
17
  unless Util::OptionValidator.valid_transport_name?(transport_name)
18
- raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid transport name") % { name: transport_name }
18
+ raise PDK::CLI::ExitWithError, "'%{name}' is not a valid transport name" % { name: transport_name }
19
19
  end
20
20
 
21
21
  require 'pdk/generate/transport'
data/lib/pdk/cli/new.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  module PDK::CLI
2
2
  @new_cmd = @base_cmd.define_command do
3
3
  name 'new'
4
- usage _('new <thing> [options]')
5
- summary _('create a new module, etc.')
6
- description _('Creates a new <thing> using relevant options.')
4
+ usage 'new <thing> [options]'
5
+ summary 'create a new module, etc.'
6
+ description 'Creates a new <thing> using relevant options.'
7
7
  default_subcommand 'help'
8
8
  end
9
9
 
@@ -3,22 +3,22 @@ require 'pdk/cli/release'
3
3
  module PDK::CLI
4
4
  @release_prep_cmd = @release_cmd.define_command do
5
5
  name 'prep'
6
- usage _('prep [options]')
7
- summary _('(Experimental) Performs all the pre-release checks to ensure module is ready to be released')
6
+ usage 'prep [options]'
7
+ summary '(Experimental) Performs all the pre-release checks to ensure module is ready to be released'
8
8
 
9
- flag nil, :force, _('Prepare the module automatically, with no prompts.')
10
- flag nil, :'skip-validation', _('Skips the module validation check.')
11
- flag nil, :'skip-changelog', _('Skips the automatic changelog generation.')
12
- flag nil, :'skip-dependency', _('Skips the module dependency check.')
13
- flag nil, :'skip-documentation', _('Skips the documentation update.')
9
+ flag nil, :force, 'Prepare the module automatically, with no prompts.'
10
+ flag nil, :'skip-validation', 'Skips the module validation check.'
11
+ flag nil, :'skip-changelog', 'Skips the automatic changelog generation.'
12
+ flag nil, :'skip-dependency', 'Skips the module dependency check.'
13
+ flag nil, :'skip-documentation', 'Skips the documentation update.'
14
14
 
15
- option nil, :version, _('Update the module to the specified version prior to release. When not specified, the new version will be computed from the Changelog where possible.'),
15
+ option nil, :version, 'Update the module to the specified version prior to release. When not specified, the new version will be computed from the Changelog where possible.',
16
16
  argument: :required
17
17
 
18
18
  run do |opts, _args, cmd|
19
19
  # Make sure build is being run in a valid module directory with a metadata.json
20
20
  PDK::CLI::Util.ensure_in_module!(
21
- message: _("`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json."),
21
+ message: "`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json.",
22
22
  log_level: :info,
23
23
  )
24
24
 
@@ -3,20 +3,20 @@ require 'pdk/cli/release'
3
3
  module PDK::CLI
4
4
  @release_publish_cmd = @release_cmd.define_command do
5
5
  name 'publish'
6
- usage _('publish [options] <tarball>')
7
- summary _('(Experimental) Publishes the module <tarball> to the Forge.')
6
+ usage 'publish [options] <tarball>'
7
+ summary '(Experimental) Publishes the module <tarball> to the Forge.'
8
8
 
9
- flag nil, :force, _('Publish the module automatically, with no prompts.')
9
+ flag nil, :force, 'Publish the module automatically, with no prompts.'
10
10
 
11
- option nil, :'forge-upload-url', _('Set forge upload url path.'),
11
+ option nil, :'forge-upload-url', 'Set forge upload url path.',
12
12
  argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
13
13
 
14
- option nil, :'forge-token', _('Set Forge API token (you may also set via environment variable PDK_FORGE_TOKEN)'), argument: :required
14
+ option nil, :'forge-token', 'Set Forge API token (you may also set via environment variable PDK_FORGE_TOKEN)', argument: :required
15
15
 
16
16
  run do |opts, _args, cmd|
17
17
  # Make sure build is being run in a valid module directory with a metadata.json
18
18
  PDK::CLI::Util.ensure_in_module!(
19
- message: _("`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json."),
19
+ message: "`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json.",
20
20
  log_level: :info,
21
21
  )
22
22
 
@@ -30,11 +30,7 @@ module PDK::CLI
30
30
  opts[:'forge-token'] ||= PDK::Util::Env['PDK_FORGE_TOKEN']
31
31
 
32
32
  if opts[:'forge-token'].nil? || opts[:'forge-token'].empty?
33
- PDK.logger.error _(
34
- 'You must supply a Forge API token either via `--forge-token` option ' \
35
- 'or PDK_FORGE_TOKEN environment variable.',
36
- )
37
-
33
+ PDK.logger.error 'You must supply a Forge API token either via `--forge-token` option or PDK_FORGE_TOKEN environment variable.'
38
34
  exit 1
39
35
  end
40
36
 
@@ -8,33 +8,33 @@ require 'pdk/module/build'
8
8
  module PDK::CLI
9
9
  @release_cmd = @base_cmd.define_command do
10
10
  name 'release'
11
- usage _('release [options]')
12
- summary _('(Experimental) Release a module to the Puppet Forge.')
13
-
14
- flag nil, :force, _('Release the module automatically, with no prompts.')
15
- flag nil, :'skip-validation', _('Skips the module validation check.')
16
- flag nil, :'skip-changelog', _('Skips the automatic changelog generation.')
17
- flag nil, :'skip-dependency', _('Skips the module dependency check.')
18
- flag nil, :'skip-documentation', _('Skips the documentation update.')
19
- flag nil, :'skip-build', _('Skips module build.')
20
- flag nil, :'skip-publish', _('Skips publishing the module to the forge.')
21
-
22
- option nil, :'forge-upload-url', _('Set forge upload url path.'),
11
+ usage 'release [options]'
12
+ summary '(Experimental) Release a module to the Puppet Forge.'
13
+
14
+ flag nil, :force, 'Release the module automatically, with no prompts.'
15
+ flag nil, :'skip-validation', 'Skips the module validation check.'
16
+ flag nil, :'skip-changelog', 'Skips the automatic changelog generation.'
17
+ flag nil, :'skip-dependency', 'Skips the module dependency check.'
18
+ flag nil, :'skip-documentation', 'Skips the documentation update.'
19
+ flag nil, :'skip-build', 'Skips module build.'
20
+ flag nil, :'skip-publish', 'Skips publishing the module to the forge.'
21
+
22
+ option nil, :'forge-upload-url', 'Set forge upload url path.',
23
23
  argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
24
24
 
25
- option nil, :'forge-token', _('Set Forge API token.'),
25
+ option nil, :'forge-token', 'Set Forge API token.',
26
26
  argument: :optional
27
27
 
28
- option nil, :version, _('Update the module to the specified version prior to release. When not specified, the new version will be computed from the Changelog where possible.'),
28
+ option nil, :version, 'Update the module to the specified version prior to release. When not specified, the new version will be computed from the Changelog where possible.',
29
29
  argument: :required
30
30
 
31
- option nil, :file, _('Path to the built module to push to the Forge. This option can only be used when --skip-build is also used. Defaults to pkg/<module version>.tar.gz'),
31
+ option nil, :file, 'Path to the built module to push to the Forge. This option can only be used when --skip-build is also used. Defaults to pkg/<module version>.tar.gz',
32
32
  argument: :required
33
33
 
34
34
  run do |opts, _args, _cmd|
35
35
  # Make sure build is being run in a valid module directory with a metadata.json
36
36
  PDK::CLI::Util.ensure_in_module!(
37
- message: _('`pdk release` can only be run from inside a valid module with a metadata.json.'),
37
+ message: '`pdk release` can only be run from inside a valid module with a metadata.json.',
38
38
  log_level: :info,
39
39
  )
40
40
 
@@ -57,12 +57,8 @@ module PDK::CLI
57
57
  def self.module_compatibility_checks!(release, opts)
58
58
  unless release.module_metadata.forge_ready?
59
59
  if opts[:force]
60
- PDK.logger.warn _(
61
- 'This module is missing the following fields in the metadata.json: %{fields}. ' \
62
- 'These missing fields may affect the visibility of the module on the Forge.',
63
- ) % {
64
- fields: release.module_metadata.missing_fields.join(', '),
65
- }
60
+ PDK.logger.warn "This module is missing the following fields in the metadata.json: #{release.module_metadata.missing_fields.join(', ')}. " \
61
+ 'These missing fields may affect the visibility of the module on the Forge.'
66
62
  else
67
63
  release.module_metadata.interview_for_forge!
68
64
  release.write_module_metadata!
@@ -71,13 +67,13 @@ module PDK::CLI
71
67
 
72
68
  unless release.pdk_compatible? # rubocop:disable Style/GuardClause Nope!
73
69
  if opts[:force]
74
- PDK.logger.warn _('This module is not compatible with PDK, so PDK can not validate or test this build.')
70
+ PDK.logger.warn 'This module is not compatible with PDK, so PDK can not validate or test this build.'
75
71
  else
76
- PDK.logger.info _('This module is not compatible with PDK, so PDK can not validate or test this build. ' \
77
- 'Unvalidated modules may have errors when uploading to the Forge. ' \
78
- 'To make this module PDK compatible and use validate features, cancel the build and run `pdk convert`.')
79
- unless PDK::CLI::Util.prompt_for_yes(_('Continue build without converting?'))
80
- PDK.logger.info _('Build cancelled; exiting.')
72
+ PDK.logger.info 'This module is not compatible with PDK, so PDK can not validate or test this build. ' \
73
+ 'Unvalidated modules may have errors when uploading to the Forge. ' \
74
+ 'To make this module PDK compatible and use validate features, cancel the build and run `pdk convert`.'
75
+ unless PDK::CLI::Util.prompt_for_yes('Continue build without converting?')
76
+ PDK.logger.info 'Build cancelled; exiting.'
81
77
  PDK::Util.exit_process(1)
82
78
  end
83
79
  end
@@ -96,42 +92,42 @@ module PDK::CLI
96
92
  unless opts[:'skip-validation']
97
93
  questions << {
98
94
  name: 'validation',
99
- question: _('Do you want to run the module validation ?'),
95
+ question: 'Do you want to run the module validation ?',
100
96
  type: :yes,
101
97
  }
102
98
  end
103
99
  unless opts[:'skip-changelog']
104
100
  questions << {
105
101
  name: 'changelog',
106
- question: _('Do you want to run the automatic changelog generation ?'),
102
+ question: 'Do you want to run the automatic changelog generation ?',
107
103
  type: :yes,
108
104
  }
109
105
  end
110
106
  unless opts[:version]
111
107
  questions << {
112
108
  name: 'setversion',
113
- question: _('Do you want to set the module version ?'),
109
+ question: 'Do you want to set the module version ?',
114
110
  type: :yes,
115
111
  }
116
112
  end
117
113
  unless opts[:'skip-dependency']
118
114
  questions << {
119
115
  name: 'dependency',
120
- question: _('Do you want to run the dependency-checker on this module?'),
116
+ question: 'Do you want to run the dependency-checker on this module?',
121
117
  type: :yes,
122
118
  }
123
119
  end
124
120
  unless opts[:'skip-documentation']
125
121
  questions << {
126
122
  name: 'documentation',
127
- question: _('Do you want to update the documentation for this module?'),
123
+ question: 'Do you want to update the documentation for this module?',
128
124
  type: :yes,
129
125
  }
130
126
  end
131
127
  unless opts[:'skip-publish']
132
128
  questions << {
133
129
  name: 'publish',
134
- question: _('Do you want to publish the module on the Puppet Forge?'),
130
+ question: 'Do you want to publish the module on the Puppet Forge?',
135
131
  type: :yes,
136
132
  }
137
133
  end
@@ -159,11 +155,11 @@ module PDK::CLI
159
155
  questions = [
160
156
  {
161
157
  name: 'version',
162
- question: _('Please set the module version'),
163
- help: _('This value is the version that will be used in the changelog generator and building of the module.'),
158
+ question: 'Please set the module version',
159
+ help: 'This value is the version that will be used in the changelog generator and building of the module.',
164
160
  required: true,
165
161
  validate_pattern: %r{(\*|\d+(\.\d+){0,2}(\.\*)?)$}i,
166
- validate_message: _('The version format should be in the format x.y.z where x represents the major version, y the minor version and z the build number.'),
162
+ validate_message: 'The version format should be in the format x.y.z where x represents the major version, y the minor version and z the build number.',
167
163
  },
168
164
  ]
169
165
  interview = PDK::CLI::Util::Interview.new(prompt)
@@ -177,8 +173,8 @@ module PDK::CLI
177
173
  questions = [
178
174
  {
179
175
  name: 'apikey',
180
- question: _('Please set the api key(authorization token) to upload on the Puppet Forge'),
181
- help: _('This value is used for authentication on the Puppet Forge to upload your module tarball.'),
176
+ question: 'Please set the api key(authorization token) to upload on the Puppet Forge',
177
+ help: 'This value is used for authentication on the Puppet Forge to upload your module tarball.',
182
178
  required: true,
183
179
  },
184
180
  ]
@@ -8,17 +8,17 @@ module PDK::CLI
8
8
 
9
9
  force = opts[:force] || false
10
10
 
11
- raise PDK::CLI::ExitWithError, _('Configuration name is required') if item_name.nil?
11
+ raise PDK::CLI::ExitWithError, 'Configuration name is required' if item_name.nil?
12
12
 
13
13
  current_value = PDK.config.get(item_name)
14
- raise PDK::CLI::ExitWithError, _("The configuration item '%{name}' can not be removed.") % { name: item_name } if current_value.is_a?(PDK::Config::Namespace)
14
+ raise PDK::CLI::ExitWithError, "The configuration item '%{name}' can not be removed." % { name: item_name } if current_value.is_a?(PDK::Config::Namespace)
15
15
  if current_value.nil?
16
- PDK.logger.info(_("Could not remove '%{name}' as it has not been set") % { name: item_name })
16
+ PDK.logger.info("Could not remove '%{name}' as it has not been set" % { name: item_name })
17
17
  return 0
18
18
  end
19
19
 
20
- PDK.logger.info(_("Ignoring the item value '%{value}' as --force has been set") % { value: item_value }) if current_value.is_a?(Array) && !item_value.nil? && force
21
- PDK.logger.info(_('Ignoring --force as the setting is not multi-valued')) if !current_value.is_a?(Array) && force
20
+ PDK.logger.info("Ignoring the item value '%{value}' as --force has been set" % { value: item_value }) if current_value.is_a?(Array) && !item_value.nil? && force
21
+ PDK.logger.info('Ignoring --force as the setting is not multi-valued') if !current_value.is_a?(Array) && force
22
22
 
23
23
  # FIXME: It'd be nice to shortcircuit deleting default values. This causes the configuration file
24
24
  # to be saved, even though nothing actually changes
@@ -31,9 +31,9 @@ module PDK::CLI
31
31
  new_value = item_value.nil? ? [] : current_value.reject { |item| item.to_s == item_value }
32
32
  if current_value.count == new_value.count
33
33
  if item_value.nil?
34
- PDK.logger.info(_("Could not remove '%{name}' as it is already empty") % { name: item_name })
34
+ PDK.logger.info("Could not remove '%{name}' as it is already empty" % { name: item_name })
35
35
  else
36
- PDK.logger.info(_("Could not remove '%{value}' from '%{name}' as it has not been set") % { value: item_value, name: item_name })
36
+ PDK.logger.info("Could not remove '%{value}' from '%{name}' as it has not been set" % { value: item_value, name: item_name })
37
37
  end
38
38
  return 0
39
39
  end
@@ -49,18 +49,18 @@ module PDK::CLI
49
49
  # Arrays have a special output format. If item_value is nil then the user wanted to empty/clear
50
50
  # the array otherwise they just wanted to remove a single entry.
51
51
  if item_value.nil?
52
- PDK.logger.info(_("Cleared '%{name}' which had a value of '%{from}'") % { name: item_name, from: current_value })
52
+ PDK.logger.info("Cleared '%{name}' which had a value of '%{from}'" % { name: item_name, from: current_value })
53
53
  else
54
- PDK.logger.info(_("Removed '%{value}' from '%{name}'") % { value: item_value, name: item_name })
54
+ PDK.logger.info("Removed '%{value}' from '%{name}'" % { value: item_value, name: item_name })
55
55
  end
56
56
  elsif !new_value.nil?
57
- PDK.logger.info(_("Could not remove '%{name}' as it using a default value of '%{to}'") % { name: item_name, to: new_value })
57
+ PDK.logger.info("Could not remove '%{name}' as it using a default value of '%{to}'" % { name: item_name, to: new_value })
58
58
  else
59
- PDK.logger.info(_("Removed '%{name}' which had a value of '%{from}'") % { name: item_name, from: current_value })
59
+ PDK.logger.info("Removed '%{name}' which had a value of '%{from}'" % { name: item_name, from: current_value })
60
60
  end
61
61
 
62
62
  # Same output as `get config`
63
- $stdout.puts _('%{name}=%{value}') % { name: item_name, value: new_value }
63
+ $stdout.puts '%{name}=%{value}' % { name: item_name, value: new_value }
64
64
  0
65
65
  end
66
66
  end
@@ -68,10 +68,10 @@ module PDK::CLI
68
68
 
69
69
  @remove_config_cmd = @remove_cmd.define_command do
70
70
  name 'config'
71
- usage _('config [name] [value]')
72
- summary _('Remove or delete the configuration for <name>')
71
+ usage 'config [name] [value]'
72
+ summary 'Remove or delete the configuration for <name>'
73
73
 
74
- option :f, :force, _('Force multi-value configuration settings to be removed instead of emptied.'), argument: :forbidden
74
+ option :f, :force, 'Force multi-value configuration settings to be removed instead of emptied.', argument: :forbidden
75
75
 
76
76
  run do |opts, args, _cmd|
77
77
  exit PDK::CLI::Remove::Config.run(opts, args)