pdk 1.12.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ module PDK
4
4
  module Generate
5
5
  class DefinedType < PuppetObject
6
6
  OBJECT_TYPE = :defined_type
7
+ PUPPET_STRINGS_TYPE = 'defined_types'.freeze
7
8
 
8
9
  # Prepares the data needed to render the new defined type template.
9
10
  #
@@ -58,7 +58,8 @@ module PDK
58
58
 
59
59
  begin
60
60
  PDK::Module::TemplateDir.new(template_uri, metadata.data, true) do |templates|
61
- templates.render do |file_path, file_content|
61
+ templates.render do |file_path, file_content, file_status|
62
+ next if file_status == :delete
62
63
  file = Pathname.new(temp_target_dir) + file_path
63
64
  file.dirname.mkpath
64
65
  write_file(file, file_content)
@@ -4,6 +4,7 @@ module PDK
4
4
  module Generate
5
5
  class PuppetClass < PuppetObject
6
6
  OBJECT_TYPE = :class
7
+ PUPPET_STRINGS_TYPE = 'puppet_classes'.freeze
7
8
 
8
9
  # Prepares the data needed to render the new Puppet class template.
9
10
  #
@@ -45,6 +45,10 @@ module PDK
45
45
  end
46
46
  end
47
47
 
48
+ def spec_only?
49
+ @options[:spec_only]
50
+ end
51
+
48
52
  # @abstract Subclass and implement {#template_data} to provide data to
49
53
  # the templates during rendering. Implementations of this method should
50
54
  # return a Hash!{Symbol => Object}.
@@ -99,6 +103,37 @@ module PDK
99
103
  self.class::OBJECT_TYPE
100
104
  end
101
105
 
106
+ # Retrieves the type of the object being generated as represented in
107
+ # the JSON output of puppet-strings.
108
+ #
109
+ # @return [String] the type of the object being generated or nil if
110
+ # there is no mapping.
111
+ #
112
+ # @api private
113
+ def self.puppet_strings_type
114
+ return nil unless const_defined?(:PUPPET_STRINGS_TYPE)
115
+
116
+ self::PUPPET_STRINGS_TYPE
117
+ end
118
+
119
+ # Returns an array of possible target path strings.
120
+ def targets
121
+ targets = [
122
+ target_spec_path,
123
+ target_type_spec_path,
124
+ ]
125
+
126
+ unless spec_only?
127
+ targets += [
128
+ target_object_path,
129
+ target_type_path,
130
+ target_device_path,
131
+ ]
132
+ end
133
+
134
+ targets.compact
135
+ end
136
+
102
137
  # Check preconditions of this template group. By default this only makes sure that the target files do not
103
138
  # already exist. Override this (and call super) to add your own preconditions.
104
139
  #
@@ -106,12 +141,12 @@ module PDK
106
141
  #
107
142
  # @api public
108
143
  def check_preconditions
109
- [target_object_path, target_type_path, target_device_path, target_spec_path, target_type_spec_path].compact.each do |target_file|
144
+ targets.each do |target_file|
110
145
  next unless File.exist?(target_file)
111
146
 
112
147
  raise PDK::CLI::ExitWithError, _("Unable to generate %{object_type}; '%{file}' already exists.") % {
113
148
  file: target_file,
114
- object_type: object_type,
149
+ object_type: spec_only? ? 'unit test' : object_type,
115
150
  }
116
151
  end
117
152
  end
@@ -130,7 +165,7 @@ module PDK
130
165
  with_templates do |template_path, config_hash|
131
166
  data = template_data.merge(configs: config_hash)
132
167
 
133
- render_file(target_object_path, template_path[:object], data)
168
+ render_file(target_object_path, template_path[:object], data) unless spec_only?
134
169
  render_file(target_type_path, template_path[:type], data) if template_path[:type]
135
170
  render_file(target_device_path, template_path[:device], data) if template_path[:device]
136
171
  render_file(target_spec_path, template_path[:spec], data) if template_path[:spec]
@@ -16,6 +16,10 @@ module PDK
16
16
  @options = options
17
17
  end
18
18
 
19
+ def convert?
20
+ instance_of?(PDK::Module::Convert)
21
+ end
22
+
19
23
  def run
20
24
  stage_changes!
21
25
 
@@ -68,25 +72,30 @@ module PDK
68
72
  def stage_changes!
69
73
  metadata_path = 'metadata.json'
70
74
 
71
- PDK::Module::TemplateDir.new(template_uri, nil, false) do |templates|
75
+ PDK::Module::TemplateDir.new(template_uri, nil, true) do |templates|
72
76
  new_metadata = update_metadata(metadata_path, templates.metadata)
73
77
  templates.module_metadata = new_metadata.data unless new_metadata.nil?
74
78
 
75
79
  if options[:noop] && new_metadata.nil?
76
80
  update_manager.add_file(metadata_path, '')
77
- elsif File.file?(metadata_path)
81
+ elsif PDK::Util::Filesystem.file?(metadata_path)
78
82
  update_manager.modify_file(metadata_path, new_metadata.to_json)
79
83
  else
80
84
  update_manager.add_file(metadata_path, new_metadata.to_json)
81
85
  end
82
86
 
83
87
  templates.render do |file_path, file_content, file_status|
84
- if file_status == :unmanage
88
+ case file_status
89
+ when :unmanage
85
90
  PDK.logger.debug(_("skipping '%{path}'") % { path: file_path })
86
- elsif file_status == :delete
91
+ when :delete
87
92
  update_manager.remove_file(file_path)
88
- elsif file_status == :manage
89
- if File.exist? file_path
93
+ when :init
94
+ if convert? && !PDK::Util::Filesystem.exist?(file_path)
95
+ update_manager.add_file(file_path, file_content)
96
+ end
97
+ when :manage
98
+ if PDK::Util::Filesystem.exist?(file_path)
90
99
  update_manager.modify_file(file_path, file_content)
91
100
  else
92
101
  update_manager.add_file(file_path, file_content)
@@ -107,8 +116,8 @@ module PDK
107
116
  end
108
117
 
109
118
  def update_metadata(metadata_path, template_metadata)
110
- if File.file?(metadata_path)
111
- unless File.readable?(metadata_path)
119
+ if PDK::Util::Filesystem.file?(metadata_path)
120
+ unless PDK::Util::Filesystem.readable?(metadata_path)
112
121
  raise PDK::CLI::ExitWithError, _('Unable to update module metadata; %{path} exists but it is not readable.') % {
113
122
  path: metadata_path,
114
123
  }
@@ -124,7 +133,7 @@ module PDK
124
133
  rescue ArgumentError
125
134
  metadata = PDK::Generate::Module.prepare_metadata(options) unless options[:noop]
126
135
  end
127
- elsif File.exist?(metadata_path)
136
+ elsif PDK::Util::Filesystem.exist?(metadata_path)
128
137
  raise PDK::CLI::ExitWithError, _('Unable to update module metadata; %{path} exists but it is not a file.') % {
129
138
  path: metadata_path,
130
139
  }
@@ -94,16 +94,16 @@ module PDK
94
94
  raise ArgumentError, _('Cannot read metadata from file: no path to file was given.')
95
95
  end
96
96
 
97
- unless File.file?(metadata_json_path)
97
+ unless PDK::Util::Filesystem.file?(metadata_json_path)
98
98
  raise ArgumentError, _("'%{file}' does not exist or is not a file.") % { file: metadata_json_path }
99
99
  end
100
100
 
101
- unless File.readable?(metadata_json_path)
101
+ unless PDK::Util::Filesystem.readable?(metadata_json_path)
102
102
  raise ArgumentError, _("Unable to open '%{file}' for reading.") % { file: metadata_json_path }
103
103
  end
104
104
 
105
105
  begin
106
- data = JSON.parse(File.read(metadata_json_path))
106
+ data = JSON.parse(PDK::Util::Filesystem.read_file(metadata_json_path))
107
107
  rescue JSON::JSONError => e
108
108
  raise ArgumentError, _('Invalid JSON in metadata.json: %{msg}') % { msg: e.message }
109
109
  end
@@ -122,7 +122,12 @@ module PDK
122
122
  PDK.logger.debug(_("Rendering '%{template}'...") % { template: template_file })
123
123
  dest_path = template_file.sub(%r{\.erb\Z}, '')
124
124
  config = config_for(dest_path)
125
- dest_status = :manage
125
+
126
+ dest_status = if template_loc.start_with?(@moduleroot_init)
127
+ :init
128
+ else
129
+ :manage
130
+ end
126
131
 
127
132
  if config['unmanaged']
128
133
  dest_status = :unmanage
@@ -8,7 +8,7 @@ module PDK
8
8
  class Unit
9
9
  def self.cmd(tests, opts = {})
10
10
  rake_args = opts[:parallel] ? 'parallel_spec_standalone' : 'spec_standalone'
11
- rake_args += "[#{tests}]" unless tests.nil?
11
+ rake_args += "[#{tests}]" unless tests.nil? || tests.empty?
12
12
  rake_args
13
13
  end
14
14
 
@@ -68,7 +68,7 @@ module PDK
68
68
 
69
69
  setup
70
70
 
71
- tests = options.fetch(:tests)
71
+ tests = options[:tests]
72
72
 
73
73
  environment = { 'CI_SPEC_OPTIONS' => '--format j' }
74
74
  environment['PUPPET_GEM_VERSION'] = options[:puppet] if options[:puppet]
@@ -6,6 +6,7 @@ require 'pdk/util/windows'
6
6
  require 'pdk/util/vendored_file'
7
7
  require 'pdk/util/filesystem'
8
8
  require 'pdk/util/template_uri'
9
+ require 'pdk/util/puppet_strings'
9
10
 
10
11
  module PDK
11
12
  module Util
@@ -30,6 +30,11 @@ module PDK
30
30
  end
31
31
  module_function :directory?
32
32
 
33
+ def mkdir_p(*args)
34
+ FileUtils.mkdir_p(*args)
35
+ end
36
+ module_function :mkdir_p
37
+
33
38
  def file?(*args)
34
39
  File.file?(*args)
35
40
  end
@@ -49,6 +54,16 @@ module PDK
49
54
  File.fnmatch(*args)
50
55
  end
51
56
  module_function :fnmatch
57
+
58
+ def readable?(*args)
59
+ File.readable?(*args)
60
+ end
61
+ module_function :readable?
62
+
63
+ def exist?(*args)
64
+ File.exist?(*args)
65
+ end
66
+ module_function :exist?
52
67
  #:nocov:
53
68
  end
54
69
  end
