puppet_forge 2.2.4 → 2.2.5

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
  SHA1:
3
- metadata.gz: 052203624976cb87f491f5f75bdc25b1c0d2b4e3
4
- data.tar.gz: 9c0fcd86efb6afd798b47391738af47f99837f8e
3
+ metadata.gz: bb6c13dde0b75c97be8726b4b9e754fba7a3c37e
4
+ data.tar.gz: 0d0e3a9112d81e3a459c7e37f245a6a0afe5d50e
5
5
  SHA512:
6
- metadata.gz: af53aa35169471736552e69d98c4d84dbb17d5710f46af80301e2f062c181b509343f0d73ca15ee41002882edb35b415e5ab923cd6930fe581c88ce70f7d9472
7
- data.tar.gz: 5ec3843bfa58d02ce337c20d1510e0f198cf4e0062166f56eb45eaf2460368894b40e1963f7ad74a58f260e2b61268a78314c92b080993ace956dfe24468c652
6
+ metadata.gz: b9d21c14690d2ae563bc1c166ffba9b7507d33cd9fbb5ef81d4ce2ba1351d4fc58fa486e0fec8470694cb746e3d32b31b4ae4e9d44eda6d72eb8c73e1934869f
7
+ data.tar.gz: f96f9901f85f25e04d3d800c54945212342c49b36391d999e670752c1eec0648a055559f23fe86c787324fea6e5165d899068190198ba6d8a5458b77b28ff4e4
@@ -3,6 +3,13 @@
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
+ ## v2.2.5 - 2017-06-26
7
+
8
+ ### Fixed
9
+
10
+ * (FORGE-338) Fixed an issue where `V3::Release.download_url` returned an incorrect value when `PuppetForge.host` included
11
+ a path prefix. (Thanks to [Jainish Shah](https://github.com/jainishshah17) for the report and initial fix proposal.)
12
+
6
13
  ## v2.2.4 - 2017-04-17
7
14
 
8
15
  ### Added
@@ -4,12 +4,21 @@ require 'gettext-setup'
4
4
  module PuppetForge
5
5
  class << self
6
6
  attr_accessor :user_agent
7
- attr_accessor :host
7
+ attr_reader :host
8
+
9
+ def host=(new_host)
10
+ new_host << '/' unless new_host[-1] == '/'
11
+
12
+ # TODO: maybe freeze this
13
+ @host = new_host
14
+ end
8
15
  end
9
16
 
10
17
  GettextSetup.initialize(File.absolute_path('../locales', File.dirname(__FILE__)))
11
18
 
12
- self.host = 'https://forgeapi.puppetlabs.com'
19
+ DEFAULT_FORGE_HOST = 'https://forgeapi.puppetlabs.com/'
20
+
21
+ self.host = DEFAULT_FORGE_HOST
13
22
 
14
23
  require 'puppet_forge/tar'
15
24
  require 'puppet_forge/unpacker'
@@ -13,7 +13,7 @@ module PuppetForge
13
13
  # @return [String] fully qualified download URL for release
14
14
  def download_url
15
15
  if URI.parse(file_uri).host.nil?
16
- URI.join(PuppetForge.host, file_uri).to_s
16
+ URI.join(PuppetForge.host, file_uri[1..-1]).to_s
17
17
  else
18
18
  file_uri
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module PuppetForge
2
- VERSION = '2.2.4' # Library version
2
+ VERSION = '2.2.5' # Library version
3
3
  end
@@ -96,6 +96,21 @@ describe PuppetForge::V3::Release do
96
96
  release.file_uri = 'https://example.com/v3/files/puppetlabs-apache-0.0.1.tar.gz'
97
97
  expect(release.download_url).to eql('https://example.com/v3/files/puppetlabs-apache-0.0.1.tar.gz')
98
98
  end
99
+
100
+ context 'when PuppetForge.host has a path prefix' do
101
+ around(:each) do |spec|
102
+ old_host = PuppetForge.host
103
+ PuppetForge.host = 'http://example.com/forge/api/'
104
+
105
+ spec.run
106
+
107
+ PuppetForge.host = old_host
108
+ end
109
+
110
+ it 'includes path prefix in download url' do
111
+ expect(release.download_url).to eql('http://example.com/forge/api/v3/files/puppetlabs-apache-0.0.1.tar.gz')
112
+ end
113
+ end
99
114
  end
100
115
 
101
116
  describe '#download' do
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe PuppetForge do
4
+ describe 'host attribute' do
5
+ after(:each) do
6
+ PuppetForge.host = PuppetForge::DEFAULT_FORGE_HOST
7
+ end
8
+
9
+ it 'should add a trailing slash if not present' do
10
+ PuppetForge.host = 'http://example.com'
11
+
12
+ expect(PuppetForge.host[-1,1]).to eq '/'
13
+ end
14
+ end
15
+ 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: 2.2.4
4
+ version: 2.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-17 00:00:00.000000000 Z
11
+ date: 2017-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -282,6 +282,7 @@ files:
282
282
  - spec/unit/forge/v3/module_spec.rb
283
283
  - spec/unit/forge/v3/release_spec.rb
284
284
  - spec/unit/forge/v3/user_spec.rb
285
+ - spec/unit/puppet_forge_spec.rb
285
286
  homepage: https://github.com/puppetlabs/forge-ruby
286
287
  licenses:
287
288
  - Apache-2.0
@@ -357,4 +358,5 @@ test_files:
357
358
  - spec/unit/forge/v3/module_spec.rb
358
359
  - spec/unit/forge/v3/release_spec.rb
359
360
  - spec/unit/forge/v3/user_spec.rb
361
+ - spec/unit/puppet_forge_spec.rb
360
362
  has_rdoc: