puppet_forge 3.1.0 → 3.2.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.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/CHANGELOG.md +5 -0
- data/README.md +0 -20
- data/Rakefile +0 -6
- data/lib/puppet_forge/connection/connection_failure.rb +3 -13
- data/lib/puppet_forge/connection.rb +1 -0
- data/lib/puppet_forge/error.rb +6 -2
- data/lib/puppet_forge/lazy_relations.rb +1 -1
- data/lib/puppet_forge/unpacker.rb +2 -2
- data/lib/puppet_forge/v3/metadata.rb +9 -8
- data/lib/puppet_forge/v3/release.rb +1 -1
- data/lib/puppet_forge/version.rb +1 -1
- data/lib/puppet_forge.rb +0 -3
- data/puppet_forge.gemspec +0 -1
- metadata +2 -17
- data/locales/config.yaml +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14fb262a13e9382bc404ebf162e70c8fa48ccd73f33f53113e75524da106bed9
|
4
|
+
data.tar.gz: 0316cbac8bd7c7d3dc18d792a0dfc25a4cca095fce0974a5f54a50e546ef1c92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f909a3a4b8bf942f104f1a9f5a798edeb8a29e03adaaa24dbd4170efd97f2e09c23ef44b3b88ad406d32d5d10aba98d382d21ce10e1db115ee5c87d8cd01e30f
|
7
|
+
data.tar.gz: 2da931edf4e563a6e0962d834c9e3db3dec6ff33fd9a172f5d50a12066863b336fae173c8ad860d6c85f6df1ef02da4e1e0fc61e0a3182e92552ac988db3ce7b
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
3
3
|
Starting with v2.0.0, all notable changes to this project will be documented in this file.
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## v3.2.0 - 2021-11-09
|
7
|
+
|
8
|
+
* Allow requests to follow redirects
|
9
|
+
* Remove the `gettext-setup` gem dependency, which was unused
|
10
|
+
|
6
11
|
## v3.1.0 - 2021-08-20
|
7
12
|
|
8
13
|
### Changed
|
data/README.md
CHANGED
@@ -205,26 +205,6 @@ PuppetForge::Connection.authorization = "<your-api-key-here>"
|
|
205
205
|
|
206
206
|
You can generate API keys on your user profile page once you've [logged into the Forge website](https://forge.puppet.com/login).
|
207
207
|
|
208
|
-
### i18n
|
209
|
-
|
210
|
-
When adding new error or log messages please follow the instructions for
|
211
|
-
[writing translatable code](https://github.com/puppetlabs/gettext-setup-gem#writing-translatable-code).
|
212
|
-
|
213
|
-
The PuppetForge gem will default to outputing all error messages in English, but you may set the locale
|
214
|
-
using the `FastGettext.set_locale` method. If translations do not exist for the language you request then the gem will
|
215
|
-
default to English. The `set_locale` method will return the locale, as a string, that FastGettext will now
|
216
|
-
use to report PuppetForge errors.
|
217
|
-
|
218
|
-
```ruby
|
219
|
-
# Assuming the German translations exist, this will set the reporting language
|
220
|
-
# to German
|
221
|
-
|
222
|
-
locale = FastGettext.set_locale "de_DE"
|
223
|
-
|
224
|
-
# If it successfully finds Germany's locale, locale will be "de_DE"
|
225
|
-
# If it fails to find any German locale, locale will be "en"
|
226
|
-
```
|
227
|
-
|
228
208
|
## Caveats
|
229
209
|
|
230
210
|
This library currently does no response caching of its own, instead opting to
|
data/Rakefile
CHANGED
@@ -9,21 +9,11 @@ module PuppetForge
|
|
9
9
|
@app.call(env)
|
10
10
|
rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e
|
11
11
|
baseurl = env[:url].dup
|
12
|
+
errmsg = "Unable to connect to %{scheme}://%{host}" % { scheme: baseurl.scheme, host: baseurl.host }
|
12
13
|
if proxy = env[:request][:proxy]
|
13
|
-
errmsg
|
14
|
-
scheme: baseurl.scheme,
|
15
|
-
host: baseurl.host,
|
16
|
-
proxy: proxy.uri.to_s,
|
17
|
-
path_query: baseurl.request_uri,
|
18
|
-
}
|
19
|
-
else
|
20
|
-
errmsg = _("Unable to connect to %{scheme}://%{host} (for request %{path_query})") % {
|
21
|
-
scheme: baseurl.scheme,
|
22
|
-
host: baseurl.host,
|
23
|
-
path_query: baseurl.request_uri,
|
24
|
-
}
|
14
|
+
errmsg << " (using proxy %{proxy})" % { proxy: proxy.uri.to_s }
|
25
15
|
end
|
26
|
-
errmsg << ":
|
16
|
+
errmsg << " (for request %{path_query}): %{message}" % { message: e.message, path_query: baseurl.request_uri }
|
27
17
|
m = Faraday::ConnectionFailed.new(errmsg)
|
28
18
|
m.set_backtrace(e.backtrace)
|
29
19
|
raise m
|
@@ -115,6 +115,7 @@ module PuppetForge
|
|
115
115
|
end
|
116
116
|
|
117
117
|
Faraday.new(url, options) do |builder|
|
118
|
+
builder.use FaradayMiddleware::FollowRedirects
|
118
119
|
builder.response(:json, :content_type => /\bjson$/, :parser_options => { :symbolize_names => true })
|
119
120
|
builder.response(:raise_error)
|
120
121
|
builder.use(:connection_failure)
|
data/lib/puppet_forge/error.rb
CHANGED
@@ -16,11 +16,15 @@ module PuppetForge
|
|
16
16
|
def initialize(options)
|
17
17
|
@entry_path = options[:entry_path]
|
18
18
|
@directory = options[:directory]
|
19
|
-
super
|
19
|
+
super "Attempt to install file into #{@entry_path.inspect} under #{@directory.inspect}"
|
20
20
|
end
|
21
21
|
|
22
22
|
def multiline
|
23
|
-
|
23
|
+
<<-MSG.strip
|
24
|
+
Could not install package
|
25
|
+
Package attempted to install file into
|
26
|
+
#{@entry_path.inspect} under #{@directory.inspect}.
|
27
|
+
MSG
|
24
28
|
end
|
25
29
|
end
|
26
30
|
|
@@ -24,7 +24,7 @@ module PuppetForge
|
|
24
24
|
version = class_name.split("::")[-2]
|
25
25
|
|
26
26
|
if version.nil?
|
27
|
-
raise RuntimeError,
|
27
|
+
raise RuntimeError, "Unable to determine the parent PuppetForge version module"
|
28
28
|
end
|
29
29
|
|
30
30
|
PuppetForge.const_get(version)
|
@@ -39,7 +39,7 @@ module PuppetForge
|
|
39
39
|
begin
|
40
40
|
PuppetForge::Tar.instance.unpack(@filename, @tmpdir)
|
41
41
|
rescue PuppetForge::ExecutionFailure => e
|
42
|
-
raise RuntimeError,
|
42
|
+
raise RuntimeError, "Could not extract contents of module archive: #{e.message}"
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -61,7 +61,7 @@ module PuppetForge
|
|
61
61
|
if metadata_file
|
62
62
|
@root_dir = Pathname.new(metadata_file).dirname
|
63
63
|
else
|
64
|
-
raise
|
64
|
+
raise "No valid metadata.json found!"
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -63,7 +63,7 @@ module PuppetForge
|
|
63
63
|
validate_version_range(version_requirement) if version_requirement
|
64
64
|
|
65
65
|
if dup = @data['dependencies'].find { |d| d.full_module_name == name && d.version_requirement != version_requirement }
|
66
|
-
raise ArgumentError,
|
66
|
+
raise ArgumentError, "Dependency conflict for #{full_module_name}: Dependency #{name} was given conflicting version requirements #{version_requirement} and #{dup.version_requirement}. Verify that there are no duplicates in the metadata.json or the Modulefile."
|
67
67
|
end
|
68
68
|
|
69
69
|
dep = Dependency.new(name, version_requirement, repository)
|
@@ -165,30 +165,31 @@ module PuppetForge
|
|
165
165
|
|
166
166
|
err = case modname
|
167
167
|
when nil, '', :namespace_missing
|
168
|
-
|
168
|
+
"the field must be a namespaced module name"
|
169
169
|
when /[^a-z0-9_]/i
|
170
|
-
|
170
|
+
"the module name contains non-alphanumeric (or underscore) characters"
|
171
171
|
when /^[^a-z]/i
|
172
|
-
|
172
|
+
"the module name must begin with a letter"
|
173
173
|
else
|
174
|
-
|
174
|
+
"the namespace contains non-alphanumeric characters"
|
175
175
|
end
|
176
176
|
|
177
|
-
raise ArgumentError,
|
177
|
+
raise ArgumentError, "Invalid 'name' field in metadata.json: #{err}"
|
178
178
|
end
|
179
179
|
|
180
180
|
# Validates that the version string can be parsed by SemanticPuppet.
|
181
181
|
def validate_version(version)
|
182
182
|
return if SemanticPuppet::Version.valid?(version)
|
183
183
|
|
184
|
-
|
184
|
+
err = "version string cannot be parsed as a valid Semantic Version"
|
185
|
+
raise ArgumentError, "Invalid 'version' field in metadata.json: #{err}"
|
185
186
|
end
|
186
187
|
|
187
188
|
# Validates that the version range can be parsed by SemanticPuppet.
|
188
189
|
def validate_version_range(version_range)
|
189
190
|
SemanticPuppet::VersionRange.parse(version_range)
|
190
191
|
rescue ArgumentError => e
|
191
|
-
raise ArgumentError,
|
192
|
+
raise ArgumentError, "Invalid 'version_range' field in metadata.json: #{e}"
|
192
193
|
end
|
193
194
|
end
|
194
195
|
end
|
@@ -29,7 +29,7 @@ module PuppetForge
|
|
29
29
|
resp = self.class.conn.get(download_url)
|
30
30
|
path.open('wb') { |fh| fh.write(resp.body) }
|
31
31
|
rescue Faraday::ResourceNotFound => e
|
32
|
-
raise PuppetForge::ReleaseNotFound,
|
32
|
+
raise PuppetForge::ReleaseNotFound, "The module release #{slug} does not exist on #{self.class.conn.url_prefix}.", e.backtrace
|
33
33
|
rescue Faraday::ClientError => e
|
34
34
|
if e.response && e.response[:status] == 403
|
35
35
|
raise PuppetForge::ReleaseForbidden.from_response(e.response)
|
data/lib/puppet_forge/version.rb
CHANGED
data/lib/puppet_forge.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'puppet_forge/version'
|
2
|
-
require 'gettext-setup'
|
3
2
|
|
4
3
|
module PuppetForge
|
5
4
|
class << self
|
@@ -15,8 +14,6 @@ module PuppetForge
|
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
|
-
GettextSetup.initialize(File.absolute_path('../locales', File.dirname(__FILE__)))
|
19
|
-
|
20
17
|
DEFAULT_FORGE_HOST = 'https://forgeapi.puppet.com/'
|
21
18
|
|
22
19
|
self.host = DEFAULT_FORGE_HOST
|
data/puppet_forge.gemspec
CHANGED
@@ -24,7 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_runtime_dependency "faraday_middleware", "~> 1.0"
|
25
25
|
spec.add_dependency "semantic_puppet", "~> 1.0"
|
26
26
|
spec.add_dependency "minitar"
|
27
|
-
spec.add_dependency "gettext-setup", "~> 0.11"
|
28
27
|
|
29
28
|
spec.add_development_dependency "rake"
|
30
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet_forge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: gettext-setup
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0.11'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0.11'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rake
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,7 +198,6 @@ files:
|
|
212
198
|
- lib/puppet_forge/v3/release.rb
|
213
199
|
- lib/puppet_forge/v3/user.rb
|
214
200
|
- lib/puppet_forge/version.rb
|
215
|
-
- locales/config.yaml
|
216
201
|
- puppet_forge.gemspec
|
217
202
|
- spec/fixtures/uri/prefix/v3/bases/puppet.headers
|
218
203
|
- spec/fixtures/uri/prefix/v3/bases/puppet.json
|
data/locales/config.yaml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
---
|
2
|
-
# This is the project-specific configuration file for setting up
|
3
|
-
# fast_gettext for your project.
|
4
|
-
gettext:
|
5
|
-
# This is used for the name of the .pot and .po files; they will be
|
6
|
-
# called <project_name>.pot?
|
7
|
-
project_name: 'forge-ruby'
|
8
|
-
# This is used in comments in the .pot and .po files to indicate what
|
9
|
-
# project the files belong to and should bea little more desctiptive than
|
10
|
-
# <project_name>
|
11
|
-
package_name: Puppet Forge Gem
|
12
|
-
# The locale that the default messages in the .pot file are in
|
13
|
-
default_locale: en
|
14
|
-
# The email used for sending bug reports.
|
15
|
-
bugs_address: docs@puppetlabs.com
|
16
|
-
# The holder of the copyright.
|
17
|
-
copyright_holder: Puppet, Inc.
|
18
|
-
# Patterns for +Dir.glob+ used to find all files that might contain
|
19
|
-
# translatable content, relative to the project root directory
|
20
|
-
source_files:
|
21
|
-
- 'lib/**/*.rb'
|