@@ -0,0 +1,101 @@
1
+ require 'pdk/cli/exec'
2
+
3
+ module PDK
4
+ module Util
5
+ module PuppetStrings
6
+ class NoObjectError < StandardError; end
7
+ class RunError < StandardError; end
8
+ class NoGeneratorError < StandardError; end
9
+
10
+ # Runs Puppet for the purposes of generating puppet-strings output.
11
+ #
12
+ # @param *args [String] additional parameters to pass to puppet.
13
+ #
14
+ # @return [Hash{Symbol=>Object}] the result of the command execution.
15
+ def self.puppet(*args)
16
+ PDK::Util::Bundler.ensure_binstubs!('puppet')
17
+
18
+ argv = [File.join(PDK::Util.module_root, 'bin', 'puppet')] + args
19
+ argv.unshift(File.join(PDK::Util::RubyVersion.bin_path, 'ruby.exe')) if Gem.win_platform?
20
+
21
+ command = PDK::CLI::Exec::Command.new(*argv).tap do |c|
22
+ c.context = :module
23
+ c.add_spinner(_('Examining module contents'))
24
+ end
25
+
26
+ command.execute!
27
+ end
28
+
29
+ # Generates and parses the JSON output from puppet-strings.
30
+ #
31
+ # @returns [Hash{String=>Object}] the parsed puppet-strings output.
32
+ #
33
+ # @raises [PDK::Util::PuppetStrings::RunError] if the puppet-strings
34
+ # command exits non-zero.
35
+ # @raises [PDK::Util::PuppetStrings::RunError] if the puppet-strings
36
+ # command outputs invalid JSON.
37
+ def self.generate_hash
38
+ result = puppet('strings', 'generate', '--format', 'json')
39
+
40
+ raise RunError, result[:stderr] unless result[:exit_code].zero?
41
+
42
+ JSON.parse(result[:stdout])
43
+ rescue JSON::ParserError => e
44
+ PDK.logger.debug(e)
45
+ raise RunError, _('Unable to parse puppet-strings output')
46
+ end
47
+
48
+ # Searches the puppet-strings result to find the definition of the named
49
+ # object.
50
+ #
51
+ # @param name [String] the name of the object definition to search for.
52
+ # If the object name is not prepended with the module name,
53
+ # "#{module_name}::#{object_name}" will also be search for.
54
+ #
55
+ # @returns [Array[PDK::Generate::PuppetObject, Hash{String=>Object}]] the
56
+ # appropriate generator class for the object as the first element and
57
+ # the puppet-strings description hash for the definition.
58
+ #
59
+ # @raises [PDK::Util::PuppetStrings::NoObjectError] if the named object
60
+ # can not be found in the puppet-strings output.
61
+ # @raises [PDK::Util::PuppetStrings::NoGeneratorError] if the named
62
+ # object does not have a corresponding PDK generator class.
63
+ def self.find_object(name)
64
+ module_name = PDK::Util.module_metadata['name'].rpartition('-').last
65
+
66
+ object_names = [name]
67
+ object_names << "#{module_name}::#{name}" unless name.start_with?("#{module_name}::")
68
+
69
+ known_objects = generate_hash
70
+ object_type = known_objects.keys.find do |obj_type|
71
+ known_objects[obj_type].any? { |obj| object_names.include?(obj['name']) }
72
+ end
73
+
74
+ raise NoObjectError if object_type.nil?
75
+
76
+ generator = find_generator(object_type)
77
+
78
+ raise NoGeneratorError, object_type if generator.nil?
79
+
80
+ [generator, known_objects[object_type].find { |obj| object_names.include?(obj['name']) }]
81
+ end
82
+
83
+ # Evaluates the mapping of puppet-strings object type to PDK generator
84
+ # class.
85
+ #
86
+ # @param type [String] the object type as returned from puppet-strings.
87
+ #
88
+ # @returns [PDK:Generate::PuppetObject,nil] a child of
89
+ # PDK::Generate::PuppetObject or nil a suitable generator is not found.
90
+ #
91
+ # @example
92
+ # PDK::Util::PuppetStrings.find_generator('puppet_classes')
93
+ # => PDK::Generate::PuppetClass
94
+ def self.find_generator(type)
95
+ PDK::Generate::GENERATORS.find do |gen|
96
+ gen.respond_to?(:puppet_strings_type) && gen.puppet_strings_type == type
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
@@ -1,4 +1,5 @@
1
1
  require 'pdk/util'
2
+ require 'forwardable'
2
3
 
3
4
  module PDK
4
5
  module Util
@@ -52,14 +52,9 @@ module PDK
52
52
  if PDK::Util::Filesystem.directory?(target)
53
53
  target_root = PDK::Util.module_root
54
54
  pattern_glob = Array(pattern).map { |p| PDK::Util::Filesystem.glob(File.join(target_root, p), File::FNM_DOTMATCH) }
55
- target_list = pattern_glob.flatten.map do |file|
56
- if PDK::Util::Filesystem.fnmatch(File.join(PDK::Util::Filesystem.expand_path(PDK::Util.canonical_path(target)), '*'), file, File::FNM_DOTMATCH)
57
- Pathname.new(file).relative_path_from(Pathname.new(PDK::Util.module_root)).to_s
58
- else
59
- PDK.logger.debug(_('%{validator}: Skipped \'%{target}\'. Target directory does not exist.') % { validator: name, target: target })
60
- nil
61
- end
62
- end
55
+ target_list = pattern_glob.flatten
56
+ .select { |glob| PDK::Util::Filesystem.fnmatch(File.join(PDK::Util::Filesystem.expand_path(PDK::Util.canonical_path(target)), '*'), glob, File::FNM_DOTMATCH) }
57
+ .map { |glob| Pathname.new(glob).relative_path_from(Pathname.new(PDK::Util.module_root)).to_s }
63
58
 
64
59
  ignore_list = ignore_pathspec
65
60
  target_list = target_list.reject { |file| ignore_list.match(file) }
@@ -1,4 +1,4 @@
1
1
  module PDK
