puppet_forge 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/lib/puppet_forge/connection.rb +1 -0
- data/lib/puppet_forge/v3/release.rb +1 -1
- data/lib/puppet_forge/version.rb +1 -1
- data/spec/unit/forge/connection_spec.rb +27 -0
- data/spec/unit/forge/v3/release_spec.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 274c0fbddb8599de6d21476810d91eb298e88720
|
4
|
+
data.tar.gz: 147c3aadd5fe7c3fc6cc1d2ebca74916049d2925
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca092a41b2952ab4a8564e136a3b9562eeba61830863be6c8871baa2fa6a3c6bbae1d4aee56add286f9ff55c0bbe3bb16c4ed7634dbf4e790429edc57cc655ef
|
7
|
+
data.tar.gz: 564152499bcfd5b418a3842da2ff8d202194ab3f66997aacb4e0ddef7ab5c787858f7463b60e70ff84363654245e30bfb13924b5edb073e743137cc21da6bdf1
|
data/CHANGELOG.md
CHANGED
@@ -3,11 +3,21 @@
|
|
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.1 - 2016-05-24
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
|
10
|
+
* Fixed an issue where certain types of connection failures raised a spurious "method missing" error instead of the underlying
|
11
|
+
exception.
|
12
|
+
* When setting PuppetForge::Connection.proxy, an empty string will now be treated as nil. If no proxy has yet been configured,
|
13
|
+
setting to an empty string will have no effect. If a proxy has already been configured, setting to nil will unset the existing
|
14
|
+
value.
|
15
|
+
|
6
16
|
## v2.2.0 - 2016-05-10
|
7
17
|
|
8
18
|
### Changed
|
9
19
|
|
10
|
-
* puppet\_forge's optional dependency on Typhoeus now searches for a gem matching '~> 1.0.1' so it will pick up more recent versions.
|
20
|
+
* puppet\_forge's optional dependency on Typhoeus now searches for a gem matching '~> 1.0.1' so it will pick up more recent versions.
|
11
21
|
NOTE: This means if you have a version of Typhoeus installed that is less than 1.0.1, puppet\_forge will no longer use the Typhoeus
|
12
22
|
adapter and will fall back to Ruby's Net::HTTP library.
|
13
23
|
|
@@ -29,7 +29,7 @@ module PuppetForge
|
|
29
29
|
rescue Faraday::ResourceNotFound => e
|
30
30
|
raise PuppetForge::ReleaseNotFound, "The module release #{slug} does not exist on #{self.class.conn.url_prefix}.", e.backtrace
|
31
31
|
rescue Faraday::ClientError => e
|
32
|
-
if e.response[:status] == 403
|
32
|
+
if e.response && e.response[:status] == 403
|
33
33
|
raise PuppetForge::ReleaseForbidden.from_response(e.response)
|
34
34
|
else
|
35
35
|
raise e
|
data/lib/puppet_forge/version.rb
CHANGED
@@ -9,6 +9,33 @@ describe PuppetForge::Connection do
|
|
9
9
|
PuppetForge::Connection
|
10
10
|
end
|
11
11
|
|
12
|
+
describe 'class methods' do
|
13
|
+
subject { described_class }
|
14
|
+
|
15
|
+
describe '#proxy=' do
|
16
|
+
it "sets @proxy to value when passed non-empty string" do
|
17
|
+
proxy = "http://proxy.example.com:3128"
|
18
|
+
|
19
|
+
subject.proxy = proxy
|
20
|
+
|
21
|
+
expect(subject.instance_variable_get(:@proxy)).to eq proxy
|
22
|
+
end
|
23
|
+
|
24
|
+
it "sets @proxy to nil when passed an empty string" do
|
25
|
+
subject.proxy = ''
|
26
|
+
|
27
|
+
expect(subject.instance_variable_get(:@proxy)).to be_nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it "replaces existing @proxy value with nil when set to empty string" do
|
31
|
+
subject.instance_variable_set(:@proxy, 'value')
|
32
|
+
subject.proxy = ''
|
33
|
+
|
34
|
+
expect(subject.instance_variable_get(:@proxy)).to be_nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
12
39
|
describe 'creating a new connection' do
|
13
40
|
|
14
41
|
let(:faraday_stubs) { Faraday::Adapter::Test::Stubs.new }
|
@@ -110,6 +110,28 @@ describe PuppetForge::V3::Release do
|
|
110
110
|
release.download(Pathname.new(tarball))
|
111
111
|
expect(File.exist?(tarball)).to be true
|
112
112
|
end
|
113
|
+
|
114
|
+
context 'when response is 403' do
|
115
|
+
it "raises PuppetForge::ReleaseForbidden" do
|
116
|
+
mock_conn = instance_double("PuppetForge::V3::Connection", :url_prefix => PuppetForge.host)
|
117
|
+
allow(described_class).to receive(:conn).and_return(mock_conn)
|
118
|
+
|
119
|
+
expect(mock_conn).to receive(:get).and_raise(Faraday::ClientError.new("403", {:status => 403, :body => ({:message => "Forbidden"}.to_json)}))
|
120
|
+
|
121
|
+
expect { release.download(Pathname.new(tarball)) }.to raise_error(PuppetForge::ReleaseForbidden)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
context 'when connection fails' do
|
126
|
+
it "re-raises original error" do
|
127
|
+
mock_conn = instance_double("PuppetForge::V3::Connection", :url_prefix => PuppetForge.host)
|
128
|
+
allow(described_class).to receive(:conn).and_return(mock_conn)
|
129
|
+
|
130
|
+
expect(mock_conn).to receive(:get).and_raise(Faraday::ConnectionFailed.new("connection failed"))
|
131
|
+
|
132
|
+
expect { release.download(Pathname.new(tarball)) }.to raise_error(Faraday::ConnectionFailed, /connection failed/)
|
133
|
+
end
|
134
|
+
end
|
113
135
|
end
|
114
136
|
|
115
137
|
describe '#metadata' do
|
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
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|