puppet_forge 3.1.0 → 4.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e92036b548aa46fca8fb793b61ea0440812fea1e9dcada78d402a39be216fdf9
4
- data.tar.gz: e0a230adaf5703424981c755fd05a893520c16703904ac20d3b503ba75b48f1c
3
+ metadata.gz: a0e379f885f305dfc82f87bfea6ae668d6467595f0083355cbe95c63e9864019
4
+ data.tar.gz: 1cf23ce28776267459e01bedfed935750650378542b54e1ec3155efb9b67ba60
5
5
  SHA512:
6
- metadata.gz: 2a7ec0344a4f7a2f2d6ecc674a50bc0c9b95b08b44a26f52551bb97b4becfcc2f17d226bd18cbc5773370b53d9f9bac95df39e90d1eb3b6c95742b8e6ed42455
7
- data.tar.gz: 71424aa172611723b89edb31fa249beba56d73cab50db3ae180bead75eb0486ff194be3131d5f452fd3353c227630804d8e4f0432d99bf9000e296b7a405cad5
6
+ metadata.gz: b32e4f0758fe84f28339cc8a3f57dad01a21abc26a490e7d1b8ac1a4ecdc6e52b961e4c24f0f4a5b476c4fc1ed849bfb42594314a120f6198c06261036702457
7
+ data.tar.gz: 044a092e9f8e15f078043281bac236c8694c037a1f71bb34a4d0e392379811e88ac9981afa6d75661cc5483a7a3966af26def433fe2eeb370c9f2d80499fbcba
@@ -14,7 +14,11 @@ jobs:
14
14
  runs-on: ubuntu-latest
15
15
  strategy:
16
16
  matrix:
17
- ruby: [2.7, 2.6, 2.5]
17
+ ruby:
18
+ - '3.1'
19
+ - '3.0'
20
+ - '2.7'
21
+ - '2.6'
18
22
 
19
23
  steps:
20
24
  - uses: actions/checkout@v1
@@ -22,9 +26,7 @@ jobs:
22
26
  uses: ruby/setup-ruby@v1
23
27
  with:
24
28
  ruby-version: ${{ matrix.ruby }}
29
+ bundler-cache: true
25
30
 
26
31
  - name: Build and test with Rspec
27
- run: |
28
- gem install bundler
29
- bundle install --jobs 4 --retry 3
30
- bundle exec rspec
32
+ run: bundle exec rspec
@@ -0,0 +1,24 @@
1
+ name: snyk_merge
2
+ on:
3
+ workflow_dispatch:
4
+ push:
5
+ branches:
6
+ - main
7
+ jobs:
8
+ security:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@master
12
+ - name: setup ruby
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.7
16
+ - name: create lock
17
+ run: bundle lock
18
+ - name: Run Snyk to check for vulnerabilities
19
+ uses: snyk/actions/ruby@master
20
+ env:
21
+ SNYK_TOKEN: ${{ secrets.SNYK_FORGE_KEY }}
22
+ with:
23
+ command: monitor
24
+ args: --org=puppet-forge
data/.gitignore CHANGED
@@ -20,4 +20,3 @@ _yardoc
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
- locales/forge-ruby.pot
data/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
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
+ ## v4.0.0 - 2022-11-30
7
+
8
+ * Breaking: The `puppet_forge` gem now requires at least Ruby 2.6.0
9
+ * Update `faraday` gem to 2.x series
10
+
11
+ ## v3.2.0 - 2021-11-09
12
+
13
+ * Allow requests to follow redirects
14
+ * Remove the `gettext-setup` gem dependency, which was unused
15
+
6
16
  ## v3.1.0 - 2021-08-20
7
17
 
8
18
  ### 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
@@ -1,7 +1 @@
1
1
  require "bundler/gem_tasks"
2
-
3
- # i18n/gettext Rake tasks
4
- spec = Gem::Specification.find_by_name 'gettext-setup'
5
- load "#{spec.gem_dir}/lib/tasks/gettext.rake"
6
- GettextSetup.initialize(File.absolute_path('locales', File.dirname(__FILE__)))
7
-
@@ -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 = _("Unable to connect to %{scheme}://%{host} (using proxy %{proxy}) (for request %{path_query})") % {
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 << ": #{e.message}"
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
@@ -32,4 +22,4 @@ module PuppetForge
32
22
  end
33
23
  end
34
24
 
35
- Faraday::Middleware.register_middleware(:connection_failure => lambda { PuppetForge::Connection::ConnectionFailure })
25
+ Faraday::Middleware.register_middleware(:connection_failure => PuppetForge::Connection::ConnectionFailure)
@@ -1,7 +1,7 @@
1
1
  require 'puppet_forge/connection/connection_failure'
2
2
 
3
3
  require 'faraday'
4
- require 'faraday_middleware'
4
+ require 'faraday/follow_redirects'
5
5
 
6
6
  module PuppetForge
7
7
  # Provide a common mixin for adding a HTTP connection to classes.
@@ -115,6 +115,7 @@ module PuppetForge
115
115
  end
116
116
 
117
117
  Faraday.new(url, options) do |builder|
118
+ builder.use Faraday::FollowRedirects::Middleware
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)
@@ -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 _("Attempt to install file into %{path} under %{directory}") % {path: @entry_path.inspect, directory: @directory.inspect}
19
+ super "Attempt to install file into #{@entry_path.inspect} under #{@directory.inspect}"
20
20
  end