2
- VERSION = '1.12.0'.freeze
2
+ VERSION = '1.13.0'.freeze
3
3
  TEMPLATE_REF = VERSION
4
4
  end
@@ -6,11 +6,11 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: puppet development kit v1.11.1-46-g675b567\n"
9
+ "Project-Id-Version: puppet development kit v1.12.0-37-g18d39ff\n"
10
10
  "\n"
11
11
  "Report-Msgid-Bugs-To: docs@puppet.com\n"
12
- "POT-Creation-Date: 2019-07-31 20:31+1000\n"
13
- "PO-Revision-Date: 2019-07-31 20:31+1000\n"
12
+ "POT-Creation-Date: 2019-08-29 14:28+1000\n"
13
+ "PO-Revision-Date: 2019-08-29 14:28+1000\n"
14
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
16
  "Language: \n"
@@ -173,6 +173,34 @@ msgstr ""
173
173
  msgid "`pdk bundle` can only be run from inside a valid module directory."
174
174
  msgstr ""
175
175
 
176
+ #: ../lib/pdk/cli/config.rb:4
177
+ msgid "config [subcommand] [options]"
178
+ msgstr ""
179
+
180
+ #: ../lib/pdk/cli/config.rb:5
181
+ msgid "Configure the Puppet Development Kit."
182
+ msgstr ""
183
+
184
+ #: ../lib/pdk/cli/config/get.rb:4
185
+ msgid "config get [name]"
186
+ msgstr ""
187
+
188
+ #: ../lib/pdk/cli/config/get.rb:5
189
+ msgid "Retrieve the configuration for <name>. If not specified, retrieve all configuration settings"
190
+ msgstr ""
191
+
192
+ #: ../lib/pdk/cli/config/get.rb:12
193
+ msgid "Configuration item '%{name}' does not exist"
194
+ msgstr ""
195
+
196
+ #: ../lib/pdk/cli/config/get.rb:17
197
+ msgid "%{value}"
198
+ msgstr ""
199
+
200
+ #: ../lib/pdk/cli/config/get.rb:21
201
+ msgid "%{name}=%{value}"
202
+ msgstr ""
203
+
176
204
  #: ../lib/pdk/cli/convert.rb:6
177
205
  msgid "convert [options]"
178
206
  msgstr ""
@@ -427,6 +455,34 @@ msgstr ""
427
455
  msgid "'%{name}' is not a valid transport name"
428
456
  msgstr ""
429
457
 
458
+ #: ../lib/pdk/cli/new/unit_test.rb:4
459
+ msgid "unit_test [options] <name>"
460
+ msgstr ""
461
+
462
+ #: ../lib/pdk/cli/new/unit_test.rb:5
463
+ msgid "(Experimental) Create a new unit test for the object named <name>"
464
+ msgstr ""
465
+
466
+ #: ../lib/pdk/cli/new/unit_test.rb:6
467
+ msgid ""
468
+ "Generate a new rspec-puppet unit test for an existing class or defined type.\n"
469
+ "\n"
470
+ "Please note, this is an experimental feature; the functionality and UX is\n"
471
+ "subject to change in future releases.\n"
472
+ msgstr ""
473
+
474
+ #: ../lib/pdk/cli/new/unit_test.rb:19
475
+ msgid "Unit tests can only be created from inside a valid module directory."
476
+ msgstr ""
477
+
478
+ #: ../lib/pdk/cli/new/unit_test.rb:43
479
+ msgid "Unable to find anything called \"%{object}\" to generate unit tests for."
480
+ msgstr ""
481
+
482
+ #: ../lib/pdk/cli/new/unit_test.rb:45
483
+ msgid "PDK does not support generating unit tests for \"%{object_type}\" objects."
484
+ msgstr ""
485
+
430
486
  #: ../lib/pdk/cli/test.rb:4
431
487
  msgid "test [subcommand] [options]"
432
488
  msgstr ""
@@ -567,11 +623,11 @@ msgstr ""
567
623
  msgid "Did you mean '%{command}'?"
568
624
  msgstr ""
569
625
 
570
- #: ../lib/pdk/cli/util/interview.rb:30
626
+ #: ../lib/pdk/cli/util/interview.rb:32
571
627
  msgid "[Q %{current_number}/%{questions_total}]"
572
628
  msgstr ""
573
629
 
574
- #: ../lib/pdk/cli/util/interview.rb:36 ../lib/pdk/cli/util/interview.rb:40 ../lib/pdk/cli/util/interview.rb:49
630
+ #: ../lib/pdk/cli/util/interview.rb:38 ../lib/pdk/cli/util/interview.rb:42 ../lib/pdk/cli/util/interview.rb:51
575
631
  msgid "-->"
576
632
  msgstr ""
577
633
 
@@ -636,36 +692,36 @@ msgstr ""
636
692
  msgid "Validating module using %{num_of_threads} threads"
637
693
  msgstr ""
638
694
 
639
- #: ../lib/pdk/config.rb:40
695
+ #: ../lib/pdk/config.rb:48
640
696
  msgid "Unable to load %{file}: %{message}"
641
697
  msgstr ""
642
698
 
643
- #: ../lib/pdk/config.rb:62
699
+ #: ../lib/pdk/config.rb:70
644
700
  msgid ""
645
701
  "PDK collects anonymous usage information to help us understand how it is being used and make decisions on how to improve it. You can find out more about what data we collect and how it is used in the PDK documentation at %{url}.\n"
646
702
  msgstr ""
647
703
 
648
- #: ../lib/pdk/config.rb:68
704
+ #: ../lib/pdk/config.rb:76
649
705
  msgid "You can opt in or out of the usage data collection at any time by editing the analytics configuration file at %{path} and changing the '%{key}' value."
