pdk 1.3.2 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,8 +79,21 @@ module PDK
79
79
  end
80
80
  end
81
81
 
82
+ def forge_ready?
83
+ missing_fields.empty?
84
+ end
85
+
86
+ def interview_for_forge!
87
+ PDK::Generate::Module.module_interview(self, only_ask: missing_fields)
88
+ end
89
+
82
90
  private
83
91
 
92
+ def missing_fields
93
+ fields = DEFAULTS.keys - %w[data_provider requirements dependencies]
94
+ fields.select { |key| @data[key].nil? || @data[key].empty? }
95
+ end
96
+
84
97
  # Do basic validation and parsing of the name parameter.
85
98
  def process_name(data)
86
99
  validate_name(data['name'])
@@ -48,7 +48,7 @@ module PDK
48
48
  # template repo in `%AppData%` or `$XDG_CACHE_DIR` and update before
49
49
  # use.
50
50
  temp_dir = PDK::Util.make_tmpdir_name('pdk-templates')
51
- git_ref = PDK::Util.default_template_ref
51
+ git_ref = (path_or_url == PDK::Util.default_template_url) ? PDK::Util.default_template_ref : 'origin/master'
52
52
 
53
53
  clone_result = PDK::Util::Git.git('clone', path_or_url, temp_dir)
54
54
 
@@ -97,14 +97,16 @@ module PDK
97
97
  #
98
98
  # @api public
99
99
  def metadata
100
- return {} unless @repo
100
+ result = {
101
+ 'pdk-version' => PDK::Util::Version.version_string,
102
+ }
103
+
104
+ result['template-url'] = @repo ? @repo : @path
101
105
 
102
106
  ref_result = PDK::Util::Git.git('--git-dir', File.join(@path, '.git'), 'describe', '--all', '--long', '--always')
103
- if ref_result[:exit_code].zero?
104
- { 'template-url' => @repo, 'template-ref' => ref_result[:stdout].strip }
105
- else
106
- {}
107
- end
107
+ result['template-ref'] = ref_result[:stdout].strip if ref_result[:exit_code].zero?
108
+
109
+ result
108
110
  end
109
111
 
110
112
  # Loop through the files in the template, yielding each rendered file to
@@ -153,10 +155,12 @@ module PDK
153
155
  # @api public
154
156
  def object_template_for(object_type)
155
157
  object_path = File.join(@object_dir, "#{object_type}.erb")
158
+ addon_path = File.join(@object_dir, "#{object_type}_addon.erb")
156
159
  spec_path = File.join(@object_dir, "#{object_type}_spec.erb")
157
160
 
158
161
  if File.file?(object_path) && File.readable?(object_path)
159
162
  result = { object: object_path }
163
+ result[:addon] = addon_path if File.file?(addon_path) && File.readable?(addon_path)
160
164
  result[:spec] = spec_path if File.file?(spec_path) && File.readable?(spec_path)
161
165
  result
162
166
  else
@@ -213,7 +217,7 @@ module PDK
213
217
  temp_paths = []
214
218
  dirlocs = []
215
219
  dirs.each do |dir|
216
- raise ArgumentError, _("The directory '%{dir}' doesn't exist") unless Dir.exist?(dir)
220
+ raise ArgumentError, _("The directory '%{dir}' doesn't exist") % { dir: dir } unless Dir.exist?(dir)
217
221
  temp_paths += Dir.glob(File.join(dir, '**', '*'), File::FNM_DOTMATCH).select do |template_path|
218
222
  File.file?(template_path) && !File.symlink?(template_path)
219
223
  dirlocs << dir
@@ -0,0 +1,111 @@
1
+ require 'pdk/module/convert'
2
+
3
+ module PDK
4
+ module Module
5
+ class Update < Convert
6
+ GIT_DESCRIBE_PATTERN = %r{\A(?<base>.+?)-(?<additional_commits>\d+)-g(?<sha>.+)\Z}
7
+
8
+ def run
9
+ stage_changes!
10
+
11
+ unless update_manager.changes?
12
+ if current_version == new_version
13
+ PDK.logger.info _('This module is already up to date with version %{version} of the template.') % {
14
+ version: new_version,
15
+ }
16
+ else
17
+ PDK::Report.default_target.puts(_('No changes required.'))
18
+ end
19
+ return
20
+ end
21
+
22
+ PDK.logger.info(update_message)
23
+
24
+ print_summary
25
+ full_report('update_report.txt') unless update_manager.changes[:modified].empty?
26
+
27
+ return if noop?
28
+
29
+ unless force?
30
+ message = _('Do you want to continue and make these changes to your module?')
31
+ return unless PDK::CLI::Util.prompt_for_yes(message)
32
+ end
33
+
34
+ # Remove these files straight away as these changes are not something that the user needs to review.
35
+ if needs_bundle_update?
36
+ update_manager.unlink_file('Gemfile.lock')
37
+ update_manager.unlink_file(File.join('.bundle', 'config'))
38
+ end
39
+
40
+ update_manager.sync_changes!
41
+
42
+ PDK::Util::Bundler.ensure_bundle! if needs_bundle_update?
43
+
44
+ print_result 'Update completed'
45
+ end
46
+
47
+ def module_metadata
48
+ @module_metadata ||= PDK::Module::Metadata.from_file('metadata.json')
49
+ rescue ArgumentError => e
50
+ raise PDK::CLI::ExitWithError, e.message
51
+ end
52
+
53
+ def template_url
54
+ @template_url ||= module_metadata.data['template-url']
55
+ end
56
+
57
+ def current_version
58
+ @current_version ||= describe_ref_to_s(current_template_version)
59
+ end
60
+
61
+ def new_version
62
+ @new_version ||= fetch_remote_version(new_template_version)
63
+ end
64
+
65
+ private
66
+
67
+ def current_template_version
68
+ @current_template_version ||= module_metadata.data['template-ref']
69
+ end
70
+
71
+ def describe_ref_to_s(describe_ref)
72
+ data = GIT_DESCRIBE_PATTERN.match(describe_ref)
73
+
74
+ return data if data.nil?
75
+
76
+ if data[:base].start_with?('heads/')
77
+ "#{data[:base].gsub(%r{^heads/}, '')}@#{data[:sha]}"
78
+ else
79
+ data[:base]
80
+ end
81
+ end
82
+
83
+ def new_template_version
84
+ PDK::Util.default_template_ref
85
+ end
86
+
87
+ def fetch_remote_version(version)
88
+ return version unless version.include?('/')
89
+
90
+ branch = version.partition('/').last
91
+ sha_length = GIT_DESCRIBE_PATTERN.match(current_template_version)[:sha].length - 1
92
+ "#{branch}@#{PDK::Util::Git.ls_remote(template_url, "refs/heads/#{branch}")[0..sha_length]}"
93
+ end
94
+
95
+ def update_message
96
+ format_string = if template_url == PDK::Util.puppetlabs_template_url
97
+ _('Updating %{module_name} using the default template, from %{current_version} to %{new_version}')
98
+ else
99
+ _('Updating %{module_name} using the template at %{template_url}, from %{current_version} to %{new_version}')
100
+ end
101
+
102
+ format_string % {
103
+ module_name: module_metadata.data['name'],
104
+ template_url: template_url,
105
+ current_version: current_version,
106
+ new_version: new_version,
107
+ }
108
+ end
109
+ end
110
+ end
111
+ end
@@ -1,8 +1,8 @@
1
- require 'set'
2
1
  require 'diff/lcs'
