package_cloud 0.3.14 → 0.3.15
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 +4 -4
- data/README.md +1 -1
- data/lib/package_cloud/cli/entry.rb +68 -9
- data/lib/package_cloud/client.rb +0 -1
- data/lib/package_cloud/repository.rb +45 -14
- data/lib/package_cloud/version.rb +1 -1
- data/package_cloud.gemspec +5 -3
- metadata +31 -37
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7137e29274423947660c706e21c9202f53ba02c046928cde787ed48ec06c714c
|
|
4
|
+
data.tar.gz: faecdd0f26599ff1c6eab2b1a17a31176f7cc281f6104adef446ff3a41f67065
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3b21cf56b65cad88473a522d0863075c6aa7787945fca30475b919c711bacb58894d4df31a4cd42431a523e6492562b238457439e4cfc9fb628360f2e940d2d5
|
|
7
|
+
data.tar.gz: d420d301d173518bfb21b02aa9e422b79e3c4e34c1a9503b7ba0df4e008c7781fc67f4e79bb7ae8b53e8faf5aaaf8318644f65ade21ad76801f0534789d40c07
|
data/README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
require "cgi"
|
|
2
|
+
require "uri"
|
|
3
|
+
|
|
1
4
|
module PackageCloud
|
|
2
5
|
module CLI
|
|
3
6
|
JAVA_EXTS = ["jar", "aar", "war"]
|
|
@@ -109,6 +112,11 @@ module PackageCloud
|
|
|
109
112
|
option "coordinates", :type => :string,
|
|
110
113
|
:desc => "Specify the exact maven coordinates to use for a JAR. Useful for JARs without coordinates, 'fat JARs', and WARs."
|
|
111
114
|
|
|
115
|
+
option "upload-before-push",
|
|
116
|
+
:type => :boolean,
|
|
117
|
+
:desc => "Upload package before push",
|
|
118
|
+
:default => false
|
|
119
|
+
|
|
112
120
|
def push(repo, package_file, *package_files)
|
|
113
121
|
total_time = Benchmark.measure do
|
|
114
122
|
ARGV.clear # otherwise gets explodes
|
|
@@ -176,7 +184,9 @@ module PackageCloud
|
|
|
176
184
|
$logger.debug("repository lookup request timing: #{measurement}")
|
|
177
185
|
|
|
178
186
|
package_files.each do |f|
|
|
187
|
+
url = nil
|
|
179
188
|
files = nil
|
|
189
|
+
urls = nil
|
|
180
190
|
ext = f.split(".").last
|
|
181
191
|
|
|
182
192
|
if ext == "dsc"
|
|
@@ -184,14 +194,63 @@ module PackageCloud
|
|
|
184
194
|
files = parse_and_verify_dsc(client_repo, f, dist_id)
|
|
185
195
|
end
|
|
186
196
|
|
|
197
|
+
if options["upload-before-push"]
|
|
198
|
+
print "Uploading #{f}... "
|
|
199
|
+
upload = client_repo.create_upload
|
|
200
|
+
begin
|
|
201
|
+
response = RestClient::Request.execute(
|
|
202
|
+
:method => upload.fetch("form").fetch("method", "POST"),
|
|
203
|
+
:url => upload.fetch("form").fetch("url"),
|
|
204
|
+
:timeout => nil,
|
|
205
|
+
:payload => upload.fetch("form").fetch("data", {}).merge(
|
|
206
|
+
upload.fetch("form").fetch("file_input") => File.open(f, "r"),
|
|
207
|
+
)
|
|
208
|
+
)
|
|
209
|
+
url = response.headers.fetch(:location)
|
|
210
|
+
|
|
211
|
+
# Amazon S3 uploads return urlencoded keys in the Location
|
|
212
|
+
# header, and we want to return the decoded object key for
|
|
213
|
+
# API operations.
|
|
214
|
+
uri = URI.parse(url)
|
|
215
|
+
if uri.host.end_with?(".amazonaws.com")
|
|
216
|
+
uri.path = CGI.unescape(uri.path)
|
|
217
|
+
url = uri.to_s
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
if files
|
|
221
|
+
urls = files.map do |file|
|
|
222
|
+
response = RestClient::Request.execute(
|
|
223
|
+
:method => upload.fetch("form").fetch("method", "POST"),
|
|
224
|
+
:url => upload.fetch("form").fetch("url"),
|
|
225
|
+
:timeout => nil,
|
|
226
|
+
:payload => upload.fetch("form").fetch("data", {}).merge(
|
|
227
|
+
upload.fetch("form").fetch("file_input") => File.open(file, "r"),
|
|
228
|
+
)
|
|
229
|
+
)
|
|
230
|
+
source_url = response.headers.fetch(:location)
|
|
231
|
+
source_uri = URI.parse(source_url)
|
|
232
|
+
if source_uri.host.end_with?(".amazonaws.com")
|
|
233
|
+
source_uri.path = CGI.unescape(source_uri.path)
|
|
234
|
+
source_url = source_uri.to_s
|
|
235
|
+
end
|
|
236
|
+
source_url
|
|
237
|
+
end
|
|
238
|
+
end
|
|
239
|
+
rescue
|
|
240
|
+
print "error!\n".color(:red)
|
|
241
|
+
puts $!, *$!.backtrace, $!.response, $!.response.body
|
|
242
|
+
exit(1)
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
187
246
|
print "Pushing #{f}... "
|
|
188
247
|
measurement = Benchmark.measure do
|
|
189
248
|
if options.has_key?("skip-errors")
|
|
190
|
-
create_package_skip_errors(client_repo, f, dist_id, files, ext, options["coordinates"])
|
|
249
|
+
create_package_skip_errors(client_repo, f, url, dist_id, files, urls, ext, options["coordinates"])
|
|
191
250
|
elsif options.has_key?("skip-duplicates")
|
|
192
|
-
create_package_skip_duplicates(client_repo, f, dist_id, files, ext, options["coordinates"])
|
|
251
|
+
create_package_skip_duplicates(client_repo, f, url, dist_id, files, urls, ext, options["coordinates"])
|
|
193
252
|
else
|
|
194
|
-
create_package(client_repo, f, dist_id, files, ext, options["coordinates"])
|
|
253
|
+
create_package(client_repo, f, url, dist_id, files, urls, ext, options["coordinates"])
|
|
195
254
|
end
|
|
196
255
|
end
|
|
197
256
|
$logger.debug("create package request timing: #{measurement}")
|
|
@@ -238,9 +297,9 @@ module PackageCloud
|
|
|
238
297
|
end
|
|
239
298
|
end
|
|
240
299
|
|
|
241
|
-
def create_package_skip_errors(client_repo, f, dist_id, files, ext, coordinates=nil)
|
|
300
|
+
def create_package_skip_errors(client_repo, f, url, dist_id, files, urls, ext, coordinates=nil)
|
|
242
301
|
begin
|
|
243
|
-
client_repo.create_package(f, dist_id, files, ext, coordinates=nil)
|
|
302
|
+
client_repo.create_package(f, url, dist_id, files, urls, ext, coordinates=nil)
|
|
244
303
|
rescue RestClient::UnprocessableEntity => e
|
|
245
304
|
print "error (skipping):\n".color(:yellow)
|
|
246
305
|
json = JSON.parse(e.response)
|
|
@@ -251,9 +310,9 @@ module PackageCloud
|
|
|
251
310
|
end
|
|
252
311
|
end
|
|
253
312
|
|
|
254
|
-
def create_package_skip_duplicates(client_repo, f, dist_id, files, ext, coordinates=nil)
|
|
313
|
+
def create_package_skip_duplicates(client_repo, f, url, dist_id, files, urls, ext, coordinates=nil)
|
|
255
314
|
begin
|
|
256
|
-
client_repo.create_package(f, dist_id, files, ext, coordinates=nil)
|
|
315
|
+
client_repo.create_package(f, url, dist_id, files, urls, ext, coordinates=nil)
|
|
257
316
|
rescue RestClient::UnprocessableEntity => e
|
|
258
317
|
json = JSON.parse(e.response)
|
|
259
318
|
if json == { "filename" => ["has already been taken"] }
|
|
@@ -273,9 +332,9 @@ module PackageCloud
|
|
|
273
332
|
end
|
|
274
333
|
end
|
|
275
334
|
|
|
276
|
-
def create_package(client_repo, f, dist_id, files, ext, coordinates=nil)
|
|
335
|
+
def create_package(client_repo, f, url, dist_id, files, urls, ext, coordinates=nil)
|
|
277
336
|
begin
|
|
278
|
-
client_repo.create_package(f, dist_id, files, ext, coordinates)
|
|
337
|
+
client_repo.create_package(f, url, dist_id, files, urls, ext, coordinates)
|
|
279
338
|
rescue RestClient::UnprocessableEntity => e
|
|
280
339
|
print "error:\n".color(:red)
|
|
281
340
|
json = JSON.parse(e.response)
|
data/lib/package_cloud/client.rb
CHANGED
|
@@ -31,28 +31,59 @@ module PackageCloud
|
|
|
31
31
|
end
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def
|
|
35
|
-
|
|
34
|
+
def create_upload
|
|
35
|
+
base_url = @config.base_url
|
|
36
|
+
url = PackageCloud::Util.compute_url(base_url, paths["create_upload"])
|
|
37
|
+
begin
|
|
38
|
+
JSON.parse(RestClient.post(url, {}))
|
|
39
|
+
rescue RestClient::UnprocessableEntity => e
|
|
40
|
+
print "error!\n".color(:red)
|
|
41
|
+
json = JSON.parse(e.response)
|
|
42
|
+
json.each do |k,v|
|
|
43
|
+
puts "\n\t#{k}: #{v.join(", ")}\n"
|
|
44
|
+
end
|
|
45
|
+
puts
|
|
46
|
+
exit(1)
|
|
47
|
+
rescue RestClient::ResourceNotFound => e
|
|
48
|
+
print "failed!\n".color(:red)
|
|
49
|
+
exit(127)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def create_package(file_path, file_url, dist_id, files=nil, urls=nil, filetype=nil, coordinates=nil)
|
|
36
54
|
base_url = @config.base_url
|
|
37
55
|
url = PackageCloud::Util.compute_url(base_url, paths["create_package"])
|
|
38
|
-
params = {
|
|
39
|
-
|
|
56
|
+
params = {
|
|
57
|
+
:distro_version_id => dist_id,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if file_url
|
|
61
|
+
params[:url] = file_url
|
|
62
|
+
else
|
|
63
|
+
params[:package_file] = File.new(file_path, 'rb')
|
|
64
|
+
end
|
|
40
65
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
66
|
+
if coordinates
|
|
67
|
+
params[:coordinates] = coordinates
|
|
68
|
+
end
|
|
44
69
|
|
|
45
70
|
if filetype == "dsc"
|
|
46
|
-
|
|
47
|
-
|
|
71
|
+
if urls
|
|
72
|
+
params[:source_urls] = urls
|
|
73
|
+
else
|
|
74
|
+
params[:source_files] = files.map do |f|
|
|
75
|
+
File.new(f, 'rb')
|
|
76
|
+
end
|
|
48
77
|
end
|
|
49
|
-
params.merge!({:source_files => file_ios})
|
|
50
78
|
end
|
|
51
79
|
|
|
52
|
-
RestClient::Request.execute(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
80
|
+
RestClient::Request.execute(
|
|
81
|
+
:method => 'post',
|
|
82
|
+
:url => url,
|
|
83
|
+
:timeout => nil,
|
|
84
|
+
:payload => { :package => params },
|
|
85
|
+
)
|
|
86
|
+
|
|
56
87
|
print "success!\n".color(:green)
|
|
57
88
|
end
|
|
58
89
|
|
data/package_cloud.gemspec
CHANGED
|
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
|
|
|
13
13
|
|
|
14
14
|
spec.homepage = "https://packagecloud.io"
|
|
15
15
|
spec.license = "MIT"
|
|
16
|
+
spec.required_ruby_version = ">= 2.6"
|
|
16
17
|
|
|
17
18
|
spec.files = `git ls-files`.split($/)
|
|
18
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
@@ -20,10 +21,11 @@ Gem::Specification.new do |spec|
|
|
|
20
21
|
spec.require_paths = ["lib"]
|
|
21
22
|
|
|
22
23
|
spec.add_runtime_dependency "thor", "~> 1.2"
|
|
23
|
-
spec.add_runtime_dependency "highline", "~> 2.0
|
|
24
|
+
spec.add_runtime_dependency "highline", "~> 2.0"
|
|
24
25
|
spec.add_runtime_dependency "rest-client", "~> 2.0"
|
|
25
|
-
spec.add_runtime_dependency "
|
|
26
|
-
spec.add_runtime_dependency "
|
|
26
|
+
spec.add_runtime_dependency "json", "~> 2.9"
|
|
27
|
+
spec.add_runtime_dependency "abbrev", "~> 0.1"
|
|
28
|
+
spec.add_runtime_dependency "rainbow", "~> 2.2"
|
|
27
29
|
|
|
28
30
|
spec.add_development_dependency "bundler"
|
|
29
31
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: package_cloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joe Damato
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
|
-
cert_chain:
|
|
11
|
-
-
|
|
12
|
-
-----BEGIN CERTIFICATE-----
|
|
13
|
-
MIIDKDCCAhCgAwIBAgIBAjANBgkqhkiG9w0BAQsFADA6MQ0wCwYDVQQDDARzajI2
|
|
14
|
-
MRQwEgYKCZImiZPyLGQBGRYEc2oyNjETMBEGCgmSJomT8ixkARkWA2NvbTAeFw0y
|
|
15
|
-
MzA3MTIwODU1NTFaFw0yNDA3MTEwODU1NTFaMDoxDTALBgNVBAMMBHNqMjYxFDAS
|
|
16
|
-
BgoJkiaJk/IsZAEZFgRzajI2MRMwEQYKCZImiZPyLGQBGRYDY29tMIIBIjANBgkq
|
|
17
|
-
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr60Eo/ttCk8GMTMFiPr3GoYMIMFvLak
|
|
18
|
-
xSmTk9YGCB6UiEePB4THSSA5w6IPyeaCF/nWkDp3/BAam0eZMWG1IzYQB23TqIM0
|
|
19
|
-
1xzcNRvFsn0aQoQ00k+sj+G83j3T5OOV5OZIlu8xAChMkQmiPd1NXc6uFv+Iacz7
|
|
20
|
-
kj+CMsI9YUFdNoU09QY0b+u+Rb6wDYdpyvN60YC30h0h1MeYbvYZJx/iZK4XY5zu
|
|
21
|
-
4O/FL2ChjL2CPCpLZW55ShYyrzphWJwLOJe+FJ/ZBl6YXwrzQM9HKnt4titSNvyU
|
|
22
|
-
KzE3L63A3PZvExzLrN9u09kuWLLJfXB2sGOlw3n9t72rJiuBr3/OQQIDAQABozkw
|
|
23
|
-
NzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU99dfRjEKFyczTeIz
|
|
24
|
-
m3ZsDWrNC80wDQYJKoZIhvcNAQELBQADggEBAHplXTmXnsLZKl6th6Twlbpl3iBl
|
|
25
|
-
7aRpOrLc7g8WIEirjiWlYZXjhdG6XoiIQAQtV3XniQ6npRPw7Np8AhSR1LOlvbOs
|
|
26
|
-
hEdArvs/OZy9cN7fQNduZFK1dkbYCF4waBTycsQFvrzcJzRmjhS9BJd0rroetldo
|
|
27
|
-
nmPzAzlAl9rIOQC/c763FVfdbPQu+mxcj4JCfVElUzxK+4igyB6SFMckMPSZIJbi
|
|
28
|
-
cxvXzM34LVue8vISlf/2VKpawD3kQinfo1I53MP3Hv3EihDc4p14E4hdAILtHd5r
|
|
29
|
-
k6d9rkvRe0/YFTLB1hzK6scdAUcD91NOylY8s4cypQv/mk+OTbQ9+Xy7tyU=
|
|
30
|
-
-----END CERTIFICATE-----
|
|
31
|
-
date: 2023-08-09 00:00:00.000000000 Z
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-10-20 00:00:00.000000000 Z
|
|
32
12
|
dependencies:
|
|
33
13
|
- !ruby/object:Gem::Dependency
|
|
34
14
|
name: thor
|
|
@@ -50,14 +30,14 @@ dependencies:
|
|
|
50
30
|
requirements:
|
|
51
31
|
- - "~>"
|
|
52
32
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 2.0
|
|
33
|
+
version: '2.0'
|
|
54
34
|
type: :runtime
|
|
55
35
|
prerelease: false
|
|
56
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
37
|
requirements:
|
|
58
38
|
- - "~>"
|
|
59
39
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 2.0
|
|
40
|
+
version: '2.0'
|
|
61
41
|
- !ruby/object:Gem::Dependency
|
|
62
42
|
name: rest-client
|
|
63
43
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -73,33 +53,47 @@ dependencies:
|
|
|
73
53
|
- !ruby/object:Gem::Version
|
|
74
54
|
version: '2.0'
|
|
75
55
|
- !ruby/object:Gem::Dependency
|
|
76
|
-
name:
|
|
56
|
+
name: json
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '2.9'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '2.9'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: abbrev
|
|
77
71
|
requirement: !ruby/object:Gem::Requirement
|
|
78
72
|
requirements:
|
|
79
73
|
- - "~>"
|
|
80
74
|
- !ruby/object:Gem::Version
|
|
81
|
-
version:
|
|
75
|
+
version: '0.1'
|
|
82
76
|
type: :runtime
|
|
83
77
|
prerelease: false
|
|
84
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
79
|
requirements:
|
|
86
80
|
- - "~>"
|
|
87
81
|
- !ruby/object:Gem::Version
|
|
88
|
-
version:
|
|
82
|
+
version: '0.1'
|
|
89
83
|
- !ruby/object:Gem::Dependency
|
|
90
84
|
name: rainbow
|
|
91
85
|
requirement: !ruby/object:Gem::Requirement
|
|
92
86
|
requirements:
|
|
93
|
-
- -
|
|
87
|
+
- - "~>"
|
|
94
88
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 2.2
|
|
89
|
+
version: '2.2'
|
|
96
90
|
type: :runtime
|
|
97
91
|
prerelease: false
|
|
98
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
93
|
requirements:
|
|
100
|
-
- -
|
|
94
|
+
- - "~>"
|
|
101
95
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: 2.2
|
|
96
|
+
version: '2.2'
|
|
103
97
|
- !ruby/object:Gem::Dependency
|
|
104
98
|
name: bundler
|
|
105
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -183,7 +177,7 @@ homepage: https://packagecloud.io
|
|
|
183
177
|
licenses:
|
|
184
178
|
- MIT
|
|
185
179
|
metadata: {}
|
|
186
|
-
post_install_message:
|
|
180
|
+
post_install_message:
|
|
187
181
|
rdoc_options: []
|
|
188
182
|
require_paths:
|
|
189
183
|
- lib
|
|
@@ -191,15 +185,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
191
185
|
requirements:
|
|
192
186
|
- - ">="
|
|
193
187
|
- !ruby/object:Gem::Version
|
|
194
|
-
version: '
|
|
188
|
+
version: '2.6'
|
|
195
189
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
190
|
requirements:
|
|
197
191
|
- - ">="
|
|
198
192
|
- !ruby/object:Gem::Version
|
|
199
193
|
version: '0'
|
|
200
194
|
requirements: []
|
|
201
|
-
rubygems_version: 3.
|
|
202
|
-
signing_key:
|
|
195
|
+
rubygems_version: 3.5.22
|
|
196
|
+
signing_key:
|
|
203
197
|
specification_version: 4
|
|
204
198
|
summary: The https://packagecloud.io CLI for uploading Node.js, Debian, RPM, RubyGem,
|
|
205
199
|
Python, and Java packages. Check our website or the RubyDoc documentation for detailed
|
checksums.yaml.gz.sig
DELETED
|
Binary file
|
data.tar.gz.sig
DELETED
|
Binary file
|
metadata.gz.sig
DELETED