650
706
  msgstr ""
651
707
 
652
- #: ../lib/pdk/config.rb:80
708
+ #: ../lib/pdk/config.rb:88
653
709
  msgid "Do you consent to the collection of anonymous PDK usage information?"
654
710
  msgstr ""
655
711
 
656
- #: ../lib/pdk/config.rb:92
712
+ #: ../lib/pdk/config.rb:100
657
713
  msgid "No answer given, opting out of analytics collection."
658
714
  msgstr ""
659
715
 
660
- #: ../lib/pdk/config/namespace.rb:59
716
+ #: ../lib/pdk/config/namespace.rb:63
661
717
  msgid "Only PDK::Config::Namespace objects can be mounted into a namespace"
662
718
  msgstr ""
663
719
 
664
- #: ../lib/pdk/config/namespace.rb:203
720
+ #: ../lib/pdk/config/namespace.rb:251
665
721
  msgid "Unable to open %{file} for reading"
666
722
  msgstr ""
667
723
 
668
- #: ../lib/pdk/config/namespace.rb:235
724
+ #: ../lib/pdk/config/namespace.rb:283
669
725
  msgid "Unable to open %{file} for writing"
670
726
  msgstr ""
671
727
 
@@ -719,145 +775,145 @@ msgstr ""
719
775
  msgid "You do not have permission to write to '%{parent_dir}'"
720
776
  msgstr ""
721
777
 
722
- #: ../lib/pdk/generate/module.rb:93
778
+ #: ../lib/pdk/generate/module.rb:94
723
779
  msgid "Module '%{name}' generated at path '%{path}', from template '%{url}'."
724
780
  msgstr ""
725
781
 
726
- #: ../lib/pdk/generate/module.rb:94
782
+ #: ../lib/pdk/generate/module.rb:95
727
783
  msgid "In your module directory, add classes with the 'pdk new class' command."
728
784
  msgstr ""
729
785
 
730
- #: ../lib/pdk/generate/module.rb:97
786
+ #: ../lib/pdk/generate/module.rb:98
731
787
  msgid "Failed to move '%{source}' to '%{target}': %{message}"
732
788
  msgstr ""
733
789
 
734
- #: ../lib/pdk/generate/module.rb:111
790
+ #: ../lib/pdk/generate/module.rb:112
735
791
  msgid "Your username is not a valid Forge username. Proceeding with the username %{username}. You can fix this later in metadata.json."
736
792
  msgstr ""
737
793
 
738
- #: ../lib/pdk/generate/module.rb:146
794
+ #: ../lib/pdk/generate/module.rb:147
739
795
  msgid "Unable to create directory '%{dir}': %{message}"
740
796
  msgstr ""
741
797
 
742
- #: ../lib/pdk/generate/module.rb:158
798
+ #: ../lib/pdk/generate/module.rb:159
743
799
  msgid "If you have a name for your module, add it here."
744
800
  msgstr ""
745
801
 
746
- #: ../lib/pdk/generate/module.rb:159
802
+ #: ../lib/pdk/generate/module.rb:160
747
803
  msgid "This is the name that will be associated with your module, it should be relevant to the modules content."
748
804
  msgstr ""
749
805
 
750
- #: ../lib/pdk/generate/module.rb:162
806
+ #: ../lib/pdk/generate/module.rb:163
751
807
  msgid "Module names must begin with a lowercase letter and can only include lowercase letters, numbers, and underscores."
752
808
  msgstr ""
753
809
 
754
- #: ../lib/pdk/generate/module.rb:166
810
+ #: ../lib/pdk/generate/module.rb:167
755
811
  msgid "If you have a Puppet Forge username, add it here."
756
812
  msgstr ""
757
813
 
758
- #: ../lib/pdk/generate/module.rb:167
814
+ #: ../lib/pdk/generate/module.rb:168
759
815
  msgid "We can use this to upload your module to the Forge when it's complete."
760
816
  msgstr ""
761
817
 
762
- #: ../lib/pdk/generate/module.rb:170
818
+ #: ../lib/pdk/generate/module.rb:171
763
819
  msgid "Forge usernames can only contain lowercase letters and numbers"
764
820
  msgstr ""
765
821
 
766
- #: ../lib/pdk/generate/module.rb:175
822
+ #: ../lib/pdk/generate/module.rb:176
767
823
  msgid "What version is this module?"
768
824
  msgstr ""
769
825
 
770
- #: ../lib/pdk/generate/module.rb:176
826
+ #: ../lib/pdk/generate/module.rb:177
771
827
  msgid "Puppet uses Semantic Versioning (semver.org) to version modules."
772
828
  msgstr ""
773
829
 
774
- #: ../lib/pdk/generate/module.rb:179
830
+ #: ../lib/pdk/generate/module.rb:180
775
831
  msgid "Semantic Version numbers must be in the form MAJOR.MINOR.PATCH"
776
832
  msgstr ""
777
833
 
778
- #: ../lib/pdk/generate/module.rb:185
834
+ #: ../lib/pdk/generate/module.rb:186
779
835
  msgid "Who wrote this module?"
780
836
  msgstr ""
781
837
 
782
- #: ../lib/pdk/generate/module.rb:186
838
+ #: ../lib/pdk/generate/module.rb:187
783
839
  msgid "This is used to credit the module's author."
784
840
  msgstr ""
785
841
 
786
- #: ../lib/pdk/generate/module.rb:192
842
+ #: ../lib/pdk/generate/module.rb:193
787
843
  msgid "What license does this module code fall under?"