3
2
  require 'diff/lcs/hunk'
4
3
  require 'English'
5
4
  require 'fileutils'
5
+ require 'set'
6
6
 
7
7
  module PDK
8
8
  module Module
@@ -86,13 +86,36 @@ module PDK
86
86
  files_to_write = @added_files
87
87
  files_to_write += @modified_files.reject { |file| @diff_cache[file[:path]].nil? }
88
88
 
89
+ @removed_files.each do |file|
90
+ unlink_file(file)
91
+ end
92
+
89
93
  files_to_write.each do |file|
90
94
  write_file(file[:path], file[:content])
91
95
  end
96
+ end
92
97
 
93
- @removed_files.each do |file|
94
- unlink_file(file)
98
+ # Remove a file from disk.
99
+ #
100
+ # Like FileUtils.rm_f, this method will not fail if the file does not
101
+ # exist. Unlike FileUtils.rm_f, this method will not blindly swallow all
102
+ # exceptions.
103
+ #
104
+ # @param path [String] The path to the file to be removed.
105
+ #
106
+ # @raise [PDK::CLI::ExitWithError] if the file could not be removed.
107
+ def unlink_file(path)
108
+ if File.file?(path)
109
+ PDK.logger.debug(_("unlinking '%{path}'") % { path: path })
110
+ FileUtils.rm(path)
111
+ else
112
+ PDK.logger.debug(_("'%{path}': already gone") % { path: path })
95
113
  end
114
+ rescue => e
115
+ raise PDK::CLI::ExitWithError, _("Unable to remove '%{path}': %{message}") % {
116
+ path: path,
117
+ message: e.message,
118
+ }
96
119
  end
97
120
 
98
121
  private
@@ -124,29 +147,12 @@ module PDK
124
147
  # @raise [PDK::CLI::ExitWithError] if the file is not writeable.
125
148
  def write_file(path, content)
126
149
  FileUtils.mkdir_p(File.dirname(path))
150
+ PDK.logger.debug(_("writing '%{path}'") % { path: path })
127
151
  File.open(path, 'w') { |f| f.puts content }
128
152
  rescue Errno::EACCES
129
153
  raise PDK::CLI::ExitWithError, _("You do not have permission to write to '%{path}'") % { path: path }
130
154
  end
131
155
 
132
- # Remove a file from disk.
133
- #
134
- # Like FileUtils.rm_f, this method will not fail if the file does not
135
- # exist. Unlink FileUtils.rm_f, this method will not blindly swallow all
136
- # exceptions.
137
- #
138
- # @param path [String] The path to the file to be removed.
139
- #
140
- # @raise [PDK::CLI::ExitWithError] if the file could not be removed.
141
- def unlink_file(path)
142
- FileUtils.rm(path) if File.file?(path)
143
- rescue => e
144
- raise PDK::CLI::ExitWithError, _("Unable to remove '%{path}': %{message}") % {
145
- path: path,
146
- message: e.message,
147
- }
148
- end
149
-
150
156
  # Generate a unified diff of the changes to be made to a file.
151
157
  #
152
158
  # @param path [String] The path to the file being diffed (only used to
@@ -59,7 +59,7 @@ module PDK
59
59
  module_function :package_install?
60
60
 
61
61
  def development_mode?
62
- !PDK::Util::Version.git_ref.nil?
62
+ (!PDK::Util::Version.git_ref.nil? || PDK::VERSION.end_with?('.pre'))
63
63
  end
64
64
  module_function :development_mode?
65
65
 
@@ -216,5 +216,17 @@ module PDK
216
216
  end
217
217
  end
218
218
  module_function :puppetlabs_template_ref
219
+
220
+ # TO-DO: Refactor replacement of lib/pdk/module/build.rb:metadata to use this function instead
221
+ def module_metadata
222
+ PDK::Module::Metadata.from_file(File.join(module_root, 'metadata.json')).data
223
+ end
224
+ module_function :module_metadata
225
+
226
+ # TO-DO: Refactor replacement of lib/pdk/module/build.rb:module_pdk_compatible? to use this function instead
227
+ def module_pdk_compatible?
228
+ ['pdk-version', 'template-url'].any? { |key| module_metadata.key?(key) }
229
+ end
230
+ module_function :module_pdk_compatible?
219
231
  end
220
232
  end
@@ -37,6 +37,21 @@ module PDK
37
37
 
38
38
  git(*args)[:exit_code].zero?
39
39
  end
40
+
41
+ def self.ls_remote(repo, ref)
42
+ output = git('ls-remote', '--refs', repo, ref)
43
+
44
+ unless output[:exit_code].zero?
45
+ PDK.logger.error output[:stdout]
46
+ PDK.logger.error output[:stderr]
47
+ raise PDK::CLI::ExitWithError, _('Unable to access the template repository "%{repository}"') % {
48
+ repository: repo,
49
+ }
50
+ end
51
+
52
+ matching_refs = output[:stdout].split("\n").map { |r| r.split("\t") }
53
+ matching_refs.find { |_sha, remote_ref| remote_ref == ref }.first
54
+ end
40
55
  end
