pdk 2.6.1 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5fd048aa1b88cbb420fc9e68fdb4c0117bf20f3ea7e31786ead40dedb748d56
4
- data.tar.gz: bfbcfc0b29a688a124b0e265666928841bc3fbde06ed3b8f4023704a3786e140
3
+ metadata.gz: 979dd75e73b7f8116815ac2bcea591015552d39bd270839b1463699b155749b8
4
+ data.tar.gz: 38db198043dbc6972a40e6c7fe0cab03831ac2e14c262a34620df6edc8c54bbf
5
5
  SHA512:
6
- metadata.gz: ff4b2c3d6cba83c6e0890b845607f6c0dbd032967a5dde11e03576693ae1379513d8191b8587f1c5a1e7323ec5963ccafbc6dec2923f5bb130195a44bbedede9
7
- data.tar.gz: 4168482e90168f9a05c6bb241497779ea812ca70c53c06f2cb16777c1232575eb61899ab490027a1ccb98a3a7b5fa72317f9bbd042a259c8eccbc0d26f207f78
6
+ metadata.gz: 3fda4ce44de952a03a892d511eed80f843ac0436c5758c0447d7acc1e732e8303aecee89680638329b974c995167dc197349c1e1def0faa5378a200abf3eaeb9
7
+ data.tar.gz: 01220e3d45975f58517af8e066063d36827058236ecd4f5a518b4c9b413a0e2f6008faeb05097246d3c8485661b9d66f1f7421d1287feeb2b1462c1326e6a5ff
data/CHANGELOG.md CHANGED
@@ -5,7 +5,25 @@ All notable changes to this project will be documented in this file.
5
5
 
6
6
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).
7
7
 