788
844
  msgstr ""
789
845
 
790
- #: ../lib/pdk/generate/module.rb:193
846
+ #: ../lib/pdk/generate/module.rb:194
791
847
  msgid "This should be an identifier from https://spdx.org/licenses/. Common values are \"Apache-2.0\", \"MIT\", or \"proprietary\"."
792
848
  msgstr ""
793
849
 
794
- #: ../lib/pdk/generate/module.rb:199
850
+ #: ../lib/pdk/generate/module.rb:200
795
851
  msgid "What operating systems does this module support?"
796
852
  msgstr ""
797
853
 
798
- #: ../lib/pdk/generate/module.rb:200
854
+ #: ../lib/pdk/generate/module.rb:201
799
855
  msgid "Use the up and down keys to move between the choices, space to select and enter to continue."
800
856
  msgstr ""
801
857
 
802
- #: ../lib/pdk/generate/module.rb:211
858
+ #: ../lib/pdk/generate/module.rb:212
803
859
  msgid "Summarize the purpose of this module in a single sentence."
804
860
  msgstr ""
805
861
 
806
- #: ../lib/pdk/generate/module.rb:212
862
+ #: ../lib/pdk/generate/module.rb:213
807
863
  msgid "This helps other Puppet users understand what the module does."
808
864
  msgstr ""
809
865
 
810
- #: ../lib/pdk/generate/module.rb:219
866
+ #: ../lib/pdk/generate/module.rb:220
811
867
  msgid "If there is a source code repository for this module, enter the URL here."
812
868
  msgstr ""
813
869
 
814
- #: ../lib/pdk/generate/module.rb:220
870
+ #: ../lib/pdk/generate/module.rb:221
815
871
  msgid "Skip this if no repository exists yet. You can update this later in the metadata.json."
816
872
  msgstr ""
817
873
 
818
- #: ../lib/pdk/generate/module.rb:227
874
+ #: ../lib/pdk/generate/module.rb:228
819
875
  msgid "If there is a URL where others can learn more about this module, enter it here."
820
876
  msgstr ""
821
877
 
822
- #: ../lib/pdk/generate/module.rb:228 ../lib/pdk/generate/module.rb:235
878
+ #: ../lib/pdk/generate/module.rb:229 ../lib/pdk/generate/module.rb:236
823
879
  msgid "Optional. You can update this later in the metadata.json."
824
880
  msgstr ""
825
881
 
826
- #: ../lib/pdk/generate/module.rb:234
882
+ #: ../lib/pdk/generate/module.rb:235
827
883
  msgid "If there is a public issue tracker for this module, enter its URL here."
828
884
  msgstr ""
829
885
 
830
- #: ../lib/pdk/generate/module.rb:262
886
+ #: ../lib/pdk/generate/module.rb:263
831
887
  msgid ""
832
888
  "\n"
833
889
  "We need to update the metadata.json file for this module, so we\\'re going to ask you %{count} questions.\n"
834
890
  msgstr ""
835
891
 
836
- #: ../lib/pdk/generate/module.rb:269
892
+ #: ../lib/pdk/generate/module.rb:270
837
893
  msgid ""
838
894
  "\n"
839
895
  "We need to create the metadata.json file for this module, so we\\'re going to ask you %{count} questions.\n"
840
896
  msgstr ""
841
897
 
842
- #: ../lib/pdk/generate/module.rb:277
898
+ #: ../lib/pdk/generate/module.rb:278
843
899
  msgid ""
844
900
  "If the question is not applicable to this module, accept the default option shown after each question. You can modify any answers at any time by manually updating the metadata.json file.\n"
845
901
  "\n"
846
902
  msgstr ""
847
903
 
848
- #: ../lib/pdk/generate/module.rb:286
904
+ #: ../lib/pdk/generate/module.rb:287
849
905
  msgid "No answers given, interview cancelled."
850
906
  msgstr ""
851
907
 
852
- #: ../lib/pdk/generate/module.rb:310
908
+ #: ../lib/pdk/generate/module.rb:311
853
909
  msgid "Metadata will be generated based on this information, continue?"
854
910
  msgstr ""
855
911
 
856
- #: ../lib/pdk/generate/module.rb:312
912
+ #: ../lib/pdk/generate/module.rb:313
857
913
  msgid "Interview cancelled; exiting."
858
914
  msgstr ""
859
915
 
860
- #: ../lib/pdk/generate/module.rb:316
916
+ #: ../lib/pdk/generate/module.rb:317
861
917
  msgid "Process cancelled; exiting."
862
918
  msgstr ""
863
919
 
@@ -901,35 +957,35 @@ msgstr ""
901
957
  msgid "spec/spec_helper.rb.mock_with not set to ':rspec'"
902
958
  msgstr ""
903
959
 
904
- #: ../lib/pdk/generate/puppet_object.rb:112
960
+ #: ../lib/pdk/generate/puppet_object.rb:147
905
961
  msgid "Unable to generate %{object_type}; '%{file}' already exists."
906
962
  msgstr ""
907
963
 
908
- #: ../lib/pdk/generate/puppet_object.rb:179
964
+ #: ../lib/pdk/generate/puppet_object.rb:214
909
965
  msgid "Creating '%{file}' from template."
910
966
  msgstr ""
911
967
 
912
- #: ../lib/pdk/generate/puppet_object.rb:186
968
+ #: ../lib/pdk/generate/puppet_object.rb:221
913
969
  msgid "Unable to create directory '%{path}': %{message}"
914
970
  msgstr ""
915
971
 
