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
@@ -7,15 +7,13 @@ module PDK
7
7
  require 'pdk/cli/util/option_validator'
8
8
 
9
9
  unless PDK::CLI::Util::OptionValidator.valid_module_name?(opts[:module_name])
10
- error_msg = _(
11
- "'%{module_name}' is not a valid module name.\n" \
12
- 'Module names must begin with a lowercase letter and can only include lowercase letters, digits, and underscores.',
13
- ) % { module_name: opts[:module_name] }
10
+ error_msg = "'%{module_name}' is not a valid module name.\n" \
11
+ 'Module names must begin with a lowercase letter and can only include lowercase letters, digits, and underscores.' % { module_name: opts[:module_name] }
14
12
  raise PDK::CLI::ExitWithError, error_msg
15
13
  end
16
14
 
17
15
  target_dir = PDK::Util::Filesystem.expand_path(opts[:target_dir])
18
- raise PDK::CLI::ExitWithError, _("The destination directory '%{dir}' already exists") % { dir: target_dir } if PDK::Util::Filesystem.exist?(target_dir)
16
+ raise PDK::CLI::ExitWithError, "The destination directory '%{dir}' already exists" % { dir: target_dir } if PDK::Util::Filesystem.exist?(target_dir)
19
17
  end
20
18
 
21
19
  def self.invoke(opts = {})
@@ -35,7 +33,7 @@ module PDK
35
33
  PDK::Util::Filesystem.write_file(test_file, 'This file was created by the Puppet Development Kit to test if this folder was writable, you can safely remove this file.')
36
34
  PDK::Util::Filesystem.rm_f(test_file)
37
35
  rescue Errno::EACCES
38
- raise PDK::CLI::FatalError, _("You do not have permission to write to '%{parent_dir}'") % {
36
+ raise PDK::CLI::FatalError, "You do not have permission to write to '%{parent_dir}'" % {
39
37
  parent_dir: parent_dir,
40
38
  }
41
39
  end
@@ -47,14 +45,12 @@ module PDK
47
45
  template_uri = PDK::Util::TemplateURI.new(opts)
48
46
 
49
47
  if template_uri.default? && template_uri.default_ref?
50
- PDK.logger.info _('Using the default template-url and template-ref.')
48
+ PDK.logger.info 'Using the default template-url and template-ref.'
51
49
  else
52
- PDK.logger.info _(
53
- "Using the %{method} template-url and template-ref '%{template_uri}'." % {
54
- method: opts.key?(:'template-url') ? _('specified') : _('saved'),
50
+ PDK.logger.info "Using the %{method} template-url and template-ref '%{template_uri}'." % {
51
+ method: opts.key?(:'template-url') ? 'specified' : 'saved',
55
52
  template_uri: template_uri.metadata_format,
56
- },
57
- )
53
+ }
58
54
  end
59
55
 
60
56
  begin
@@ -99,16 +95,14 @@ module PDK
99
95
  end
100
96
  end
101
97
 
102
- PDK.logger.info _("Module '%{name}' generated at path '%{path}'.") % {
98
+ PDK.logger.info "Module '%{name}' generated at path '%{path}'." % {
103
99
  name: opts[:module_name],
104
100
  path: target_dir,
105
101
  }
106
- PDK.logger.info _(
107
- "In your module directory, add classes with the 'pdk new class' command.",
108
- )
102
+ PDK.logger.info "In your module directory, add classes with the 'pdk new class' command."
109
103
  end
110
104
  rescue Errno::EACCES => e
111
- raise PDK::CLI::FatalError, _("Failed to move '%{source}' to '%{target}': %{message}") % {
105
+ raise PDK::CLI::FatalError, "Failed to move '%{source}' to '%{target}': %{message}" % {
112
106
  source: temp_target_dir,
113
107
  target: target_dir,
114
108
  message: e.message,
@@ -124,7 +118,7 @@ module PDK
124
118
  login_clean = 'username' if login_clean.empty?
125
119
 
126
120
  if login_clean != login
127
- PDK.logger.debug _('Your username is not a valid Forge username. Proceeding with the username %{username}. You can fix this later in metadata.json.') % {
121
+ PDK.logger.debug 'Your username is not a valid Forge username. Proceeding with the username %{username}. You can fix this later in metadata.json.' % {
128
122
  username: login_clean,
129
123
  }
130
124
  end
@@ -162,7 +156,7 @@ module PDK
162
156
  begin
163
157
  PDK::Util::Filesystem.mkdir_p(dir)
164
158
  rescue SystemCallError => e
165
- raise PDK::CLI::FatalError, _("Unable to create directory '%{dir}': %{message}") % {
159
+ raise PDK::CLI::FatalError, "Unable to create directory '%{dir}': %{message}" % {
166
160
  dir: dir,
167
161
  message: e.message,
168
162
  }
@@ -177,49 +171,49 @@ module PDK
177
171
  questions = [
178
172
  {
179
173
  name: 'module_name',
180
- question: _('If you have a name for your module, add it here.'),
181
- help: _('This is the name that will be associated with your module, it should be relevant to the modules content.'),
174
+ question: 'If you have a name for your module, add it here.',
175
+ help: 'This is the name that will be associated with your module, it should be relevant to the modules content.',
182
176
  required: true,
183
177
  validate_pattern: %r{\A[a-z][a-z0-9_]*\Z}i,
184
- validate_message: _('Module names must begin with a lowercase letter and can only include lowercase letters, numbers, and underscores.'),
178
+ validate_message: 'Module names must begin with a lowercase letter and can only include lowercase letters, numbers, and underscores.',
185
179
  },
186
180
  {
187
181
  name: 'forge_username',
188
- question: _('If you have a Puppet Forge username, add it here.'),
189
- help: _('We can use this to upload your module to the Forge when it\'s complete.'),
182
+ question: 'If you have a Puppet Forge username, add it here.',
183
+ help: 'We can use this to upload your module to the Forge when it\'s complete.',
190
184
  required: true,
191
185
  validate_pattern: %r{\A[a-z0-9]+\Z}i,
192
- validate_message: _('Forge usernames can only contain lowercase letters and numbers'),
186
+ validate_message: 'Forge usernames can only contain lowercase letters and numbers',
193
187
  default: opts[:username],
194
188
  },
195
189
  {
196
190
  name: 'version',
197
- question: _('What version is this module?'),
198
- help: _('Puppet uses Semantic Versioning (semver.org) to version modules.'),
191
+ question: 'What version is this module?',
192
+ help: 'Puppet uses Semantic Versioning (semver.org) to version modules.',
199
193
  required: true,
200
- validate_pattern: %r{\A[0-9]+\.[0-9]+\.[0-9]+},
201
- validate_message: _('Semantic Version numbers must be in the form MAJOR.MINOR.PATCH'),
194
+ validate_pattern: %r{\A[0-9]+\.[0-9]+\.[0-9]+}i,
195
+ validate_message: 'Semantic Version numbers must be in the form MAJOR.MINOR.PATCH',
202
196
  default: metadata.data['version'],
203
197
  forge_only: true,
204
198
  },
205
199
  {
206
200
  name: 'author',
207
- question: _('Who wrote this module?'),
208
- help: _('This is used to credit the module\'s author.'),
201
+ question: 'Who wrote this module?',
202
+ help: 'This is used to credit the module\'s author.',
209
203
  required: true,
210
204
  default: metadata.data['author'],
211
205
  },
212
206
  {
213
207
  name: 'license',
214
- question: _('What license does this module code fall under?'),
215
- help: _('This should be an identifier from https://spdx.org/licenses/. Common values are "Apache-2.0", "MIT", or "proprietary".'),
208
+ question: 'What license does this module code fall under?',
209
+ help: 'This should be an identifier from https://spdx.org/licenses/. Common values are "Apache-2.0", "MIT", or "proprietary".',
216
210
  required: true,
217
211
  default: metadata.data['license'],
218
212
  },
219
213
  {
220
214
  name: 'operatingsystem_support',
221
- question: _('What operating systems does this module support?'),
222
- help: _('Use the up and down keys to move between the choices, space to select and enter to continue.'),
215
+ question: 'What operating systems does this module support?',
216
+ help: 'Use the up and down keys to move between the choices, space to select and enter to continue.',
223
217
  required: true,
224
218
  type: :multi_select,
225
219
  choices: PDK::Module::Metadata::OPERATING_SYSTEMS,
@@ -230,31 +224,31 @@ module PDK
230
224
  },
231
225
  {
232
226
  name: 'summary',
233
- question: _('Summarize the purpose of this module in a single sentence.'),
234
- help: _('This helps other Puppet users understand what the module does.'),
227
+ question: 'Summarize the purpose of this module in a single sentence.',
228
+ help: 'This helps other Puppet users understand what the module does.',
235
229
  required: true,
236
230
  default: metadata.data['summary'],
237
231
  forge_only: true,
238
232
  },
239
233
  {
240
234
  name: 'source',
241
- question: _('If there is a source code repository for this module, enter the URL here.'),
242
- help: _('Skip this if no repository exists yet. You can update this later in the metadata.json.'),
235
+ question: 'If there is a source code repository for this module, enter the URL here.',
236
+ help: 'Skip this if no repository exists yet. You can update this later in the metadata.json.',
243
237
  required: true,
244
238
  default: metadata.data['source'],
245
239
  forge_only: true,
246
240
  },
247
241
  {
248
242
  name: 'project_page',
249
- question: _('If there is a URL where others can learn more about this module, enter it here.'),
250
- help: _('Optional. You can update this later in the metadata.json.'),
243
+ question: 'If there is a URL where others can learn more about this module, enter it here.',
244
+ help: 'Optional. You can update this later in the metadata.json.',
251
245
  default: metadata.data['project_page'],
252
246
  forge_only: true,
253
247
  },
254
248
  {
255
249
  name: 'issues_url',
256
- question: _('If there is a public issue tracker for this module, enter its URL here.'),
257
- help: _('Optional. You can update this later in the metadata.json.'),
250
+ question: 'If there is a public issue tracker for this module, enter its URL here.',
251
+ help: 'Optional. You can update this later in the metadata.json.',
258
252
  default: metadata.data['issues_url'],
259
253
  forge_only: true,
260
254
  },
@@ -281,31 +275,25 @@ module PDK
281
275
  interview.add_questions(questions)
282
276
 
283
277
  if PDK::Util::Filesystem.file?('metadata.json')
284
- puts _(
285
- "\nWe need to update the metadata.json file for this module, so we\'re going to ask you %{count} " \
286
- "questions.\n",
287
- ) % {
288
- count: interview.num_questions,
289
- }
278
+ puts "\nWe need to update the metadata.json file for this module, so we\'re going to ask you %{count} " \
279
+ "questions.\n" % {
280
+ count: interview.num_questions,
281
+ }
290
282
  else
291
- puts _(
292
- "\nWe need to create the metadata.json file for this module, so we\'re going to ask you %{count} " \
293
- "questions.\n",
294
- ) % {
295
- count: interview.num_questions,
296
- }
283
+ puts "\nWe need to create the metadata.json file for this module, so we\'re going to ask you %{count} " \
284
+ "questions.\n" % {
285
+ count: interview.num_questions,
286
+ }
297
287
  end
298
288
 
299
- puts _(
300
- 'If the question is not applicable to this module, accept the default option ' \
301
- 'shown after each question. You can modify any answers at any time by manually updating ' \
302
- "the metadata.json file.\n\n",
303
- )
289
+ puts 'If the question is not applicable to this module, accept the default option ' \
290
+ 'shown after each question. You can modify any answers at any time by manually updating ' \
291
+ "the metadata.json file.\n\n"
304
292
 
305
293
  answers = interview.run
306
294
 
307
295
  if answers.nil?
308
- PDK.logger.info _('No answers given, interview cancelled.')
296
+ PDK.logger.info 'No answers given, interview cancelled.'
309
297
  exit 0
310
298
  end
311
299
 
@@ -331,13 +319,13 @@ module PDK
331
319
  require 'pdk/cli/util'
332
320
 
333
321
  continue = PDK::CLI::Util.prompt_for_yes(
334
- _('Metadata will be generated based on this information, continue?'),
322
+ 'Metadata will be generated based on this information, continue?',
335
323
  prompt: prompt,
336
- cancel_message: _('Interview cancelled; exiting.'),
324
+ cancel_message: 'Interview cancelled; exiting.',
337
325
  )
338
326
 
339
327
  unless continue
340
- PDK.logger.info _('Process cancelled; exiting.')
328
+ PDK.logger.info 'Process cancelled; exiting.'
341
329
  exit 0
342
330
  end
343
331
  end
@@ -21,7 +21,7 @@ module PDK
21
21
  # @param object_name [String] The name of the object.
22
22
  # @param options [Hash{Symbol => Object}]
23
23
  def initialize(context, object_name, options)
24
- raise ArgumentError, _('Expected PDK::Context::AbstractContext but got \'%{klass}\' for context') % { klass: context.class } unless context.is_a?(PDK::Context::AbstractContext)
24
+ raise ArgumentError, 'Expected PDK::Context::AbstractContext but got \'%{klass}\' for context' % { klass: context.class } unless context.is_a?(PDK::Context::AbstractContext)
25
25
  @context = context
26
26
  @options = options
27
27
  @object_name = object_name
@@ -61,7 +61,7 @@ module PDK
61
61
  # @return [void]
62
62
  # @abstract
63
63
  def check_preconditions
64
- raise ArgumentError, _('Expected a module context but got %{context_name}') % { context_name: context.display_name } unless context.is_a?(PDK::Context::Module)
64
+ raise ArgumentError, 'Expected a module context but got %{context_name}' % { context_name: context.display_name } unless context.is_a?(PDK::Context::Module)
65
65
  end
66
66
 
67
67
  # Check the preconditions of this template group, behaving as a predicate rather than raising an exception.
@@ -122,7 +122,7 @@ module PDK
122
122
  def stage_change(relative_dest_path, content, update_manager)
123
123
  absolute_file_path = File.join(context.root_path, relative_dest_path)
124
124
  if PDK::Util::Filesystem.exist?(absolute_file_path)
125
- raise PDK::CLI::ExitWithError, _("Unable to generate %{object_type}; '%{file}' already exists.") % {
125
+ raise PDK::CLI::ExitWithError, "Unable to generate %{object_type}; '%{file}' already exists." % {
126
126
  file: absolute_file_path,
127
127
  object_type: spec_only? ? 'unit test' : friendly_name,
128
128
  }
@@ -160,7 +160,7 @@ module PDK
160
160
 
161
161
  templates.each do |template|
162
162
  if template[:uri].nil?
163
- PDK.logger.debug(_('No %{dir_type} template found; trying next template directory.') % { dir_type: template[:type] })
163
+ PDK.logger.debug('No %{dir_type} template found; trying next template directory.' % { dir_type: template[:type] })
164
164
  next
165
165
  end
166
166
 
@@ -170,9 +170,9 @@ module PDK
170
170
  # TODO: refactor to a search-and-execute form instead
171
171
  return # work is done # rubocop:disable Lint/NonLocalExitFromIterator
172
172
  elsif template[:allow_fallback]
173
- PDK.logger.debug(_('Unable to find a %{type} template in %{url}; trying next template directory.') % { type: friendly_name, url: template[:uri] })
173
+ PDK.logger.debug('Unable to find a %{type} template in %{url}; trying next template directory.' % { type: friendly_name, url: template[:uri] })
174
174
  else
175
- raise PDK::CLI::FatalError, _('Unable to find the %{type} template in %{url}.') % { type: friendly_name, url: template[:uri] }
175
+ raise PDK::CLI::FatalError, 'Unable to find the %{type} template in %{url}.' % { type: friendly_name, url: template[:uri] }
176
176
  end
177
177
  end
178
178
  end
@@ -28,7 +28,7 @@ module PDK
28
28
  def check_preconditions
29
29
  super
30
30
 
31
- error = _("A task named '%{name}' already exists in this module; defined in %{file}")
31
+ error = "A task named '%{name}' already exists in this module; defined in %{file}"
32
32
  allowed_extensions = %w[.md .conf]
33
33
 
34
34
  PDK::Util::Filesystem.glob(File.join(context.root_path, 'tasks', task_name + '.*')).each do |file|
@@ -126,10 +126,8 @@ module PDK
126
126
  PDK::Util::Filesystem.cp(path, dest_path, preserve: true)
127
127
  end
128
128
  rescue ArgumentError => e
129
- raise PDK::CLI::ExitWithError, _(
130
- '%{message} Rename the file or exclude it from the package ' \
131
- 'by adding it to the .pdkignore file in your module.',
132
- ) % { message: e.message }
129
+ raise PDK::CLI::ExitWithError, '%{message} Rename the file or exclude it from the package ' \
130
+ 'by adding it to the .pdkignore file in your module.' % { message: e.message }
133
131
  end
134
132
 
135
133
  # Check if the given path matches one of the patterns listed in the
@@ -156,7 +154,7 @@ module PDK
156
154
  symlink_path = Pathname.new(path)
157
155
  module_path = Pathname.new(module_dir)
158
156
 
159
- PDK.logger.warn _('Symlinks in modules are not supported and will not be included in the package. Please investigate symlink %{from} -> %{to}.') % {
157
+ PDK.logger.warn 'Symlinks in modules are not supported and will not be included in the package. Please investigate symlink %{from} -> %{to}.' % {
160
158
  from: symlink_path.relative_path_from(module_path),
161
159
  to: symlink_path.realpath.relative_path_from(module_path),
162
160
  }
@@ -183,7 +181,7 @@ module PDK
183
181
  # @return [nil]
184
182
  def validate_ustar_path!(path)
185
183
  if path.bytesize > 256
186
- raise ArgumentError, _("The path '%{path}' is longer than 256 bytes.") % {
184
+ raise ArgumentError, "The path '%{path}' is longer than 256 bytes." % {
187
185
  path: path,
188
186
  }
189
187
  end
@@ -207,11 +205,10 @@ module PDK
207
205
 
208
206
  return unless path.bytesize > 100 || prefix.bytesize > 155
209
207
 
210
- raise ArgumentError, _(
211
- "'%{path}' could not be split at a directory separator into two " \
212
- 'parts, the first having a maximum length of 155 bytes and the ' \
213
- 'second having a maximum length of 100 bytes.',
214
- ) % { path: path }
208
+ raise ArgumentError,
209
+ "'%{path}' could not be split at a directory separator into two " \
210
+ 'parts, the first having a maximum length of 155 bytes and the ' \
211
+ 'second having a maximum length of 100 bytes.' % { path: path }
215
212
  end
216
213
 
217
214
  # Checks if the path contains any non-ASCII characters.
@@ -229,10 +226,8 @@ module PDK
229
226
  def validate_path_encoding!(path)
230
227
  return unless path =~ %r{[^\x00-\x7F]}
231
228
 
232
- raise ArgumentError, _(
233
- "'%{path}' can only include ASCII characters in its path or " \
234
- 'filename in order to be compatible with a wide range of hosts.',
235
- ) % { path: path }
229
+ raise ArgumentError, "'%{path}' can only include ASCII characters in its path or " \
230
+ 'filename in order to be compatible with a wide range of hosts.' % { path: path }
236
231
  end
237
232
 
238
233
  # Creates a gzip compressed tarball of the build directory.
@@ -263,7 +258,7 @@ module PDK
263
258
  entry_meta[:mode] = orig_mode | min_mode
264
259
 
265
260
  if entry_meta[:mode] != orig_mode
266
- PDK.logger.debug(_('Updated permissions of packaged \'%{entry}\' to %{new_mode}') % {
261
+ PDK.logger.debug('Updated permissions of packaged \'%{entry}\' to %{new_mode}' % {
267
262
  entry: entry,
268
263
  new_mode: (entry_meta[:mode] & 0o7777).to_s(8),
269
264
  })
@@ -30,7 +30,7 @@ module PDK
30
30
  else
31
31
  require 'pdk/report'
32
32
 
33
- PDK::Report.default_target.puts(_('No changes required.'))
33
+ PDK::Report.default_target.puts('No changes required.')
34
34
  end
35
35
 
36
36
  return
@@ -45,12 +45,10 @@ module PDK
45
45
  unless force?
46
46
  require 'pdk/cli/util'
47
47
 
48
- PDK.logger.info _(
49
- 'Module conversion is a potentially destructive action. ' \
50
- 'Ensure that you have committed your module to a version control ' \
51
- 'system or have a backup, and review the changes above before continuing.',
52
- )
53
- continue = PDK::CLI::Util.prompt_for_yes(_('Do you want to continue and make these changes to your module?'))
48
+ PDK.logger.info 'Module conversion is a potentially destructive action. ' \
49
+ 'Ensure that you have committed your module to a version control ' \
50
+ 'system or have a backup, and review the changes above before continuing.'
51
+ continue = PDK::CLI::Util.prompt_for_yes('Do you want to continue and make these changes to your module?')
54
52
  return unless continue
55
53
  end
56
54
 
@@ -128,7 +126,7 @@ module PDK
128
126
  update_manager.sync_changes!
129
127
  print_summary
130
128
  else
131
- PDK::Report.default_target.puts(_('No test changes required.'))
129
+ PDK::Report.default_target.puts('No test changes required.')
132
130
  end
133
131
  end
134
132
 
@@ -155,7 +153,7 @@ module PDK
155
153
  absolute_file_path = File.join(module_dir, relative_file_path)
156
154
  case file_status
157
155
  when :unmanage
158
- PDK.logger.debug(_("skipping '%{path}'") % { path: absolute_file_path })
156
+ PDK.logger.debug("skipping '%{path}'" % { path: absolute_file_path })
159
157
  when :delete
160
158
  update_manager.remove_file(absolute_file_path)
161
159
  when :init
@@ -194,7 +192,7 @@ module PDK
194
192
 
195
193
  if PDK::Util::Filesystem.file?(metadata_path)
196
194
  unless PDK::Util::Filesystem.readable?(metadata_path)
197
- raise PDK::CLI::ExitWithError, _('Unable to update module metadata; %{path} exists but it is not readable.') % {
195
+ raise PDK::CLI::ExitWithError, 'Unable to update module metadata; %{path} exists but it is not readable.' % {
198
196
  path: metadata_path,
199
197
  }
200
198
  end
@@ -210,7 +208,7 @@ module PDK
210
208
  metadata = PDK::Generate::Module.prepare_metadata(options) unless options[:noop]
211
209
  end
212
210
  elsif PDK::Util::Filesystem.exist?(metadata_path)
213
- raise PDK::CLI::ExitWithError, _('Unable to update module metadata; %{path} exists but it is not a file.') % {
211
+ raise PDK::CLI::ExitWithError, 'Unable to update module metadata; %{path} exists but it is not a file.' % {
214
212
  path: metadata_path,
215
213
  }
216
214
  else
@@ -255,20 +253,20 @@ module PDK
255
253
  summary.keys.each do |category|
256
254
  next if summary[category].empty?
257
255
 
258
- PDK::Report.default_target.puts(_("\n%{banner}") % { banner: generate_banner("Files to be #{category}", 40) })
256
+ PDK::Report.default_target.puts("\n%{banner}" % { banner: generate_banner("Files to be #{category}", 40) })
259
257
  PDK::Report.default_target.puts(summary[category])
260
258
  footer = true
261
259
  end
262
260
 
263
- PDK::Report.default_target.puts(_("\n%{banner}") % { banner: generate_banner('', 40) }) if footer
261
+ PDK::Report.default_target.puts("\n%{banner}" % { banner: generate_banner('', 40) }) if footer
264
262
  end
265
263
 
266
264
  def print_result(banner_text)
267
265
  require 'pdk/report'
268
266
 
269
- PDK::Report.default_target.puts(_("\n%{banner}") % { banner: generate_banner(banner_text, 40) })
267
+ PDK::Report.default_target.puts("\n%{banner}" % { banner: generate_banner(banner_text, 40) })
270
268
  summary_to_print = summary.map { |k, v| "#{v.length} files #{k}" unless v.empty? }.compact
271
- PDK::Report.default_target.puts(_("\n%{summary}\n\n") % { summary: "#{summary_to_print.join(', ')}." })
269
+ PDK::Report.default_target.puts("\n%{summary}\n\n" % { summary: "#{summary_to_print.join(', ')}." })
272
270
  end
273
271
 
274
272
  def full_report(path)
@@ -277,7 +275,7 @@ module PDK
277
275
  report = ["/* Report generated by PDK at #{Time.now} */"]
278
276
  report.concat(update_manager.changes[:modified].map { |_, diff| "\n\n\n#{diff}" })
279
277
  PDK::Util::Filesystem.write_file(path, report.join)
280
- PDK::Report.default_target.puts(_("\nYou can find a report of differences in %{path}.\n\n") % { path: path })
278
+ PDK::Report.default_target.puts("\nYou can find a report of differences in %{path}.\n\n" % { path: path })
281
279
  end
282
280
 
283
281
  def generate_banner(text, width = 80)
@@ -92,22 +92,22 @@ module PDK
92
92
 
93
93
  def self.from_file(metadata_json_path)
94
94
  if metadata_json_path.nil?
95
- raise ArgumentError, _('Cannot read metadata from file: no path to file was given.')
95
+ raise ArgumentError, 'Cannot read metadata from file: no path to file was given.'
96
96
  end
97
97
 
98
98
  unless PDK::Util::Filesystem.file?(metadata_json_path)
99
- raise ArgumentError, _("'%{file}' does not exist or is not a file.") % { file: metadata_json_path }
99
+ raise ArgumentError, "'%{file}' does not exist or is not a file." % { file: metadata_json_path }
100
100
  end
101
101
 
102
102
  unless PDK::Util::Filesystem.readable?(metadata_json_path)
103
- raise ArgumentError, _("Unable to open '%{file}' for reading.") % { file: metadata_json_path }
103
+ raise ArgumentError, "Unable to open '%{file}' for reading." % { file: metadata_json_path }
104
104
  end
105
105
 
106
106
  require 'json'
107
107
  begin
108
108
  data = JSON.parse(PDK::Util::Filesystem.read_file(metadata_json_path))
109
109
  rescue JSON::JSONError => e
110
- raise ArgumentError, _('Invalid JSON in metadata.json: %{msg}') % { msg: e.message }
110
+ raise ArgumentError, 'Invalid JSON in metadata.json: %{msg}' % { msg: e.message }
111
111
  end
112
112
 
113
113
  require 'pdk/util'
@@ -144,9 +144,9 @@ module PDK
144
144
 
145
145
  def validate_puppet_version_requirement!
146
146
  msgs = {
147
- no_reqs: _('Module metadata does not contain any requirements.'),
148
- no_puppet_req: _('Module metadata does not contain a "puppet" requirement.'),
149
- no_puppet_ver: _('The "puppet" requirement in module metadata does not specify a "version_requirement".'),
147
+ no_reqs: 'Module metadata does not contain any requirements.',
148
+ no_puppet_req: 'Module metadata does not contain a "puppet" requirement.',
149
+ no_puppet_ver: 'The "puppet" requirement in module metadata does not specify a "version_requirement".',
150
150
  }
151
151
 
152
152
  raise ArgumentError, msgs[:no_reqs] unless @data.key?('requirements')
@@ -186,16 +186,16 @@ module PDK
186
186
 
187
187
  err = case modname
188
188
  when nil, '', :namespace_missing
189
- _('Field must be a dash-separated user name and module name.')
189
+ 'Field must be a dash-separated user name and module name.'
190
190
  when %r{[^a-z0-9_]}i
191
- _('Module name must contain only alphanumeric or underscore characters.')
191
+ 'Module name must contain only alphanumeric or underscore characters.'
192
192
  when %r{^[^a-z]}i
193
- _('Module name must begin with a letter.')
193
+ 'Module name must begin with a letter.'
194
194
  else
195
- _('Namespace must contain only alphanumeric characters.')
195
+ 'Namespace must contain only alphanumeric characters.'
196
196
  end
197
197
 
198
- raise ArgumentError, _("Invalid 'name' field in metadata.json: %{err}") % { err: err }
198
+ raise ArgumentError, "Invalid 'name' field in metadata.json: %{err}" % { err: err }
199
199
  end
200
200
  end
201
201
  end