8
- ## [v2.6.1](https://github.com/puppetlabs/pdk/tree/v2.6.1) - 2023-01-25
8
+ ## [v2.7.0](https://github.com/puppetlabs/pdk/tree/v2.7.0) - 2023-03-14
9
+
10
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.6.1...v2.7.0)
11
+
12
+ ### Added
13
+
14
+ - (CONT-694) Bump PDK Template Version [#1216](https://github.com/puppetlabs/pdk/pull/1216) ([chelnak](https://github.com/chelnak))
15
+ - (CONT-370) Remove i18n support [#1211](https://github.com/puppetlabs/pdk/pull/1211) ([chelnak](https://github.com/chelnak))
16
+ - Add Puppet validator for plans [#1207](https://github.com/puppetlabs/pdk/pull/1207) ([jay7x](https://github.com/jay7x))
17
+
18
+ ### Fixed
19
+
20
+ - (CONT-722) Patch pe to puppet mapping [#1221](https://github.com/puppetlabs/pdk/pull/1221) ([chelnak](https://github.com/chelnak))
21
+ - (GH-1210) Require uri [#1220](https://github.com/puppetlabs/pdk/pull/1220) ([chelnak](https://github.com/chelnak))
22
+ - (CONT-720) Fix default version selection [#1219](https://github.com/puppetlabs/pdk/pull/1219) ([chelnak](https://github.com/chelnak))
23
+ - (CONT-719) Require JSON gem [#1218](https://github.com/puppetlabs/pdk/pull/1218) ([chelnak](https://github.com/chelnak))
24
+ - (CONT-669) Use bundle info command [#1215](https://github.com/puppetlabs/pdk/pull/1215) ([chelnak](https://github.com/chelnak))
25
+
26
+ ## [v2.6.1](https://github.com/puppetlabs/pdk/tree/v2.6.1) - 2023-01-26
9
27
 
10
28
  [Full Changelog](https://github.com/puppetlabs/pdk/compare/v2.6.0...v2.6.1)
11
29
 
@@ -42,7 +42,7 @@ module PDK
42
42
 
43
43
  def screen_view(screen, **kwargs)
44
44
  custom_dimensions = walk_keys(kwargs) do |k|
45
- CUSTOM_DIMENSIONS[k] || raise(_("Unknown analytics key '%{key}'") % { key: k })
45
+ CUSTOM_DIMENSIONS[k] || raise("Unknown analytics key '%{key}'" % { key: k })
46
46
  end
47
47
 
48
48
  screen_view_params = {
@@ -57,7 +57,7 @@ module PDK
57
57
 
58
58
  def event(category, action, label: nil, value: nil, **kwargs)
59
59
  custom_dimensions = walk_keys(kwargs) do |k|
60
- CUSTOM_DIMENSIONS[k] || raise(_("Unknown analytics key '%{key}'") % { key: k })
60
+ CUSTOM_DIMENSIONS[k] || raise("Unknown analytics key '%{key}'" % { key: k })
61
61
  end
62
62
 
63
63
  event_params = {
@@ -92,6 +92,8 @@ module PDK
92
92
  # These parameters have terrible names. See this page for complete documentation:
93
93
  # https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
94
94
  def base_params
95
+ require 'locale'
96
+
95
97
  {
96
98
  v: PROTOCOL_VERSION,
97
99
  # Client ID
data/lib/pdk/cli/build.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  module PDK::CLI
2
2
  @build_cmd = @base_cmd.define_command do
3
3
  name 'build'
4
- usage _('build [options]')
5
- summary _('Builds a package from the module that can be published to the Puppet Forge.')
4
+ usage 'build [options]'
5
+ summary 'Builds a package from the module that can be published to the Puppet Forge.'
6
6
 
7
7
  option nil, 'target-dir',
8
- _('The target directory where you want PDK to write the package.'),
8
+ 'The target directory where you want PDK to write the package.',
9
9
  argument: :required, default: File.join(Dir.pwd, 'pkg')
10
10
 
11
- option nil, 'force', _('Skips the prompts and builds the module package.')
11
+ option nil, 'force', 'Skips the prompts and builds the module package.'
12
12
 
13
13
  run do |opts, _args, _cmd|
14
14
  require 'pdk/module/build'
@@ -17,7 +17,7 @@ module PDK::CLI
17
17
 
18
18
  # Make sure build is being run in a valid module directory with a metadata.json
19
19
  PDK::CLI::Util.ensure_in_module!(
20
- message: _('`pdk build` can only be run from inside a valid module with a metadata.json.'),
20
+ message: '`pdk build` can only be run from inside a valid module with a metadata.json.',
21
21
  log_level: :info,
22
22
  )
23
23
 
@@ -30,12 +30,8 @@ module PDK::CLI
30
30
  #
31
31
  unless module_metadata.forge_ready?
32
32
  if opts[:force]
33
- PDK.logger.warn _(
34
- 'This module is missing the following fields in the metadata.json: %{fields}. ' \
35
- 'These missing fields may affect the visibility of the module on the Forge.',
36
- ) % {
37
- fields: module_metadata.missing_fields.join(', '),
38
- }
33
+ PDK.logger.warn "This module is missing the following fields in the metadata.json: #{module_metadata.missing_fields.join(', ')}. " \
34
+ 'These missing fields may affect the visibility of the module on the Forge.'
39
35
  else
40
36
  module_metadata.interview_for_forge!
41
37
  module_metadata.write!('metadata.json')
@@ -46,34 +42,34 @@ module PDK::CLI
46
42
 
47
43
  unless opts[:force]
48
44
  if builder.package_already_exists?
49
- PDK.logger.info _("The file '%{package}' already exists.") % { package: builder.package_file }
45
+ PDK.logger.info "The file '%{package}' already exists." % { package: builder.package_file }
50
46
 
51
- unless PDK::CLI::Util.prompt_for_yes(_('Overwrite?'), default: false)
52
- PDK.logger.info _('Build cancelled; exiting.')
47
+ unless PDK::CLI::Util.prompt_for_yes('Overwrite?', default: false)
48
+ PDK.logger.info 'Build cancelled; exiting.'
53
49
  exit 0
54
50
  end
55
51
  end
56
52
 
57
53
  unless builder.module_pdk_compatible?
58
- PDK.logger.info _('This module is not compatible with PDK, so PDK can not validate or test this build. ' \
59
- 'Unvalidated modules may have errors when uploading to the Forge. ' \
60
- 'To make this module PDK compatible and use validate features, cancel the build and run `pdk convert`.')
54
+ PDK.logger.info 'This module is not compatible with PDK, so PDK can not validate or test this build. ' \
55
+ 'Unvalidated modules may have errors when uploading to the Forge. ' \
56
+ 'To make this module PDK compatible and use validate features, cancel the build and run `pdk convert`.'
61
57
 
62
- unless PDK::CLI::Util.prompt_for_yes(_('Continue build without converting?'))
63
- PDK.logger.info _('Build cancelled; exiting.')
58
+ unless PDK::CLI::Util.prompt_for_yes('Continue build without converting?')
59
+ PDK.logger.info 'Build cancelled; exiting.'
64
60
  exit 0
65
61
  end
66
62
  end
67
63
  end
68
64
 
69
- PDK.logger.info _('Building %{module_name} version %{module_version}') % {
65
+ PDK.logger.info 'Building %{module_name} version %{module_version}' % {
70
66
  module_name: module_metadata.data['name'],
71
67
  module_version: module_metadata.data['version'],
72
68
  }
73
69
 
74
70
  builder.build
75
71
 
76
- PDK.logger.info _('Build of %{package_name} has completed successfully. Built package can be found here: %{package_path}') % {
72
+ PDK.logger.info 'Build of %{package_name} has completed successfully. Built package can be found here: %{package_path}' % {
77
73
  package_name: module_metadata.data['name'],
78
74
  package_path: builder.package_file,
79
75
  }
@@ -1,13 +1,12 @@
1
1
  module PDK::CLI
2
2
  @bundle_cmd = @base_cmd.define_command do
3
3
  name 'bundle'
4
- usage _('bundle [bundler_options]')
5
- summary _('(Experimental) Command pass-through to bundler')
6
- description _(<<-EOF
4
+ usage 'bundle [bundler_options]'
5
+ summary '(Experimental) Command pass-through to bundler'
6
+ description <<-EOF
7
7
  [experimental] For advanced users, pdk bundle runs arbitrary commands in the bundler environment that pdk manages.
8
8
  Careless use of this command can lead to errors that pdk can't help recover from.
9
9
  EOF
10
- )
11
10
  skip_option_parsing
12
11
 
13
12
  run do |_opts, args, _cmd|
@@ -15,7 +14,7 @@ EOF
15
14
  require 'pdk/util/bundler'
16
15
 
17
16
  PDK::CLI::Util.ensure_in_module!(
18
- message: _('`pdk bundle` can only be run from inside a valid module directory.'),
17
+ message: '`pdk bundle` can only be run from inside a valid module directory.',
19
18
  )
20
19
 
21
20
  PDK::CLI::Util.validate_puppet_version_opts({})
@@ -1,26 +1,26 @@
1
1
  module PDK::CLI
2
2
  @config_get_cmd = @config_cmd.define_command do
3
3
  name 'get'
4
- usage _('config get [name]')
5
- summary _('(Deprecated) Retrieve the configuration for <name>. If not specified, retrieve all configuration settings')
4
+ usage 'config get [name]'
5
+ summary '(Deprecated) Retrieve the configuration for <name>. If not specified, retrieve all configuration settings'
6
6
 
7
7
  run do |_opts, args, _cmd|
8
- PDK.logger.warn _('The \'pdk config get\' command is deprecated, please use \'pdk get config\' instead.')
8
+ PDK.logger.warn 'The \'pdk config get\' command is deprecated, please use \'pdk get config\' instead.'
9
9
 
10
10
  item_name = args[0]
11
11
  resolved_config = PDK.config.resolve(item_name)
12
12
  # If the user wanted to know a setting but it doesn't exist, raise an error
13
13
  if resolved_config.empty? && !item_name.nil?
14
- PDK.logger.error(_("Configuration item '%{name}' does not exist") % { name: item_name })
14
+ PDK.logger.error("Configuration item '%{name}' does not exist" % { name: item_name })
15
15
  exit 1
16
16
  end
17
17
  # If the user requested a setting and it's the only one resolved, then just output the value
18
18
  if resolved_config.count == 1 && resolved_config.keys[0] == item_name
19
- puts _('%{value}') % { value: resolved_config.values[0] }
19
+ puts '%{value}' % { value: resolved_config.values[0] }
20
20
  exit 0
21
21
  end
22
22
  # Otherwise just output everything
23
- resolved_config.keys.sort.each { |key| puts _('%{name}=%{value}') % { name: key, value: resolved_config[key] } }
23
+ resolved_config.keys.sort.each { |key| puts '%{name}=%{value}' % { name: key, value: resolved_config[key] } }
24
24
  end
25
25
  end
26
26
  end
@@ -1,12 +1,12 @@
1
1
  module PDK::CLI
2
2
  @config_cmd = @base_cmd.define_command do
3
3
  name 'config'
4
- usage _('config [subcommand] [options]')
5
- summary _('(Deprecated) Configure the Puppet Development Kit.')
4
+ usage 'config [subcommand] [options]'
5
+ summary '(Deprecated) Configure the Puppet Development Kit.'
6
6
  default_subcommand 'help'
7
7
 
8
8
  run do |_opts, args, _cmd|
9
- PDK.logger.warn _('The \'pdk config\' command is deprecated, please use \'pdk get config\' and \'pdk set config\' instead.')
9
+ PDK.logger.warn 'The \'pdk config\' command is deprecated, please use \'pdk get config\' and \'pdk set config\' instead.'
10
10
 
11
11
  if args == ['help']
12
12
  PDK::CLI.run(%w[config --help])
@@ -1,16 +1,16 @@
1
1
  module PDK::CLI
2
2
  @console_cmd = @base_cmd.define_command do
3
3
  name 'console'
4
- usage _('console [console_options]')
5
- summary _('(Experimental) Start a session of the puppet debugger console.')
4
+ usage 'console [console_options]'
5
+ summary '(Experimental) Start a session of the puppet debugger console.'
6
6
  default_subcommand 'help'
7
- description _(<<-EOF
7
+ description <<-EOF
8
8
  The pdk console runs a interactive session of the puppet debugger tool to test out snippets of code, run
9
9
  language evaluations, datatype prototyping and much more. A virtual playground for your puppet code!
10
10
  For usage details see the puppet debugger docs at https://docs.puppet-debugger.com.
11
11
 
12
12
  EOF
13
- )
13
+
14
14
  PDK::CLI.puppet_version_options(self)
15
15
  PDK::CLI.puppet_dev_option(self)
16
16
  # we have to skip option parsing because it is expected the user
@@ -23,7 +23,7 @@ EOF
23
23
  require 'pdk/util'
24
24
 
25
25
  PDK::CLI::Util.ensure_in_module!(
26
- message: _('Console can only be run from inside a valid module directory'),
26
+ message: 'Console can only be run from inside a valid module directory',
27
27
  log_level: :fatal,
28
28
  )
29
29
 
@@ -78,7 +78,7 @@ EOF
78
78
  lock_file = ::Bundler::LockfileParser.new(::Bundler.read_file(lock_file_path))
79
79
  !lock_file.specs.find { |spec| spec.name.eql?(gem_name) }.nil?
80
80
  rescue ::Bundler::GemfileNotFound => e
81
- PDK.logger.debug _(e.message)
81
+ PDK.logger.debug e.message
82
82
  false
83
83
  end
84
84
 
@@ -86,7 +86,7 @@ EOF
86
86
  existing_path = base_module_path.split(':').find do |path|
87
87
  PDK::Util::Filesystem.directory?(path) && Dir.entries(path).length > 2
88
88
  end
89
- PDK.logger.warn _('Module fixtures not found, please run pdk bundle exec rake spec_prep.') unless existing_path
89
+ PDK.logger.warn 'Module fixtures not found, please run pdk bundle exec rake spec_prep.' unless existing_path
90
90
  end
91
91
 
92
92
  # @return [Array] - array of split options [{:"puppet-version"=>"6.9.0"}, ['--loglevel=debug']]
@@ -1,32 +1,32 @@
1
1
  module PDK::CLI
2
2
  @convert_cmd = @base_cmd.define_command do
3
3
  name 'convert'
4
- usage _('convert [options]')
5
- summary _('Convert an existing module to be compatible with the PDK.')
4
+ usage 'convert [options]'
5
+ summary 'Convert an existing module to be compatible with the PDK.'
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
- flag nil, :noop, _('Do not convert the module, just output what would be done.')
12
- flag nil, :force, _('Convert the module automatically, with no prompts.')
13
- flag nil, :'add-tests', _('Add any missing tests while converting the module.')
14
- flag nil, :'default-template', _('Convert the module to use the default PDK template.')
11
+ flag nil, :noop, 'Do not convert the module, just output what would be done.'
12
+ flag nil, :force, 'Convert the module automatically, with no prompts.'
13
+ flag nil, :'add-tests', 'Add any missing tests while converting the module.'
14
+ flag nil, :'default-template', 'Convert the module to use the default PDK template.'
15
15
 
16
16
  run do |opts, _args, _cmd|
17
17
  # Write the context information to the debug log
18
18
  PDK.context.to_debug_log
19
19
 
20
20
  unless PDK.context.is_a?(PDK::Context::Module)
21
- raise PDK::CLI::ExitWithError, _('`pdk convert` can only be run from inside a valid module directory.')
21
+ raise PDK::CLI::ExitWithError, '`pdk convert` can only be run from inside a valid module directory.'
22
22
  end
23
23
 
24
24
  if opts[:noop] && opts[:force]
25
- raise PDK::CLI::ExitWithError, _('You can not specify --noop and --force when converting a module')
25
+ raise PDK::CLI::ExitWithError, 'You can not specify --noop and --force when converting a module'
26
26
  end
27
27
 
28
28
  if opts[:'default-template']
29
- raise PDK::CLI::ExitWithError, _('You can not specify --template-url and --default-template.') if opts[:'template-url']
29
+ raise PDK::CLI::ExitWithError, 'You can not specify --template-url and --default-template.' if opts[:'template-url']
30
30
 
31
31
  opts[:'template-url'] = PDK::Util::TemplateURI.default_template_addressable_uri.to_s
32
32
  PDK.config.set(%w[user module_defaults template-url], nil)
@@ -37,12 +37,12 @@ module PDK::CLI
37
37
  PDK::CLI::Util.analytics_screen_view('convert', opts)
38
38
 
39
39
  if opts[:'skip-interview'] && opts[:'full-interview']
40
- PDK.logger.info _('Ignoring --full-interview and continuing with --skip-interview.')
40
+ PDK.logger.info 'Ignoring --full-interview and continuing with --skip-interview.'
41
41
  opts[:'full-interview'] = false
42
42
  end
43
43
 
44
44
  if opts[:force] && opts[:'full-interview']
45
- PDK.logger.info _('Ignoring --full-interview and continuing with --force.')
45
+ PDK.logger.info 'Ignoring --full-interview and continuing with --force.'
46
46
  opts[:'full-interview'] = false
47
47
  end
48
48
 
data/lib/pdk/cli/env.rb CHANGED
@@ -1,12 +1,11 @@
1
1
  module PDK::CLI
2
2
  @env_cmd = @base_cmd.define_command do
3
3
  name 'env'
4
- usage _('env')
5
- summary _('(Experimental) Output environment variables for specific Puppet context')
6
- description _(<<-EOF
4
+ usage 'env'
5
+ summary '(Experimental) Output environment variables for specific Puppet context'
6
+ description <<-EOF
7
7
  [experimental] Aids in setting a CLI context for a specified version of Puppet by outputting export commands for necessary environment variables.
8
8
  EOF
9
- )
10
9
 
11
10
  PDK::CLI.puppet_version_options(self)
12
11
  PDK::CLI.puppet_dev_option(self)
@@ -5,7 +5,7 @@ module PDK
5
5
  class FatalError < StandardError
6
6
  attr_reader :exit_code
7
7
 
8
- def initialize(msg = _('An unexpected error has occurred. Try running the command again with --debug'), opts = {})
8
+ def initialize(msg = 'An unexpected error has occurred. Try running the command again with --debug', opts = {})
9
9
  @exit_code = opts.fetch(:exit_code, 1)
10
10
  super(msg)
11
11
  end
@@ -57,7 +57,7 @@ module PDK
57
57
 
58
58
  def context=(new_context)
59
59
  unless [:system, :module, :pwd].include?(new_context)
60
- raise ArgumentError, _("Expected execution context to be :system or :module but got '%{context}'.") % { context: new_context }
60
+ raise ArgumentError, "Expected execution context to be :system or :module but got '%{context}'." % { context: new_context }
61
61
  end
62
62
 
63
63
  @context = new_context
@@ -108,7 +108,7 @@ module PDK
108
108
  unless mod_root
109
109
  @spinner.error if @spinner
110
110
 
111
- raise PDK::CLI::FatalError, _('Current working directory is not part of a module. (No metadata.json was found.)')
111
+ raise PDK::CLI::FatalError, 'Current working directory is not part of a module. (No metadata.json was found.)'
112
112
  end
113
113
 
114
114
  if Dir.pwd == mod_root || context == :pwd
@@ -135,10 +135,10 @@ module PDK
135
135
  duration: @duration,
136
136
  }
137
137
 
138
- PDK.logger.debug _('STDOUT: %{output}') % {
138
+ PDK.logger.debug 'STDOUT: %{output}' % {
139
139
  output: process_data[:stdout].empty? ? 'N/A' : "\n#{process_data[:stdout]}",
140
140
  }
141
- PDK.logger.debug _('STDERR: %{output}') % {
141
+ PDK.logger.debug 'STDERR: %{output}' % {
142
142
  output: process_data[:stderr].empty? ? 'N/A' : "\n#{process_data[:stderr]}",
143
143
  }
144
144
 
@@ -152,16 +152,14 @@ module PDK
152
152
 
153
153
  def warn_on_legacy_env_vars!
154
154
  if PDK::Util::Env['PUPPET_GEM_VERSION']
155
- PDK.logger.warn_once _(
156
- 'PUPPET_GEM_VERSION is not supported by PDK. ' \
157
- 'Use the --puppet-version option on your PDK command ' \
158
- 'or set the PDK_PUPPET_VERSION environment variable instead',
159
- )
155
+ PDK.logger.warn_once 'PUPPET_GEM_VERSION is not supported by PDK. ' \
156
+ 'Use the --puppet-version option on your PDK command ' \
157
+ 'or set the PDK_PUPPET_VERSION environment variable instead'
160
158
  end
161
159
 
162
160
  %w[FACTER HIERA].each do |gem|
163
161
  if PDK::Util::Env["#{gem}_GEM_VERSION"]
164
- PDK.logger.warn_once _('%{varname} is not supported by PDK.') % { varname: "#{gem}_GEM_VERSION" }
162
+ PDK.logger.warn_once '%{varname} is not supported by PDK.' % { varname: "#{gem}_GEM_VERSION" }
165
163
  end
166
164
  end
167
165
  end
@@ -232,10 +230,10 @@ module PDK
232
230
  def run_process!
233
231
  command_string = argv.join(' ')
234
232
 
235
- PDK.logger.debug(_("Executing '%{command}'") % { command: command_string })
233
+ PDK.logger.debug("Executing '%{command}'" % { command: command_string })
236
234
 
237
235
  if context == :module
238
- PDK.logger.debug(_('Command environment:'))
236
+ PDK.logger.debug('Command environment:')
239
237
  @process.environment.each do |var, val|
240
238
  PDK.logger.debug(" #{var}: #{val}")
241
239
  end
@@ -246,7 +244,7 @@ module PDK
246
244
  begin
247
245
  @process.start
248
246
  rescue ChildProcess::LaunchError => e
249
- raise PDK::CLI::FatalError, _("Failed to execute '%{command}': %{message}") % { command: command_string, message: e.message }
247
+ raise PDK::CLI::FatalError, "Failed to execute '%{command}': %{message}" % { command: command_string, message: e.message }
250
248
  end
251
249
 
252
250
  if timeout
@@ -262,7 +260,7 @@ module PDK
262
260
 
263
261
  @duration = Time.now - start_time
264
262
 
265
- PDK.logger.debug(_("Execution of '%{command}' complete (duration: %{duration_in_seconds}s; exit code: %{exit_code})") %
263
+ PDK.logger.debug("Execution of '%{command}' complete (duration: %{duration_in_seconds}s; exit code: %{exit_code})" %
266
264
  { command: command_string, duration_in_seconds: @duration, exit_code: @process.exit_code })
267
265
  end
268
266
 
@@ -15,23 +15,23 @@ module PDK
15
15
  end
16
16
 
17
17
  def register_spinner(_spinner, _opts = {})
18
- raise _('This method is not implemented for PDK::CLI::Exec::InteractiveCommand')
18
+ raise 'This method is not implemented for PDK::CLI::Exec::InteractiveCommand'
19
19
  end
20
20
 
21
21
  def add_spinner(_message, _opts = {})
22
- raise _('This method is not implemented for PDK::CLI::Exec::InteractiveCommand')
22
+ raise 'This method is not implemented for PDK::CLI::Exec::InteractiveCommand'
23
23
  end
24
24
 
25
25
  def timeout
26
- raise _('This method is not implemented for PDK::CLI::Exec::InteractiveCommand')
26
+ raise 'This method is not implemented for PDK::CLI::Exec::InteractiveCommand'
27
27
  end
28
28
 
29
29
  def timeout=(_val)
30
- raise _('This method is not implemented for PDK::CLI::Exec::InteractiveCommand')
30
+ raise 'This method is not implemented for PDK::CLI::Exec::InteractiveCommand'
31
31
  end
32
32
 
33
33
  def exec_group=(_val)
34
- raise _('This method is not implemented for PDK::CLI::Exec::InteractiveCommand')
34
+ raise 'This method is not implemented for PDK::CLI::Exec::InteractiveCommand'
35
35
  end
36
36
 
37
37
  def execute!
@@ -43,7 +43,7 @@ module PDK
43
43
  mod_root = PDK::Util.module_root
44
44
 
45
45
  unless mod_root
46
- raise PDK::CLI::FatalError, _('Current working directory is not part of a module. (No metadata.json was found.)')
46
+ raise PDK::CLI::FatalError, 'Current working directory is not part of a module. (No metadata.json was found.)'
47
47
  end
48
48
 
49
49
  unless context == :pwd || Dir.pwd == mod_root
@@ -72,10 +72,10 @@ module PDK
72
72
  # TODO: debug logging
73
73
  def run_process!
74
74
  command_string = argv.join(' ')
75
- PDK.logger.debug(_("Executing '%{command}' interactively") % { command: command_string })
75
+ PDK.logger.debug("Executing '%{command}' interactively" % { command: command_string })
76
76
 
77
77
  if context == :module
78
- PDK.logger.debug(_('Command environment:'))
78
+ PDK.logger.debug('Command environment:')
79
79
  @resolved_env.each do |var, val|
80
80
  PDK.logger.debug(" #{var}: #{val}")
81
81
  end
@@ -88,8 +88,8 @@ module PDK
88
88
  exit_code = child_status.exitstatus
89
89
  duration = Time.now - start_time
90
90
 
91
- PDK.logger.debug(_("Execution of '%{command}' complete (duration: \
92
- %{duration_in_seconds}s; exit code: %{exit_code})") %
91
+ PDK.logger.debug("Execution of '%{command}' complete (duration: \
92
+ %{duration_in_seconds}s; exit code: %{exit_code})" %
93
93
  {
94
94
  command: command_string,
95
95
  exit_code: exit_code,
@@ -106,7 +106,7 @@ module PDK
106
106
  end
107
107
 
108
108
  def stop_spinner
109
- raise _('This method is not implemented for PDK::CLI::Exec::InteractiveCommand')
109
+ raise 'This method is not implemented for PDK::CLI::Exec::InteractiveCommand'
110
110
  end
111
111
  end
112
112
  end
data/lib/pdk/cli/exec.rb CHANGED
@@ -33,7 +33,7 @@ module PDK
33
33
  def self.ensure_bin_present!(bin_path, bin_name)
34
34
  require 'tty-which'
35
35
 
36
- message = _('Unable to find `%{name}`. Check that it is installed and try again.') % {
36
+ message = 'Unable to find `%{name}`. Check that it is installed and try again.' % {
37
37
  name: bin_name,
38
38
  }
39
39
 
@@ -59,7 +59,7 @@ module PDK
59
59
  require 'pdk/util'
60
60
 
61
61
  unless PDK::Util.package_install?
62
- PDK.logger.debug(_("PDK package installation not found. Trying '%{fallback}' from the system PATH instead.") % {
62
+ PDK.logger.debug("PDK package installation not found. Trying '%{fallback}' from the system PATH instead." % {
63
63
  fallback: fallback,
64
64
  })
65
65
  return fallback
@@ -69,14 +69,14 @@ module PDK
69
69
 
70
70
  require 'pdk/util/filesystem'
71
71
  unless PDK::Util::Filesystem.exist?(vendored_bin_full_path)
72
- PDK.logger.debug(_("Could not find '%{vendored_bin}' in PDK package. Trying '%{fallback}' from the system PATH instead.") % {
72
+ PDK.logger.debug("Could not find '%{vendored_bin}' in PDK package. Trying '%{fallback}' from the system PATH instead." % {
73
73
  fallback: fallback,
74
74
  vendored_bin: vendored_bin_full_path,
75
75
  })
76
76
  return fallback
77
77
  end
78
78
 
79
- PDK.logger.debug(_("Using '%{vendored_bin}' from PDK package.") % { vendored_bin: vendored_bin_full_path })
79
+ PDK.logger.debug "Using '%{vendored_bin}' from PDK package." % { vendored_bin: vendored_bin_full_path }
80
80
  vendored_bin_full_path
81
81
  end
82
82
  end
@@ -38,7 +38,7 @@ module PDK
38
38
  #
39
39
  # @api private
40
40
  def register(&_block)
41
- raise PDK::CLI::FatalError, _('No block registered') unless block_given?
41
+ raise PDK::CLI::FatalError, 'No block registered' unless block_given?
42
42
  end
43
43
 
44
44
  # The return code of running all registered blocks
@@ -88,8 +88,6 @@ module PDK
88
88
  # and only starts on the call to exit_code
89
89
  # e.g. max_threads = No. of CPUs
90
90
  @threads << Thread.new do
91
- GettextSetup.initialize(File.absolute_path('../../../locales', File.dirname(__FILE__)))
92
- GettextSetup.negotiate_locale!(GettextSetup.candidate_locales)
93
91
  @exit_codes << yield
94
92
  end
95
93
  end
@@ -1,24 +1,24 @@
1
1
  module PDK::CLI
2
2
  @get_config_cmd = @get_cmd.define_command do
3
3
  name 'config'
4
- usage _('config [name]')
5
- summary _('Retrieve the configuration for <name>. If not specified, retrieve all configuration settings')
4
+ usage 'config [name]'
5
+ summary 'Retrieve the configuration for <name>. If not specified, retrieve all configuration settings'
6
6
 
7
7
  run do |_opts, args, _cmd|
8
8
  item_name = args[0]
9
9
  resolved_config = PDK.config.resolve(item_name)
10
10
  # If the user wanted to know a setting but it doesn't exist, raise an error
11
11
  if resolved_config.empty? && !item_name.nil?
12
- PDK.logger.error(_("Configuration item '%{name}' does not exist") % { name: item_name })
12
+ PDK.logger.error("Configuration item '%{name}' does not exist" % { name: item_name })
13
13
  exit 1
14
14
  end
15
15
  # If the user requested a setting and it's the only one resolved, then just output the value
16
16
  if resolved_config.count == 1 && resolved_config.keys[0] == item_name
17
- puts _('%{value}') % { value: resolved_config.values[0] }
17
+ puts '%{value}' % { value: resolved_config.values[0] }
18
18
  exit 0
19
19
  end
20
20
  # Otherwise just output everything
21
- resolved_config.keys.sort.each { |key| puts _('%{name}=%{value}') % { name: key, value: resolved_config[key] } }
21
+ resolved_config.keys.sort.each { |key| puts '%{name}=%{value}' % { name: key, value: resolved_config[key] } }
22
22
  end
23
23
  end
24
24
  end
data/lib/pdk/cli/get.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module PDK::CLI
2
2
  @get_cmd = @base_cmd.define_command do
3
3
  name 'get'
4
- usage _('get [subcommand] [options]')
5
- summary _('Retrieve information about the PDK or current project.')
4
+ usage 'get [subcommand] [options]'
5
+ summary 'Retrieve information about the PDK or current project.'
6
6
  default_subcommand 'help'
7
7
 
8
8
  run do |_opts, args, _cmd|
@@ -1,11 +1,11 @@
1
1
  module PDK::CLI
2
2
  @module_build_cmd = @module_cmd.define_command do
3
3
  name 'build'
4
- usage _('build')
5
- summary _('This command is now \'pdk build\'.')
4
+ usage 'build'
5
+ summary 'This command is now \'pdk build\'.'
6
6
 
7
7
  run do |_opts, _args, _cmd|
8
- PDK.logger.warn(_("Modules are built using the 'pdk build' command."))
8
+ PDK.logger.warn("Modules are built using the 'pdk build' command.")
9
9
  exit 1
10
10
  end
11
11
  end