916
- #: ../lib/pdk/generate/puppet_object.rb:194
972
+ #: ../lib/pdk/generate/puppet_object.rb:229
917
973
  msgid "Unable to write to file '%{path}': %{message}"
918
974
  msgstr ""
919
975
 
920
- #: ../lib/pdk/generate/puppet_object.rb:217
976
+ #: ../lib/pdk/generate/puppet_object.rb:252
921
977
  msgid "No %{dir_type} template found; trying next template directory."
922
978
  msgstr ""
923
979
 
924
- #: ../lib/pdk/generate/puppet_object.rb:230
980
+ #: ../lib/pdk/generate/puppet_object.rb:265
925
981
  msgid "Unable to find a %{type} template in %{url}; trying next template directory."
926
982
  msgstr ""
927
983
 
928
- #: ../lib/pdk/generate/puppet_object.rb:232
984
+ #: ../lib/pdk/generate/puppet_object.rb:267
929
985
  msgid "Unable to find the %{type} template in %{url}."
930
986
  msgstr ""
931
987
 
932
- #: ../lib/pdk/generate/puppet_object.rb:287
988
+ #: ../lib/pdk/generate/puppet_object.rb:322
933
989
  msgid "'%{dir}' does not contain valid Puppet module metadata: %{msg}"
934
990
  msgstr ""
935
991
 
@@ -961,44 +1017,44 @@ msgstr ""
961
1017
  msgid "Updated permissions of packaged '%{entry}' to %{new_mode}"
962
1018
  msgstr ""
963
1019
 
964
- #: ../lib/pdk/module/convert.rb:23 ../lib/pdk/module/update.rb:20
1020
+ #: ../lib/pdk/module/convert.rb:27 ../lib/pdk/module/update.rb:20
965
1021
  msgid "No changes required."
966
1022
  msgstr ""
967
1023
 
968
- #: ../lib/pdk/module/convert.rb:34
1024
+ #: ../lib/pdk/module/convert.rb:38
969
1025
  msgid "Module conversion is a potentially destructive action. Ensure that you have committed your module to a version control system or have a backup, and review the changes above before continuing."
970
1026
  msgstr ""
971
1027
 
972
- #: ../lib/pdk/module/convert.rb:39 ../lib/pdk/module/update.rb:32
1028
+ #: ../lib/pdk/module/convert.rb:43 ../lib/pdk/module/update.rb:32
973
1029
  msgid "Do you want to continue and make these changes to your module?"
974
1030
  msgstr ""
975
1031
 
976
- #: ../lib/pdk/module/convert.rb:85
1032
+ #: ../lib/pdk/module/convert.rb:90
977
1033
  msgid "skipping '%{path}'"
978
1034
  msgstr ""
979
1035
 
980
- #: ../lib/pdk/module/convert.rb:112
1036
+ #: ../lib/pdk/module/convert.rb:121
981
1037
  msgid "Unable to update module metadata; %{path} exists but it is not readable."
982
1038
  msgstr ""
983
1039
 
984
- #: ../lib/pdk/module/convert.rb:128
1040
+ #: ../lib/pdk/module/convert.rb:137
985
1041
  msgid "Unable to update module metadata; %{path} exists but it is not a file."
986
1042
  msgstr ""
987
1043
 
988
- #: ../lib/pdk/module/convert.rb:171 ../lib/pdk/module/convert.rb:176 ../lib/pdk/module/convert.rb:180
1044
+ #: ../lib/pdk/module/convert.rb:180 ../lib/pdk/module/convert.rb:185 ../lib/pdk/module/convert.rb:189
989
1045
  msgid ""
990
1046
  "\n"
991
1047
  "%{banner}"
992
1048
  msgstr ""
993
1049
 
994
- #: ../lib/pdk/module/convert.rb:182
1050
+ #: ../lib/pdk/module/convert.rb:191
995
1051
  msgid ""
996
1052
  "\n"
997
1053
  "%{summary}\n"
998
1054
  "\n"
999
1055
  msgstr ""
1000
1056
 
1001
- #: ../lib/pdk/module/convert.rb:193
1057
+ #: ../lib/pdk/module/convert.rb:202
1002
1058
  msgid ""
1003
1059
  "\n"
1004
1060
  "You can find a report of differences in %{path}.\n"
@@ -1069,45 +1125,45 @@ msgstr ""
1069
1125
  msgid "Rendering '%{template}'..."
1070
1126
  msgstr ""
1071
1127
 
1072
- #: ../lib/pdk/module/templatedir.rb:135
1128
+ #: ../lib/pdk/module/templatedir.rb:140
1073
1129
  msgid ""
1074
1130
  "Failed to render template '%{template}'\n"
1075
1131
  "%{exception}: %{message}"
1076
1132
  msgstr ""
1077
1133
 
1078
- #: ../lib/pdk/module/templatedir.rb:206
1134
+ #: ../lib/pdk/module/templatedir.rb:211
1079
1135
  msgid "The built-in template has substantially changed. Please run \"pdk convert\" on your module to continue."
1080
1136
  msgstr ""
1081
1137
 
1082
- #: ../lib/pdk/module/templatedir.rb:208
1138
+ #: ../lib/pdk/module/templatedir.rb:213
1083
1139
  msgid "The specified template '%{path}' is not a directory."
1084
1140
  msgstr ""
1085
1141
 
1086
- #: ../lib/pdk/module/templatedir.rb:213
1142
+ #: ../lib/pdk/module/templatedir.rb:218
1087
1143
  msgid "The template at '%{path}' does not contain a 'moduleroot/' directory."
1088
1144
  msgstr ""
1089
1145
 
