packagecloud-ruby 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/lib/packagecloud/client.rb +13 -1
- data/lib/packagecloud/version.rb +1 -1
- data/packagecloud-ruby.gemspec +2 -1
- data/spec/packagecloud_spec.rb +14 -10
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9095e6773299c93c30bd9b05416c83192fd8af6
|
4
|
+
data.tar.gz: 323bc2ea63c909b749908429fcff9148e2829516
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2c1f929e8d8eaee339271079a6ee28c1cf9746be3316999d92cae321e0cc91006694aab66285b2343546763f5618846324fcd18ac3f8d0ea43bef9912bd6823
|
7
|
+
data.tar.gz: 44dceaa0f8b89b9e5de3397fa8dc196ffdf350b2b5c76c4dea40647d1245d4868f085c51828cb1be96c1a182b4256179991cc9d1aee420311e72f25fd0e715c8
|
data/.travis.yml
CHANGED
data/lib/packagecloud/client.rb
CHANGED
@@ -87,8 +87,12 @@ module Packagecloud
|
|
87
87
|
parsed_json_result(response)
|
88
88
|
end
|
89
89
|
|
90
|
-
def package_contents(repo, package)
|
90
|
+
def package_contents(repo, package, distro_version_id=nil)
|
91
91
|
assert_valid_repo_name(repo)
|
92
|
+
if distro_version_id.nil?
|
93
|
+
raise "No distribution supplied for package_contents!"
|
94
|
+
end
|
95
|
+
|
92
96
|
url = "/api/v1/repos/#{username}/#{repo}/packages/contents.json"
|
93
97
|
|
94
98
|
mixed_msg = MIME::Multipart::FormData.new
|
@@ -98,6 +102,14 @@ module Packagecloud
|
|
98
102
|
pkg_data.headers.set('Content-Transfer-Encoding', 'binary')
|
99
103
|
mixed_msg.add(pkg_data, "package[package_file]", package.filename)
|
100
104
|
|
105
|
+
if distro_version_id.is_a? String
|
106
|
+
distro_version = find_distribution_id(distro_version_id)
|
107
|
+
raise "Cannot find distribution: #{distro_version_id}" if distro_version.nil?
|
108
|
+
mixed_msg.add(MIME::Text.new(distro_version), "package[distro_version_id]")
|
109
|
+
else
|
110
|
+
mixed_msg.add(MIME::Text.new(distro_version_id), "package[distro_version_id]")
|
111
|
+
end
|
112
|
+
|
101
113
|
response = multipart_post(url, mixed_msg)
|
102
114
|
|
103
115
|
parsed_json_result(response)
|
data/lib/packagecloud/version.rb
CHANGED
data/packagecloud-ruby.gemspec
CHANGED
@@ -18,14 +18,15 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.require_paths = ['lib']
|
19
19
|
|
20
20
|
gem.add_runtime_dependency 'excon', '~> 0.40'
|
21
|
-
gem.add_runtime_dependency 'multi_json', '~> 1.0'
|
22
21
|
gem.add_runtime_dependency 'json_pure', '~> 1'
|
22
|
+
gem.add_runtime_dependency 'multi_json', '~> 1.0'
|
23
23
|
gem.add_runtime_dependency 'mime', '~> 0.4'
|
24
24
|
|
25
25
|
gem.add_development_dependency 'bundler', '~> 1.0'
|
26
26
|
gem.add_development_dependency 'rake', '~> 0.8'
|
27
27
|
gem.add_development_dependency 'rspec', '~> 2.4'
|
28
28
|
gem.add_development_dependency 'simplecov', '~> 0.9'
|
29
|
+
gem.add_development_dependency 'json', '1.8.3'
|
29
30
|
gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
|
30
31
|
gem.add_development_dependency 'yard', '~> 0.8'
|
31
32
|
end
|
data/spec/packagecloud_spec.rb
CHANGED
@@ -4,20 +4,24 @@ require 'packagecloud_server'
|
|
4
4
|
require 'packagecloud'
|
5
5
|
require 'webrick'
|
6
6
|
|
7
|
+
@server = Thread.start do
|
8
|
+
server = WEBrick::HTTPServer.new(:Port => 8000)
|
9
|
+
server.mount "/", PackagecloudServer
|
10
|
+
trap "INT" do
|
11
|
+
server.shutdown
|
12
|
+
end
|
13
|
+
server.start
|
14
|
+
end
|
15
|
+
|
16
|
+
until @server.status == "sleep" do
|
17
|
+
puts "waiting for server to start..."
|
18
|
+
end
|
19
|
+
|
7
20
|
describe Packagecloud do
|
8
21
|
|
9
22
|
include Packagecloud
|
10
23
|
|
11
24
|
before(:all) do
|
12
|
-
@server = Thread.start do
|
13
|
-
server = WEBrick::HTTPServer.new(:Port => 8000)
|
14
|
-
server.mount "/", PackagecloudServer
|
15
|
-
trap "INT" do
|
16
|
-
server.shutdown
|
17
|
-
end
|
18
|
-
server.start
|
19
|
-
end
|
20
|
-
|
21
25
|
credentials = Credentials.new("joedamato", "test_token")
|
22
26
|
connection = Connection.new("http", "localhost", 8000)
|
23
27
|
|
@@ -134,7 +138,7 @@ describe Packagecloud do
|
|
134
138
|
size = File.size(dsc)
|
135
139
|
package = Package.new(:file => dsc)
|
136
140
|
|
137
|
-
result = @client.package_contents("test_repo", package)
|
141
|
+
result = @client.package_contents("test_repo", package, 99999)
|
138
142
|
expect(result.succeeded).to be_truthy
|
139
143
|
expect(result.response["files"]).not_to be_empty
|
140
144
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packagecloud-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Damato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -25,33 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.40'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: json_pure
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
33
|
+
version: '1'
|
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
|
40
|
+
version: '1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: multi_json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1'
|
47
|
+
version: '1.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1'
|
54
|
+
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mime
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.9'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: json
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.8.3
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.8.3
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: rubygems-tasks
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|