gems 0.8.2 → 0.8.3

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.
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- Nn�K ,r��aiAY"�K�n�<�a��:�}kf��s�x R)α09�:o�Ƣ�n������PP�I�;$�no��b�!��` .���Ɗ��4�rsu�Q�T)n�?c<W��V��E05Tӗ��.��XD�V�?D�%v7�Aw���+2Թ���Em2����=熬��L��% /؛�Sjn2:��gi��iP/aD�ċ��C�D�[%��W1A���64��c`�)lҺ�u�+kv)�����
1
+ ���:q��
2
+ ���O�~,��zťZ������SȰ�{ҚS��Bڪ2<(��/h� �y�S�;�C#�� �x~C(�]�d��we�;�!�F�f���="�U�5�P�T��%�lG����r�旪�48V���w0*�� �?�V� oQ���?���X���ܒ�=���m�%B�����p��Q�9r�-�1ύn�����[��kܟ8|,�OS!a�������p<�6�cj�,8�Ͼ�p�evz(c�_�?�4_w
@@ -55,15 +55,16 @@ module Gems
55
55
  YAML.load(response)
56
56
  end
57
57
 
58
- # Submit a gem to RubyGems.org
58
+ # Submit a gem to RubyGems.org or another host
59
59
  #
60
60
  # @authenticated true
61
61
  # @param gem [File] A built gem.
62
+ # @param host [String] A RubyGems compatible host to use.
62
63
  # @return [String]
63
64
  # @example
64
65
  # Gems.push File.new 'pkg/gemcutter-0.2.1.gem'
65
- def push(gem)
66
- post("/api/v1/gems", gem.read, 'application/octet-stream')
66
+ def push(gem, host=Configuration::DEFAULT_HOST)
67
+ post("/api/v1/gems", gem.read, 'application/octet-stream', host)
67
68
  end
68
69
 
69
70
  # Remove a gem from RubyGems.org's index
@@ -4,20 +4,20 @@ require 'uri'
4
4
 
5
5
  module Gems
6
6
  module Request
7
- def delete(path, data={}, content_type='application/x-www-form-urlencoded')
8
- request(:delete, path, data, content_type)
7
+ def delete(path, data={}, content_type='application/x-www-form-urlencoded', request_host = host)
8
+ request(:delete, path, data, content_type, request_host)
9
9
  end
10
10
 
11
- def get(path, data={}, content_type='application/x-www-form-urlencoded')
12
- request(:get, path, data, content_type)
11
+ def get(path, data={}, content_type='application/x-www-form-urlencoded', request_host = host)
12
+ request(:get, path, data, content_type, request_host)
13
13
  end
14
14
 
15
- def post(path, data={}, content_type='application/x-www-form-urlencoded')
16
- request(:post, path, data, content_type)
15
+ def post(path, data={}, content_type='application/x-www-form-urlencoded', request_host = host)
16
+ request(:post, path, data, content_type, request_host)
17
17
  end
18
18
 
19
- def put(path, data={}, content_type='application/x-www-form-urlencoded')
20
- request(:put, path, data, content_type)
19
+ def put(path, data={}, content_type='application/x-www-form-urlencoded', request_host = host)
20
+ request(:put, path, data, content_type, request_host)
21
21
  end
22
22
 
23
23
  private
@@ -2,7 +2,7 @@ module Gems
2
2
  class Version
3
3
  MAJOR = 0 unless defined? Gems::Version::MAJOR
4
4
  MINOR = 8 unless defined? Gems::Version::MINOR
5
- PATCH = 2 unless defined? Gems::Version::PATCH
5
+ PATCH = 3 unless defined? Gems::Version::PATCH
6
6
  PRE = nil unless defined? Gems::Version::PRE
7
7
 
8
8
  class << self
@@ -56,14 +56,29 @@ describe Gems::Client do
56
56
  end
57
57
 
58
58
  describe "#push" do
59
- before do
60
- stub_post("/api/v1/gems").
61
- to_return(:body => fixture("push"))
59
+ context "without the host parameter" do
60
+ before do
61
+ stub_post("/api/v1/gems").
62
+ to_return(:body => fixture("push"))
63
+ end
64
+
65
+ it "submits a gem to RubyGems.org" do
66
+ push = Gems.push(File.new(File.expand_path("../../fixtures/gems-0.0.8.gem", __FILE__), "rb"))
67
+ expect(a_post("/api/v1/gems")).to have_been_made
68
+ expect(push).to eq "Successfully registered gem: gems (0.0.8)"
69
+ end
62
70
  end
63
- it "submits a gem to RubyGems.org" do
64
- push = Gems.push(File.new(File.expand_path("../../fixtures/gems-0.0.8.gem", __FILE__), "rb"))
65
- expect(a_post("/api/v1/gems")).to have_been_made
66
- expect(push).to eq "Successfully registered gem: gems (0.0.8)"
71
+
72
+ context "with the host parameter" do
73
+ before do
74
+ stub_post("http://example.com/api/v1/gems").
75
+ to_return(:body => fixture("push"))
76
+ end
77
+ it "submits a gem to the passed host" do
78
+ push = Gems.push(File.new(File.expand_path("../../fixtures/gems-0.0.8.gem", __FILE__), "rb"), host='http://example.com')
79
+ expect(a_post("http://example.com/api/v1/gems"))
80
+ expect(push).to eq "Successfully registered gem: gems (0.0.8)"
81
+ end
67
82
  end
68
83
  end
69
84
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,7 +36,7 @@ cert_chain:
36
36
  U0xxV3ZRUnNCbHlwSGZoczZKSnVMbHlaUEdoVTNSL3YKU2YzbFZLcEJDV2dS
37
37
  cEdUdnk0NVhWcEIrNTl5MzNQSm1FdVExUFRFT1l2UXlhbzlVS01BQWFBTi83
38
38
  cVdRdGpsMApobHc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
39
- date: 2013-07-12 00:00:00.000000000 Z
39
+ date: 2013-08-26 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
metadata.gz.sig CHANGED
Binary file