21
21
 
22
22
  def multiline
23
- _("Could not install package\n Package attempted to install file into\n %{path} under %{directory}.") % {path: @entry_path.inspect, directory: @directory.inspect}
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, _("Unable to determine the parent PuppetForge version module")
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, _("Could not extract contents of module archive: %{error_msg}") % {error_msg: e.message}
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 _("No valid metadata.json found!")
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, _("Dependency conflict for %{module_name}: Dependency %{conflict_name} was given conflicting version requirements %{version} and %{conflict_version}. Verify that there are no duplicates in the metadata.json or the Modulefile.") % {module_name: full_module_name, conflict_name: name, version: version_requirement, conflict_version: dup.version_requirement}
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
- _("the field must be a namespaced module name")
168
+ "the field must be a namespaced module name"
169
169
  when /[^a-z0-9_]/i
170
- _("the module name contains non-alphanumeric (or underscore) characters")
170
+ "the module name contains non-alphanumeric (or underscore) characters"
171
171
  when /^[^a-z]/i
172
- _("the module name must begin with a letter")
172
+ "the module name must begin with a letter"
173
173
  else
174
- _("the namespace contains non-alphanumeric characters")
174
+ "the namespace contains non-alphanumeric characters"
175
175
  end
176
176
 
177
- raise ArgumentError, _("Invalid 'name' field in metadata.json: %{error}") % {error: err}
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
- raise ArgumentError, _("Invalid 'version' field in metadata.json: version string cannot be parsed as a valid Semantic Version")
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, _("Invalid 'version_range' field in metadata.json: %{error}") % {error: e}
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, (_("The module release %{release_slug} does not exist on %{url}.") % {release_slug: slug, url: self.class.conn.url_prefix}), e.backtrace
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)
@@ -1,3 +1,3 @@
1
1
  module PuppetForge
2
- VERSION = '3.1.0' # Library version
2
+ VERSION = '4.0.0' # Library version
3
3
  end
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
@@ -18,13 +18,12 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.required_ruby_version = '>= 2.4.0'
21
+ spec.required_ruby_version = '>= 2.6.0'
22
22
 
23
- spec.add_runtime_dependency "faraday", "~> 1.3"
24
- spec.add_runtime_dependency "faraday_middleware", "~> 1.0"
23
+ spec.add_runtime_dependency "faraday", "~> 2.0"
24
+ spec.add_runtime_dependency "faraday-follow_redirects", "~> 0.3.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"
@@ -32,8 +31,5 @@ Gem::Specification.new do |spec|
32
31
  spec.add_development_dependency "cane"
33
32
  spec.add_development_dependency "yard"
34
33
  spec.add_development_dependency "redcarpet"
35
-
36
- # Install the right pry debugging combo depending on ruby version.
37
- spec.add_development_dependency "pry-debugger" if RUBY_VERSION <= '1.9.3'
38
- spec.add_development_dependency "pry-byebug" if RUBY_VERSION >= '2.0.0'
34
+ spec.add_development_dependency "pry-byebug"
39
35
  end
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.1.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-20 00:00:00.000000000 Z
11
+ date: 2022-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: faraday_middleware
28
+ name: faraday-follow_redirects
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: 0.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: 0.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: semantic_puppet
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -187,6 +173,7 @@ extensions: []
187
173
  extra_rdoc_files: []
188
174
  files:
189
175
  - ".github/workflows/ruby-rspec.yml"
176
+ - ".github/workflows/snyk_merge.yml"
190
177
  - ".gitignore"
191
178
  - CHANGELOG.md
192
179
  - CODEOWNERS
@@ -212,7 +199,6 @@ files:
212
199
  - lib/puppet_forge/v3/release.rb
213
200
  - lib/puppet_forge/v3/user.rb
214
201
  - lib/puppet_forge/version.rb
215
- - locales/config.yaml
216
202
  - puppet_forge.gemspec
217
203
  - spec/fixtures/uri/prefix/v3/bases/puppet.headers
218
204
  - spec/fixtures/uri/prefix/v3/bases/puppet.json
@@ -265,7 +251,7 @@ homepage: https://github.com/puppetlabs/forge-ruby
265
251
  licenses:
266
252
  - Apache-2.0
267
253
  metadata: {}
268
- post_install_message:
254
+ post_install_message:
269
255
  rdoc_options: []
270
256
  require_paths:
271
257
  - lib
@@ -273,7 +259,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
273
259
  requirements:
274
260
  - - ">="
275
261
  - !ruby/object:Gem::Version
276
- version: 2.4.0
262
+ version: 2.6.0
277
263
  required_rubygems_version: !ruby/object:Gem::Requirement
278
264
  requirements:
279
265
  - - ">="
@@ -281,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
267
  version: '0'
282
268
  requirements: []
283
269
  rubygems_version: 3.1.6
284
- signing_key:
270
+ signing_key:
285
271
  specification_version: 4
286
272
  summary: Access the Puppet Forge API from Ruby for resource information and to download
287
273
  releases.
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'