1090
- #: ../lib/pdk/module/templatedir.rb:218
1146
+ #: ../lib/pdk/module/templatedir.rb:223
1091
1147
  msgid "The template at '%{path}' does not contain a 'moduleroot_init/' directory, which indicates you are using an older style of template. Before continuing please use the --template-url flag when running the pdk new commands to pass a new style template."
1092
1148
  msgstr ""
1093
1149
 
1094
- #: ../lib/pdk/module/templatedir.rb:234
1150
+ #: ../lib/pdk/module/templatedir.rb:239
1095
1151
  msgid "The directory '%{dir}' doesn't exist"
1096
1152
  msgstr ""
1097
1153
 
1098
- #: ../lib/pdk/module/templatedir.rb:303
1154
+ #: ../lib/pdk/module/templatedir.rb:308
1099
1155
  msgid "'%{file}' is not a valid YAML file: %{problem} %{context} at line %{line} column %{column}"
1100
1156
  msgstr ""
1101
1157
 
1102
- #: ../lib/pdk/module/templatedir.rb:338
1158
+ #: ../lib/pdk/module/templatedir.rb:343
1103
1159
  msgid "Unable to clone git repository at '%{repo}' into '%{dest}'."
1104
1160
  msgstr ""
1105
1161
 
1106
- #: ../lib/pdk/module/templatedir.rb:355
1162
+ #: ../lib/pdk/module/templatedir.rb:360
1107
1163
  msgid "Unable to checkout '%{ref}' of git repository at '%{path}'."
1108
1164
  msgstr ""
1109
1165
 
1110
- #: ../lib/pdk/module/templatedir.rb:358
1166
+ #: ../lib/pdk/module/templatedir.rb:363
1111
1167
  msgid "Uncommitted changes found when attempting to checkout '%{ref}' of git repository at '%{path}'; skipping git reset."
1112
1168
  msgstr ""
1113
1169
 
@@ -1247,11 +1303,11 @@ msgstr ""
1247
1303
  msgid "Unable to enumerate examples. rspec reported: %{message}"
1248
1304
  msgstr ""
1249
1305
 
1250
- #: ../lib/pdk/util.rb:61
1306
+ #: ../lib/pdk/util.rb:62
1251
1307
  msgid "Cannot resolve a full path to '%{path}', as it does not currently exist."
1252
1308
  msgstr ""
1253
1309
 
1254
- #: ../lib/pdk/util.rb:86
1310
+ #: ../lib/pdk/util.rb:87
1255
1311
  msgid "Package basedir requested for non-package install."
1256
1312
  msgstr ""
1257
1313
 
@@ -1329,6 +1385,14 @@ msgstr ""
1329
1385
  msgid "Unable to find a branch or tag named \"%{ref}\" in %{repo}"
1330
1386
  msgstr ""
1331
1387
 
1388
+ #: ../lib/pdk/util/puppet_strings.rb:23
1389
+ msgid "Examining module contents"
1390
+ msgstr ""
1391
+
1392
+ #: ../lib/pdk/util/puppet_strings.rb:45
1393
+ msgid "Unable to parse puppet-strings output"
1394
+ msgstr ""
1395
+
1332
1396
  #: ../lib/pdk/util/puppet_version.rb:38
1333
1397
  msgid "Unable to find a Puppet gem in current Ruby environment or from Rubygems.org."
1334
1398
  msgstr ""
@@ -1373,7 +1437,7 @@ msgstr ""
1373
1437
  msgid "Failed to parse Puppet Enterprise version map file."
1374
1438
  msgstr ""
1375
1439
 
1376
- #: ../lib/pdk/util/ruby_version.rb:36
1440
+ #: ../lib/pdk/util/ruby_version.rb:37
1377
1441
  msgid "Unknown Ruby version \"%{ruby_version}\""
1378
1442
  msgstr ""
1379
1443
 
@@ -1429,27 +1493,23 @@ msgstr ""
1429
1493
  msgid "Failed to call GetLongPathName"
1430
1494
  msgstr ""
1431
1495
 
1432
- #: ../lib/pdk/validate/base_validator.rb:59
1433
- msgid "%{validator}: Skipped '%{target}'. Target directory does not exist."
1434
- msgstr ""
1435
-
1436
- #: ../lib/pdk/validate/base_validator.rb:110
1496
+ #: ../lib/pdk/validate/base_validator.rb:105
1437
1497
  msgid "Invoking %{cmd}"
1438
1498
  msgstr ""
1439
1499
 
1440
- #: ../lib/pdk/validate/base_validator.rb:115
1500
+ #: ../lib/pdk/validate/base_validator.rb:110
1441
1501
  msgid "%{validator}: Skipped '%{target}'. Target does not contain any files to validate (%{pattern})."
1442
1502
  msgstr ""
1443
1503
 
1444
- #: ../lib/pdk/validate/base_validator.rb:119
1504
+ #: ../lib/pdk/validate/base_validator.rb:114
1445
1505
  msgid "Target does not contain any files to validate (%{pattern})."
1446
1506
  msgstr ""
1447
1507
 
1448
- #: ../lib/pdk/validate/base_validator.rb:128
1508
+ #: ../lib/pdk/validate/base_validator.rb:123
1449
1509
  msgid "%{validator}: Skipped '%{target}'. Target file not found."
1450
1510
  msgstr ""
1451
1511
 
1452
- #: ../lib/pdk/validate/base_validator.rb:132
1512
+ #: ../lib/pdk/validate/base_validator.rb:127
1453
1513
  msgid "File does not exist."
1454
1514
  msgstr ""
1455
1515