41
56
  end
42
57
  end
@@ -5,6 +5,25 @@ require 'pdk/validate/base_validator'
5
5
  module PDK
6
6
  module Validate
7
7
  class PuppetSyntax < BaseValidator
8
+ # In Puppet >= 5.3.4, the error context formatting was changed to facilitate localization
9
+ ERROR_CONTEXT = %r{(?:file:\s(?<file>.+?)|line:\s(?<line>.+?)|column:\s(?<column>.+?))}
10
+ # In Puppet < 5.3.3, the error context was formatted in these variations:
11
+ # - "at file_path:line_num:col_num"
12
+ # - "at file_path:line_num"
13
+ # - "at line line_num"
14
+ # - "in file_path"
15
+ ERROR_CONTEXT_LEGACY = %r{(?:at\sline\s(?<line>\d+)|at\s(?<file>.+?):(?<line>\d+):(?<column>\d+)|at\s(?<file>.+?):(?<line>\d+)|in\s(?<file>.+?))}
16
+
17
+ PUPPET_SYNTAX_PATTERN = %r{^
18
+ (?<severity>.+?):\s
19
+ (?<message>.+?)
20
+ (?:
21
+ \s\(#{ERROR_CONTEXT}(,\s#{ERROR_CONTEXT})*\)| # attempt to match the new localisation friendly location
22
+ \s#{ERROR_CONTEXT_LEGACY}| # attempt to match the old " at file:line:column" location
23
+ $ # handle cases where the output has no location
24
+ )
25
+ $}x
26
+
8
27
  def self.name
9
28
  'puppet-syntax'
10
29
  end
@@ -22,39 +41,22 @@ module PDK
22
41
  end
23
42
 
24
43
  def self.parse_options(_options, targets)
25
- %w[parser validate].concat(targets)
44
+ ['parser', 'validate', '--config', null_file].concat(targets)
45
+ end
46
+
47
+ def self.null_file
48
+ Gem.win_platform? ? 'NUL' : '/dev/null'
26
49
  end
27
50
 
28
51
  def self.parse_output(report, result, targets)
29
52
  # Due to PUP-7504, we will have to programmatically construct the json
30
53
  # object from the text output for now.
31
- output = result[:stderr].split("\n")
54
+ output = result[:stderr].split("\n").reject { |entry| entry.empty? }
32
55
 
33
56
  results_data = []
34
57
  output.each do |offense|
35
- sanitize_console_output(offense)
36
- message, _at, location_raw = offense.partition(' at ')
37
-
38
- # Parse the offense type and msg
39
- severity, _colon, message = message.rpartition(': ')
40
-
41
- # Parse the offense location info
42
- location = location_raw.strip.match(%r{\A(?<file>.+):(?<line>\d+):(?<column>\d+)\Z}) unless location_raw.nil?
43
-
44
- attributes = {
45
- source: name,
46
- message: message.strip,
47
- state: :failure,
48
- }
49
- attributes[:severity] = severity.strip unless severity.nil?
50
-
51
- unless location.nil?
52
- attributes[:file] = location[:file]
53
- attributes[:line] = location[:line]
54
- attributes[:column] = location[:column]
55
- end
56
-
57
- results_data << attributes
58
+ offense_data = parse_offense(offense)
59
+ results_data << offense_data
58
60
  end
59
61
 
60
62
  # puppet parser validate does not include files without problems in its
@@ -74,6 +76,23 @@ module PDK
74
76
  end
75
77
  end
76
78
 
79
+ def self.parse_offense(offense)
80
+ sanitize_console_output(offense)
81
+
82
+ offense_data = {
83
+ source: name,
84
+ state: :failure,
85
+ }
86
+
87
+ attributes = offense.match(PUPPET_SYNTAX_PATTERN)
88
+
89
+ attributes.names.each do |name|
90
+ offense_data[name.to_sym] = attributes[name] unless attributes[name].nil?
91
+ end
92
+
93
+ offense_data
94
+ end
95
+
77
96
  def self.sanitize_console_output(line)
78
97
  line.gsub!(%r{\e\[([;\d]+)?m}, '')
79
98
  end
@@ -1,4 +1,4 @@
1
1
  module PDK
2
- VERSION = '1.3.2'.freeze
2
+ VERSION = '1.4.1'.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.3.1-7-g6c96455\n"
9
+ "Project-Id-Version: puppet development kit v1.4.0-20-gdc7faf3\n"
10
10
  "\n"
11
11
  "Report-Msgid-Bugs-To: docs@puppet.com\n"
12
- "POT-Creation-Date: 2018-01-16 14:39-0700\n"
13
- "PO-Revision-Date: 2018-01-16 14:39-0700\n"
12
+ "POT-Creation-Date: 2018-02-26 13:34-0700\n"
13
+ "PO-Revision-Date: 2018-02-26 13:34-0700\n"
14
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
16
  "Language: \n"
@@ -47,38 +47,94 @@ msgstr ""
47
47
  msgid "When specified, skips interactive querying of metadata."
48
48
  msgstr ""
49
49
 
50
- #: ../lib/pdk/cli.rb:50
50
+ #: ../lib/pdk/cli.rb:49
51
+ msgid "When specified, interactive querying of metadata will include all optional questions."
52
+ msgstr ""
53
+
54
+ #: ../lib/pdk/cli.rb:54
51
55
  msgid "pdk command [options]"
52
56
  msgstr ""
53
57
 
54
- #: ../lib/pdk/cli.rb:51
58
+ #: ../lib/pdk/cli.rb:55
55
59
  msgid "Puppet Development Kit"
56
60
  msgstr ""
57
61
 
58
- #: ../lib/pdk/cli.rb:52
62
+ #: ../lib/pdk/cli.rb:56
59
63
  msgid "The shortest path to better modules."
60
64
  msgstr ""
61
65
 
62
- #: ../lib/pdk/cli.rb:55
66
+ #: ../lib/pdk/cli.rb:59
63
67
  msgid "Show version of pdk."
64
68
  msgstr ""
65
69
 
66
- #: ../lib/pdk/cli.rb:60
70
+ #: ../lib/pdk/cli.rb:64
67
71
  msgid "Show help for this command."
68
72
  msgstr ""
69
73
 
70
- #: ../lib/pdk/cli.rb:65
74
+ #: ../lib/pdk/cli.rb:69
71
75
  msgid "Specify desired output format. Valid formats are '%{available_formats}'. You may also specify a file to which the formatted output is sent, for example: '--format=junit:report.xml'. This option may be specified multiple times if each option specifies a distinct target file."
72
76
  msgstr ""
73
77
 
74
- #: ../lib/pdk/cli.rb:76
78
+ #: ../lib/pdk/cli.rb:80
75
79
  msgid "Enable debug output."
76
80
  msgstr ""
77
81
 
78
- #: ../lib/pdk/cli.rb:80
82
+ #: ../lib/pdk/cli.rb:84
79
83
  msgid "Path to an answer file."
80
84
  msgstr ""
81
85
 
86
+ #: ../lib/pdk/cli/build.rb:6
87
+ msgid "build [options]"
88
+ msgstr ""
89
+
90
+ #: ../lib/pdk/cli/build.rb:7
91
+ msgid "Builds a package from the module that can be published to the Puppet Forge."
92
+ msgstr ""
93
+
94
+ #: ../lib/pdk/cli/build.rb:10
95
+ msgid "The target directory where you want PDK to write the package."
96
+ msgstr ""
97
+
98
+ #: ../lib/pdk/cli/build.rb:13
99
+ msgid "Skips the prompts and builds the module package."
100
+ msgstr ""
101
+
102
+ #: ../lib/pdk/cli/build.rb:20
103
+ msgid "`pdk build` can only be run from inside a valid module with a metadata.json."
104
+ msgstr ""
105
+
106
+ #: ../lib/pdk/cli/build.rb:31
107
+ msgid "This module is missing required fields in the metadata.json. Re-run the build command without --force to add this information."
108
+ msgstr ""
109
+
110
+ #: ../lib/pdk/cli/build.rb:43
111
+ msgid "The file '%{package}' already exists."
112
+ msgstr ""
113
+
114
+ #: ../lib/pdk/cli/build.rb:45
115
+ msgid "Overwrite?"
116
+ msgstr ""
117
+
118
+ #: ../lib/pdk/cli/build.rb:46 ../lib/pdk/cli/build.rb:57
119
+ msgid "Build cancelled; exiting."
120
+ msgstr ""
121
+
122
+ #: ../lib/pdk/cli/build.rb:52
123
+ msgid "This module is not compatible with PDK, so PDK can not validate or test this build. Unvalidated modules may have errors when uploading to the Forge. To make this module PDK compatible and use validate features, cancel the build and run `pdk convert`."
124
+ msgstr ""
125
+
126
+ #: ../lib/pdk/cli/build.rb:56
127
+ msgid "Continue build without converting?"
128
+ msgstr ""
129
+
130
+ #: ../lib/pdk/cli/build.rb:63
131
+ msgid "Building %{module_name} version %{module_version}"
132
+ msgstr ""
133
+
134
+ #: ../lib/pdk/cli/build.rb:70
135
+ msgid "Build of %{package_name} has completed successfully. Built package can be found here: %{package_path}"
136
+ msgstr ""
137
+
82
138
  #: ../lib/pdk/cli/bundle.rb:6
83
139
  msgid "bundle `-- [bundler_options]"
84
140
  msgstr ""
@@ -111,22 +167,30 @@ msgstr ""
111
167
  msgid "Convert an existing module to be compatible with the PDK."
112
168
  msgstr ""
113
169
 
114
- #: ../lib/pdk/cli/convert.rb:11
170
+ #: ../lib/pdk/cli/convert.rb:12
115
171
  msgid "Do not convert the module, just output what would be done."
116
172
  msgstr ""
117
173
 
118
- #: ../lib/pdk/cli/convert.rb:12
174
+ #: ../lib/pdk/cli/convert.rb:13
119
175
  msgid "Convert the module automatically, with no prompts."
120
176
  msgstr ""
121
177
 
122
- #: ../lib/pdk/cli/convert.rb:19
178
+ #: ../lib/pdk/cli/convert.rb:20
123
179
  msgid "`pdk convert` can only be run from inside a valid module directory."
124
180
  msgstr ""
125
181
 
126
- #: ../lib/pdk/cli/convert.rb:24
182
+ #: ../lib/pdk/cli/convert.rb:25
127
183
  msgid "You can not specify --noop and --force when converting a module"
128
184
  msgstr ""
129
185
 
186
+ #: ../lib/pdk/cli/convert.rb:29 ../lib/pdk/cli/new/module.rb:21
187
+ msgid "Ignoring --full-interview and continuing with --skip-interview."
188
+ msgstr ""
189
+
190
+ #: ../lib/pdk/cli/convert.rb:34
191
+ msgid "Ignoring --full-interview and continuing with --force."
192
+ msgstr ""
193
+
130
194
  #: ../lib/pdk/cli/errors.rb:6
131
195
  msgid "An unexpected error has occurred. Try running the command again with --debug"
132
196
  msgstr ""
@@ -183,6 +247,18 @@ msgstr ""
183
247
  msgid "This command is only for reminding you how to accomplish tasks with the PDK, when you were previously doing them with the puppet module command."
184
248
  msgstr ""
185
249
 
250
+ #: ../lib/pdk/cli/module/build.rb:6
251
+ msgid "build"
252
+ msgstr ""
253
+
254
+ #: ../lib/pdk/cli/module/build.rb:7
255
+ msgid "This command is now 'pdk build'."
256
+ msgstr ""
257
+
258
+ #: ../lib/pdk/cli/module/build.rb:10
259
+ msgid "Modules are built using the ‘pdk build’ command."
260
+ msgstr ""
261
+
186
262
  #: ../lib/pdk/cli/module/generate.rb:6
187
263
  msgid "generate [options] <module_name>"
188
264
  msgstr ""
@@ -195,7 +271,7 @@ msgstr ""
195
271
  msgid "New modules are created using the ‘pdk new module’ command."
196
272
  msgstr ""
197
273
 
198
- #: ../lib/pdk/cli/module/generate.rb:38 ../lib/pdk/cli/new/module.rb:30
274
+ #: ../lib/pdk/cli/module/generate.rb:38 ../lib/pdk/cli/new/module.rb:36
199
275
  msgid "Creating new module: %{modname}"
200
276
  msgstr ""
201
277
 
@@ -251,10 +327,22 @@ msgstr ""
251
327
  msgid "Create a new module named [module_name] using given options"
252
328
  msgstr ""
253
329
 
254
- #: ../lib/pdk/cli/new/module.rb:10
330
+ #: ../lib/pdk/cli/new/module.rb:11
255
331
  msgid "Specifies the license this module is written under. This should be a identifier from https://spdx.org/licenses/. Common values are 'Apache-2.0', 'MIT', or 'proprietary'."
256
332
  msgstr ""
257
333
 
334
+ #: ../lib/pdk/cli/new/provider.rb:4
335
+ msgid "provider [options] <name>"
336
+ msgstr ""
337
+
338
+ #: ../lib/pdk/cli/new/provider.rb:5
339
+ msgid "[experimental] Create a new ruby provider named <name> using given options"
340
+ msgstr ""
341
+
342
+ #: ../lib/pdk/cli/new/provider.rb:21
343
+ msgid "'%{name}' is not a valid provider name"
344
+ msgstr ""
345
+
258
346
  #: ../lib/pdk/cli/new/task.rb:4
259
347
  msgid "task [options] <name>"
260
348
  msgstr ""
@@ -323,11 +411,39 @@ msgstr ""
323
411
  msgid "\t%{id}\t%{description}"
324
412
  msgstr ""
325
413
 
414
+ #: ../lib/pdk/cli/update.rb:7
415
+ msgid "update [options]"
416
+ msgstr ""
417
+
418
+ #: ../lib/pdk/cli/update.rb:8
419
+ msgid "Update a module that has been created by or converted for use by PDK."
420
+ msgstr ""
421
+
422
+ #: ../lib/pdk/cli/update.rb:10
423
+ msgid "Do not update the module, just output what would be done."
424
+ msgstr ""
425
+
426
+ #: ../lib/pdk/cli/update.rb:11
427
+ msgid "Update the module automatically, with no prompts."
428
+ msgstr ""
429
+
430
+ #: ../lib/pdk/cli/update.rb:17
431
+ msgid "`pdk update` can only be run from inside a valid module directory."
432
+ msgstr ""
433
+
434
+ #: ../lib/pdk/cli/update.rb:21
435
+ msgid "This module does not appear to be PDK compatible. To make the module compatible with PDK, run `pdk convert`."
436
+ msgstr ""
437
+
438
+ #: ../lib/pdk/cli/update.rb:24
439
+ msgid "You can not specify --noop and --force when updating a module"
440
+ msgstr ""
441
+
326
442
  #: ../lib/pdk/cli/util.rb:26
327
443
  msgid "This command must be run from inside a valid module (no metadata.json found)."
328
444
  msgstr ""
329
445
 
330
- #: ../lib/pdk/cli/util.rb:49
446
+ #: ../lib/pdk/cli/util.rb:50
331
447
  msgid "Answer \"Y\" to continue or \"n\" to cancel."
332
448
  msgstr ""
333
449
 
@@ -351,22 +467,10 @@ msgstr ""
351
467
  msgid "'%{name}' is not a valid report format (%{valid})"
352
468
  msgstr ""
353
469
 
354
- #: ../lib/pdk/cli/util/option_normalizer.rb:56
355
- msgid "'%{name}' is not a valid parameter name"
356
- msgstr ""
357
-
358
- #: ../lib/pdk/cli/util/option_normalizer.rb:62
359
- msgid "'%{type}' is not a valid data type"
360
- msgstr ""
361
-
362
470
  #: ../lib/pdk/cli/util/option_validator.rb:14
363
471
  msgid "Error: the following values are invalid: %{invalid_entries}"
364
472
  msgstr ""
365
473
 
366
- #: ../lib/pdk/cli/util/option_validator.rb:70
367
- msgid "Non-standard data type '%{type}', make sure the type is available in your code, or dependencies"
368
- msgstr ""
369
-
370
474
  #: ../lib/pdk/cli/validate.rb:6
371
475
  msgid "validate [validators] [options] [targets]"
372
476
  msgstr ""
@@ -446,75 +550,75 @@ msgstr ""
446
550
  msgid "Your username is not a valid Forge username. Proceeding with the username %{username}. You can fix this later in metadata.json."
447
551
  msgstr ""
448
552
 
449
- #: ../lib/pdk/generate/module.rb:144
553
+ #: ../lib/pdk/generate/module.rb:142
450
554
  msgid "Unable to create directory '%{dir}': %{message}"
451
555
  msgstr ""
452
556
 
453
- #: ../lib/pdk/generate/module.rb:156
557
+ #: ../lib/pdk/generate/module.rb:154
454
558
  msgid "If you have a name for your module, add it here."
455
559
  msgstr ""
456
560
 
457
- #: ../lib/pdk/generate/module.rb:157
561
+ #: ../lib/pdk/generate/module.rb:155
458
562
  msgid "This is the name that will be associated with your module, it should be relevant to the modules content."
459
563
  msgstr ""
460
564
 
461
- #: ../lib/pdk/generate/module.rb:160
462
- msgid "Module names can only contain lowercase letters and numbers"
565
+ #: ../lib/pdk/generate/module.rb:158
566
+ msgid "Module names must begin with a lowercase letter and can only include lowercase letters, numbers, and underscores."
463
567
  msgstr ""
464
568
 
465
- #: ../lib/pdk/generate/module.rb:164
569
+ #: ../lib/pdk/generate/module.rb:162
466
570
  msgid "If you have a Puppet Forge username, add it here."
467
571
  msgstr ""
468
572
 
469
- #: ../lib/pdk/generate/module.rb:165
573
+ #: ../lib/pdk/generate/module.rb:163
470
574
  msgid "We can use this to upload your module to the Forge when it's complete."
471
575
  msgstr ""
472
576
 
473
- #: ../lib/pdk/generate/module.rb:168
577
+ #: ../lib/pdk/generate/module.rb:166
474
578
  msgid "Forge usernames can only contain lowercase letters and numbers"
475
579
  msgstr ""
476
580
 
477
- #: ../lib/pdk/generate/module.rb:173
581
+ #: ../lib/pdk/generate/module.rb:171
478
582
  msgid "What version is this module?"
479
583
  msgstr ""
480
584
 
481
- #: ../lib/pdk/generate/module.rb:174
585
+ #: ../lib/pdk/generate/module.rb:172
482
586
  msgid "Puppet uses Semantic Versioning (semver.org) to version modules."
483
587
  msgstr ""
484
588
 
485
- #: ../lib/pdk/generate/module.rb:177
589
+ #: ../lib/pdk/generate/module.rb:175
486
590
  msgid "Semantic Version numbers must be in the form MAJOR.MINOR.PATCH"
487
591
  msgstr ""
488
592
 
489
- #: ../lib/pdk/generate/module.rb:182
593
+ #: ../lib/pdk/generate/module.rb:181
490
594
  msgid "Who wrote this module?"
491
595
  msgstr ""
492
596
 
493
- #: ../lib/pdk/generate/module.rb:183
597
+ #: ../lib/pdk/generate/module.rb:182
494
598
  msgid "This is used to credit the module's author."
495
599
  msgstr ""
496
600
 
497
- #: ../lib/pdk/generate/module.rb:189
601
+ #: ../lib/pdk/generate/module.rb:188
498
602
  msgid "What license does this module code fall under?"
499
603
  msgstr ""
500
604
 
501
- #: ../lib/pdk/generate/module.rb:190
605
+ #: ../lib/pdk/generate/module.rb:189
502
606
  msgid "This should be an identifier from https://spdx.org/licenses/. Common values are \"Apache-2.0\", \"MIT\", or \"proprietary\"."
503
607
  msgstr ""
504
608
 
505
- #: ../lib/pdk/generate/module.rb:196
609
+ #: ../lib/pdk/generate/module.rb:195
506
610
  msgid "What operating systems does this module support?"
507
611
  msgstr ""
508
612
 
509
- #: ../lib/pdk/generate/module.rb:197
613
+ #: ../lib/pdk/generate/module.rb:196
510
614
  msgid "Use the up and down keys to move between the choices, space to select and enter to continue."
511
615
  msgstr ""
512
616
 
513
- #: ../lib/pdk/generate/module.rb:253
617
+ #: ../lib/pdk/generate/module.rb:252
514
618
  msgid "Summarize the purpose of this module in a single sentence."
515
619
  msgstr ""
516
620
 
517
- #: ../lib/pdk/generate/module.rb:254
621
+ #: ../lib/pdk/generate/module.rb:253
518
622
  msgid "This helps other Puppet users understand what the module does."
519
623
  msgstr ""
520
624
 
@@ -526,71 +630,119 @@ msgstr ""
526
630
  msgid "Skip this if no repository exists yet. You can update this later in the metadata.json."
527
631
  msgstr ""
528
632
 
529
- #: ../lib/pdk/generate/module.rb:267
633
+ #: ../lib/pdk/generate/module.rb:268
530
634
  msgid "If there is a URL where others can learn more about this module, enter it here."
531
635
  msgstr ""
532
636
 
533
- #: ../lib/pdk/generate/module.rb:268 ../lib/pdk/generate/module.rb:274
637
+ #: ../lib/pdk/generate/module.rb:269 ../lib/pdk/generate/module.rb:276
534
638
  msgid "Optional. You can update this later in the metadata.json."
535
639
  msgstr ""
536
640
 
537
- #: ../lib/pdk/generate/module.rb:273
641
+ #: ../lib/pdk/generate/module.rb:275
538
642
  msgid "If there is a public issue tracker for this module, enter its URL here."
539
643
  msgstr ""
540
644
 
541
- #: ../lib/pdk/generate/module.rb:288
645
+ #: ../lib/pdk/generate/module.rb:302
646
+ msgid "update"
647
+ msgstr ""
648
+
649
+ #: ../lib/pdk/generate/module.rb:302
650
+ msgid "create"
651
+ msgstr ""
652
+
653
+ #: ../lib/pdk/generate/module.rb:303
542
654
  msgid ""
543
655
  "\n"
544
- "We need to create a metadata.json file for this module, so we\\'re going to ask you %{count} questions.\n"
656
+ "We need to %{action} the metadata.json file for this module, so we\\'re going to ask you %{count} questions.\n"
545
657
  "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"
546
658
  "\n"
547
659
  msgstr ""
548
660
 
549
- #: ../lib/pdk/generate/module.rb:299
661
+ #: ../lib/pdk/generate/module.rb:317
550
662
  msgid "No answers given, interview cancelled."
551
663
  msgstr ""
552
664
 
553
- #: ../lib/pdk/generate/module.rb:317
665
+ #: ../lib/pdk/generate/module.rb:341
554
666
  msgid "Metadata will be generated based on this information, continue?"
555
667
  msgstr ""
556
668
 
557
- #: ../lib/pdk/generate/module.rb:319
669
+ #: ../lib/pdk/generate/module.rb:343
558
670
  msgid "Interview cancelled; exiting."
559
671
  msgstr ""
560
672
 
561
- #: ../lib/pdk/generate/module.rb:323
673
+ #: ../lib/pdk/generate/module.rb:347
562
674
  msgid "Process cancelled; exiting."
563
675
  msgstr ""
564
676
 
565
- #: ../lib/pdk/generate/puppet_object.rb:91
677
+ #: ../lib/pdk/generate/provider.rb:23
678
+ msgid "%{error}: Creating a provider needs some local configuration in your module. Please follow the docs at https://github.com/puppetlabs/puppet-resource_api#getting-started."
679
+ msgstr ""
680
+
681
+ #: ../lib/pdk/generate/provider.rb:33
682
+ msgid ".sync.yml not found"
683
+ msgstr ""
684
+
685
+ #: ../lib/pdk/generate/provider.rb:37
686
+ msgid ".sync.yml contents is not a Hash"
687
+ msgstr ""
688
+
689
+ #: ../lib/pdk/generate/provider.rb:39
690
+ msgid "Gemfile configuration not found"
691
+ msgstr ""
692
+
693
+ #: ../lib/pdk/generate/provider.rb:41
694
+ msgid "Gemfile.optional configuration not found"
695
+ msgstr ""
696
+
697
+ #: ../lib/pdk/generate/provider.rb:43
698
+ msgid "Gemfile.optional.:development configuration not found"
699
+ msgstr ""
700
+
701
+ #: ../lib/pdk/generate/provider.rb:45
702
+ msgid "puppet-resource_api not found in the Gemfile config"
703
+ msgstr ""
704
+
705
+ #: ../lib/pdk/generate/provider.rb:47
706
+ msgid "spec/spec_helper.rb configuration not found"
707
+ msgstr ""
708
+
709
+ #: ../lib/pdk/generate/provider.rb:49
710
+ msgid "spec/spec_helper.rb.mock_with configuration not found"
711
+ msgstr ""
712
+
713
+ #: ../lib/pdk/generate/provider.rb:51
714
+ msgid "spec/spec_helper.rb.mock_with not set to ':rspec'"
715
+ msgstr ""
716
+
717
+ #: ../lib/pdk/generate/puppet_object.rb:97
566
718
  msgid "Unable to generate %{object_type}; '%{file}' already exists."
567
719
  msgstr ""
568
720
 
569
- #: ../lib/pdk/generate/puppet_object.rb:143
721
+ #: ../lib/pdk/generate/puppet_object.rb:162
570
722
  msgid "Creating '%{file}' from template."
571
723
  msgstr ""
572
724
 
573
- #: ../lib/pdk/generate/puppet_object.rb:150
725
+ #: ../lib/pdk/generate/puppet_object.rb:169
574
726
  msgid "Unable to create directory '%{path}': %{message}"
575
727
  msgstr ""
576
728
 
577
- #: ../lib/pdk/generate/puppet_object.rb:158
729
+ #: ../lib/pdk/generate/puppet_object.rb:177
578
730
  msgid "Unable to write to file '%{path}': %{message}"
579
731
  msgstr ""
580
732
 
581
- #: ../lib/pdk/generate/puppet_object.rb:181
733
+ #: ../lib/pdk/generate/puppet_object.rb:200
582
734
  msgid "No %{dir_type} template specified; trying next template directory."
583
735
  msgstr ""
584
736
 
585
- #: ../lib/pdk/generate/puppet_object.rb:194
737
+ #: ../lib/pdk/generate/puppet_object.rb:213
586
738
  msgid "Unable to find a %{type} template in %{url}; trying next template directory."
587
739
  msgstr ""
588
740
 
589
- #: ../lib/pdk/generate/puppet_object.rb:196
741
+ #: ../lib/pdk/generate/puppet_object.rb:215
590
742
  msgid "Unable to find the %{type} template in %{url}."
591
743
  msgstr ""
592
744
 
593
- #: ../lib/pdk/generate/puppet_object.rb:253
745
+ #: ../lib/pdk/generate/puppet_object.rb:272
594
746
  msgid "'%{dir}' does not contain valid Puppet module metadata: %{msg}"
595
747
  msgstr ""
596
748
 
@@ -598,43 +750,47 @@ msgstr ""
598
750
  msgid "A task named '%{name}' already exists in this module; defined in %{file}"
599
751
  msgstr ""
600
752
 
601
- #: ../lib/pdk/module/convert.rb:34
753
+ #: ../lib/pdk/module/build.rb:147
754
+ msgid "Symlinks in modules are not supported and will not be included in the package. Please investigate symlink %{from} -> %{to}."
755
+ msgstr ""
756
+
757
+ #: ../lib/pdk/module/convert.rb:23 ../lib/pdk/module/update.rb:17
602
758
  msgid "No changes required."
603
759
  msgstr ""
604
760
 
605
- #: ../lib/pdk/module/convert.rb:48
761
+ #: ../lib/pdk/module/convert.rb:34
606
762
  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."
607
763
  msgstr ""
608
764
 
609
- #: ../lib/pdk/module/convert.rb:53
765
+ #: ../lib/pdk/module/convert.rb:39 ../lib/pdk/module/update.rb:30
610
766
  msgid "Do you want to continue and make these changes to your module?"
611
767
  msgstr ""
612
768
 
613
- #: ../lib/pdk/module/convert.rb:82
614
- msgid "Unable to convert module metadata; %{path} exists but it is not readable."
769
+ #: ../lib/pdk/module/convert.rb:109
770
+ msgid "Unable to update module metadata; %{path} exists but it is not readable."
615
771
  msgstr ""
616
772
 
617
- #: ../lib/pdk/module/convert.rb:87
618
- msgid "Unable to convert module metadata; %{path} exists but it is not a file."
773
+ #: ../lib/pdk/module/convert.rb:114
774
+ msgid "Unable to update module metadata; %{path} exists but it is not a file."
619
775
  msgstr ""
620
776
 
621
- #: ../lib/pdk/module/convert.rb:126 ../lib/pdk/module/convert.rb:131 ../lib/pdk/module/convert.rb:135
777
+ #: ../lib/pdk/module/convert.rb:157 ../lib/pdk/module/convert.rb:162 ../lib/pdk/module/convert.rb:166
622
778
  msgid ""
623
779
  "\n"
624
780
  "%{banner}"
625
781
  msgstr ""
626
782
 
627
- #: ../lib/pdk/module/convert.rb:137
783
+ #: ../lib/pdk/module/convert.rb:168
628
784
  msgid ""
629
785
  "\n"
630
786
  "%{summary}\n"
631
787
  "\n"
632
788
  msgstr ""
633
789
 
634
- #: ../lib/pdk/module/convert.rb:147
790
+ #: ../lib/pdk/module/convert.rb:178
635
791
  msgid ""
636
792
  "\n"
637
- "You can find a report of differences in convert_report.txt.\n"
793
+ "You can find a report of differences in %{path}.\n"
638
794
  "\n"
639
795
  msgstr ""
640
796
 
@@ -650,23 +806,23 @@ msgstr ""
650
806
  msgid "Invalid JSON in metadata.json: %{msg}"
651
807
  msgstr ""
652
808
 
653
- #: ../lib/pdk/module/metadata.rb:101
809
+ #: ../lib/pdk/module/metadata.rb:114
654
810
  msgid "Field must be a dash-separated user name and module name."
655
811
  msgstr ""
656
812
 
657
- #: ../lib/pdk/module/metadata.rb:103
813
+ #: ../lib/pdk/module/metadata.rb:116
658
814
  msgid "Module name must contain only alphanumeric or underscore characters."
659
815
  msgstr ""
660
816
 
661
- #: ../lib/pdk/module/metadata.rb:105
817
+ #: ../lib/pdk/module/metadata.rb:118
662
818
  msgid "Module name must begin with a letter."
663
819
  msgstr ""
664
820
 
665
- #: ../lib/pdk/module/metadata.rb:107
821
+ #: ../lib/pdk/module/metadata.rb:120
666
822
  msgid "Namespace must contain only alphanumeric characters."
667
823
  msgstr ""
668
824
 
669
- #: ../lib/pdk/module/metadata.rb:110
825
+ #: ../lib/pdk/module/metadata.rb:123
670
826
  msgid "Invalid 'name' field in metadata.json: %{err}"
671
827
  msgstr ""
672
828
 
@@ -678,48 +834,72 @@ msgstr ""
678
834
  msgid "Unable to clone git repository '%{repo}' to '%{dest}'."
679
835
  msgstr ""
680
836
 
681
- #: ../lib/pdk/module/templatedir.rb:126
837
+ #: ../lib/pdk/module/templatedir.rb:128
682
838
  msgid "Rendering '%{template}'..."
683
839
  msgstr ""
684
840
 
685
- #: ../lib/pdk/module/templatedir.rb:131
841
+ #: ../lib/pdk/module/templatedir.rb:133
686
842
  msgid ""
687
843
  "Failed to render template '%{template}'\n"
688
844
  "%{exception}: %{message}"
689
845
  msgstr ""
690
846
 
691
- #: ../lib/pdk/module/templatedir.rb:192
847
+ #: ../lib/pdk/module/templatedir.rb:196
692
848
  msgid "The specified template '%{path}' is not a directory."
693
849
  msgstr ""
694
850
 
695
- #: ../lib/pdk/module/templatedir.rb:196
851
+ #: ../lib/pdk/module/templatedir.rb:200
696
852
  msgid "The template at '%{path}' does not contain a 'moduleroot/' directory."
697
853
  msgstr ""
698
854
 
699
- #: ../lib/pdk/module/templatedir.rb:201
855
+ #: ../lib/pdk/module/templatedir.rb:205
700
856
  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."
701
857
  msgstr ""
702
858
 
703
- #: ../lib/pdk/module/templatedir.rb:216
859
+ #: ../lib/pdk/module/templatedir.rb:220
704
860
  msgid "The directory '%{dir}' doesn't exist"
705
861
  msgstr ""
706
862
 
707
- #: ../lib/pdk/module/templatedir.rb:274
863
+ #: ../lib/pdk/module/templatedir.rb:278
708
864
  msgid "'%{file}' is not a valid YAML file: %{message}"
709
865
  msgstr ""
710
866
 
711
- #: ../lib/pdk/module/update_manager.rb:110
712
- msgid "Unable to open '%{path}' for reading"
867
+ #: ../lib/pdk/module/update.rb:13
868
+ msgid "This module is already up to date with version %{version} of the template."
713
869
  msgstr ""
714
870
 
715
- #: ../lib/pdk/module/update_manager.rb:129
716
- msgid "You do not have permission to write to '%{path}'"
871
+ #: ../lib/pdk/module/update.rb:97
872
+ msgid "Updating %{module_name} using the default template, from %{current_version} to %{new_version}"
717
873
  msgstr ""
718
874
 
719
- #: ../lib/pdk/module/update_manager.rb:144
875
+ #: ../lib/pdk/module/update.rb:99
876
+ msgid "Updating %{module_name} using the template at %{template_url}, from %{current_version} to %{new_version}"
877
+ msgstr ""
878
+
879
+ #: ../lib/pdk/module/update_manager.rb:109
880
+ msgid "unlinking '%{path}'"
881
+ msgstr ""
882
+
883
+ #: ../lib/pdk/module/update_manager.rb:112
884
+ msgid "'%{path}': already gone"
885
+ msgstr ""
886
+
887
+ #: ../lib/pdk/module/update_manager.rb:115
720
888
  msgid "Unable to remove '%{path}': %{message}"
721
889
  msgstr ""
722
890
 
891
+ #: ../lib/pdk/module/update_manager.rb:133
892
+ msgid "Unable to open '%{path}' for reading"
893
+ msgstr ""
894
+
895
+ #: ../lib/pdk/module/update_manager.rb:150
896
+ msgid "writing '%{path}'"
897
+ msgstr ""
898
+
899
+ #: ../lib/pdk/module/update_manager.rb:153
900
+ msgid "You do not have permission to write to '%{path}'"
901
+ msgstr ""
902
+
723
903
  #: ../lib/pdk/report/event.rb:175
724
904
  msgid "File not specified."
725
905
  msgstr ""
@@ -870,6 +1050,10 @@ msgid ""
870
1050
  "%{output}"
871
1051
  msgstr ""
872
1052
 
1053
+ #: ../lib/pdk/util/git.rb:47
1054
+ msgid "Unable to access the template repository \"%{repository}\""
1055
+ msgstr ""
1056
+
873
1057
  #: ../lib/pdk/validate/base_validator.rb:74
874
1058
  msgid "Invoking %{cmd}"
875
1059
  msgstr ""
@@ -934,7 +1118,7 @@ msgstr ""
934
1118
  msgid "Checking Puppet manifest style (%{pattern})."
935
1119
  msgstr ""
936
1120
 
937
- #: ../lib/pdk/validate/puppet/puppet_syntax.rb:21
1121
+ #: ../lib/pdk/validate/puppet/puppet_syntax.rb:40
938
1122
  msgid "Checking Puppet manifest syntax (%{pattern})."
939
1123
  msgstr ""
940
1124