package_cloud 0.3.09 → 0.3.14

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
  SHA256:
3
- metadata.gz: 826f31e8a6707526bd6f82609c43677b162464688596785a338be6f7a35acf44
4
- data.tar.gz: '096e57c694454dda57219d8ca2b79e63b58d46ce4711176e745518c33ed62d7d'
3
+ metadata.gz: d491d33c62c74e03dde03e4befd3275b54e7ce3e534745b5fc6499dbb6616aab
4
+ data.tar.gz: ded90eb0fedeea5494ed879fef5d53b2e9ca80f3f39533e625129bbe38013feb
5
5
  SHA512:
6
- metadata.gz: bb785da285b810f8b6bebe17354a9f782ec5afa4c36acc32a74628908ef332003b07af77cef3db5a4c550a939bce529bc4320dcc98dc28beb4af4ef4fec8a442
7
- data.tar.gz: 1aa70e22f8d994b0f0a5a2324d534a7c25f02d60e76d8298b4eb0307ecd915a4a72fb45ce0c7e6d4350c68b9db4b7c4eb20b87fc0142b11446beac2c5c5c6265
6
+ metadata.gz: 9d32155e5a921709dce335ac92cc013322c10cbf1e77c9612628094aa0fb6a4f69f1ce07136677ac271c10880d09e9a1ad05fa598b98a8dbed3c036700294195
7
+ data.tar.gz: 5922fd817b64d24facc5a23139f1a7165f7ba9fa8718a7c127e93f9f44cea9441605441be0ceaa0d6be996af4d4d10318d144b4debd46b3b0a99cb88ba72ea76
checksums.yaml.gz.sig ADDED
Binary file
@@ -1,10 +1,11 @@
1
1
  module PackageCloud
2
2
  module CLI
3
3
  JAVA_EXTS = ["jar", "aar", "war"]
4
- PY_EXTS = ["gz", "bz2", "z", "tar", "egg-info", "zip", "whl", "egg"]
4
+ PY_EXTS = ["gz", "bz2", "z", "tar", "egg-info", "whl", "egg"]
5
5
  ANYFILE_EXTS = ["asc"]
6
- NODE_EXTS = ["tgz"]
7
- SUPPORTED_EXTS = JAVA_EXTS + PY_EXTS + ANYFILE_EXTS + NODE_EXTS + ["gem", "deb", "rpm", "dsc", "apk"]
6
+ NODE_EXTS = []
7
+ AMBIGUOUS_EXTS = ["tgz", "apk", "zip"]
8
+ SUPPORTED_EXTS = JAVA_EXTS + PY_EXTS + ANYFILE_EXTS + AMBIGUOUS_EXTS + ["gem", "deb", "rpm", "dsc"]
8
9
 
9
10
  class Entry < Base
10
11
  desc "repository SUBCMD ...ARGS", "manage repositories"
@@ -102,6 +103,9 @@ module PackageCloud
102
103
  option "skip-errors", :type => :boolean,
103
104
  :desc => "Skip errors encountered during a package push and continue pushing the next package."
104
105
 
106
+ option "skip-duplicates", :type => :boolean,
107
+ :desc => "Skip packages which already exist and continue pushing the next package."
108
+
105
109
  option "coordinates", :type => :string,
106
110
  :desc => "Specify the exact maven coordinates to use for a JAR. Useful for JARs without coordinates, 'fat JARs', and WARs."
107
111
 
@@ -111,7 +115,6 @@ module PackageCloud
111
115
  package_files << package_file
112
116
 
113
117
  exts = package_files.map { |f| f.split(".").last }.uniq
114
- exts = handle_special_exts(repo, exts)
115
118
 
116
119
  if package_files.length > 1 && exts.length > 1
117
120
  abort("You can't push multiple packages of different types at the same time.\nFor example, use *.deb to push all your debs at once.".color(:red))
@@ -130,7 +133,8 @@ module PackageCloud
130
133
  invalid_packages.each do |p|
131
134
  message << " #{p}\n"
132
135
  end
133
- message << "\npackage_cloud only supports node.js, deb, gem, java, python, or rpm packages".color(:red)
136
+ message << "\npackage_cloud only supports node.js, deb, gem, java, python, "\
137
+ "rpm, alpine, helm, anyfile (.zip, .asc) packages".color(:red)
134
138
  abort(message)
135
139
  end
136
140
 
@@ -154,6 +158,8 @@ module PackageCloud
154
158
  elsif JAVA_EXTS.include?(exts.first.downcase)
155
159
  abort_if_snapshot!(package_files)
156
160
  dist_id = validator.distribution_id(repo, package_files, 'jar')
161
+ elsif AMBIGUOUS_EXTS.include?(exts.first.downcase)
162
+ dist_id = validator.distribution_id_from_repo_url(repo, package_files)
157
163
  else
158
164
  dist_id = validator.distribution_id(repo, package_files, exts.first)
159
165
  end
@@ -182,6 +188,8 @@ module PackageCloud
182
188
  measurement = Benchmark.measure do
183
189
  if options.has_key?("skip-errors")
184
190
  create_package_skip_errors(client_repo, f, dist_id, files, ext, options["coordinates"])
191
+ elsif options.has_key?("skip-duplicates")
192
+ create_package_skip_duplicates(client_repo, f, dist_id, files, ext, options["coordinates"])
185
193
  else
186
194
  create_package(client_repo, f, dist_id, files, ext, options["coordinates"])
187
195
  end
@@ -199,17 +207,6 @@ module PackageCloud
199
207
  end
200
208
 
201
209
  private
202
- def handle_special_exts(repo, exts)
203
- exts.map do |elem|
204
- case elem
205
- when 'apk'
206
- elem = repo.include?("alpine") ? "alpine" : elem
207
- else
208
- elem
209
- end
210
- end
211
- end
212
-
213
210
  def expand_dist_shortcut(dist)
214
211
  case dist
215
212
  when 'java'
@@ -254,6 +251,28 @@ module PackageCloud
254
251
  end
255
252
  end
256
253
 
254
+ def create_package_skip_duplicates(client_repo, f, dist_id, files, ext, coordinates=nil)
255
+ begin
256
+ client_repo.create_package(f, dist_id, files, ext, coordinates=nil)
257
+ rescue RestClient::UnprocessableEntity => e
258
+ json = JSON.parse(e.response)
259
+ if json == { "filename" => ["has already been taken"] }
260
+ print "skipping, already exists.\n".color(:yellow)
261
+ else
262
+ print "error:\n".color(:red)
263
+ json.each do |k,v|
264
+ if v.is_a? String
265
+ puts "\n\t#{k}: #{v}\n"
266
+ elsif v.is_a? Array
267
+ puts "\n\t#{k}: #{v.join(", ")}\n"
268
+ end
269
+ end
270
+ puts ""
271
+ exit(1)
272
+ end
273
+ end
274
+ end
275
+
257
276
  def create_package(client_repo, f, dist_id, files, ext, coordinates=nil)
258
277
  begin
259
278
  client_repo.create_package(f, dist_id, files, ext, coordinates)
@@ -282,7 +301,7 @@ module PackageCloud
282
301
  file_paths = []
283
302
  files.each do |f|
284
303
  filepath = File.join(dir, f["filename"])
285
- if !File.exists?(filepath)
304
+ if !File.exist?(filepath)
286
305
  print "Unable to find file name: #{f["filename"]} for source package: #{filepath}\n".color(:red)
287
306
  abort("Aborting...".color(:red))
288
307
  end
@@ -62,14 +62,24 @@ module PackageCloud
62
62
 
63
63
  def login_from_console
64
64
  e = ask("Email:")
65
+ puts "If you signed up via social login (Github, Bitbucket etc.), and/or do not have a password, input: NIL"
65
66
  p = ask("Password:") { |q| q.echo = false }
66
67
 
67
- begin
68
- PackageCloud::Auth.get_token(base_url(e, p))
69
- rescue RestClient::Unauthorized => e
70
- puts "Sorry, but we couldn't find you. Give it another try."
71
- login_from_console
68
+ if p == "NIL"
69
+ puts "Copy your API Token from https://packagecloud.io/api_token and input below."
70
+ puts "(Note: An incorrectly inputted token will require deletion of the incorrectly generated $HOME/.packagecloud config file before rerunning the last command.)"
71
+ api_token = ask("Your API Token:") { |q| q.echo = false }
72
+ else
73
+ begin
74
+ api_token = PackageCloud::Auth.get_token(base_url(e, p))
75
+ rescue RestClient::Unauthorized => e
76
+ puts "Sorry, but we couldn't find you. Give it another try."
77
+ puts "(Or skip the login? Go to https://packagecloud.io/api_token to see instructions on downloading your $HOME/.packagecloud config file.)"
78
+ login_from_console
79
+ end
72
80
  end
81
+
82
+ return api_token
73
83
  end
74
84
 
75
85
  def write
@@ -86,7 +96,7 @@ module PackageCloud
86
96
  ## config where the url is used verbatim as the key, instead of "url",
87
97
  ## this attempts to fix the config file
88
98
  def fix_config_file!
89
- if File.exists?(@filename) && File.writable?(@filename)
99
+ if File.exist?(@filename) && File.writable?(@filename)
90
100
  attrs = JSON.parse(File.read(@filename))
91
101
  if !attrs.has_key?("url")
92
102
  ## overwrite the config file if "url" key not found
@@ -4,6 +4,19 @@ module PackageCloud
4
4
  @client = client
5
5
  end
6
6
 
7
+ def distribution_id_from_repo_url(repo, filenames)
8
+ _,_,dist_sel,ver_sel = repo.split("/")
9
+ package_type = dist_sel
10
+ puts "ambiguous extensions, so using repo url to deduce package_type, package_type: #{package_type}".color(:red)
11
+
12
+ # NOTE: The distributions pulled from API uses "py" (package_type) as key for "python"
13
+ # so we need to map "python" to "py"
14
+ # See PackageCloud::Validator#distributions
15
+ package_type = package_type == "python" ? "py": package_type
16
+
17
+ distribution_id(repo, filenames, package_type)
18
+ end
19
+
7
20
  def distribution_id(repo, filenames, package_type)
8
21
  if distributions[package_type]
9
22
  _,_,dist_sel,ver_sel = repo.split("/")
@@ -1,7 +1,7 @@
1
1
  module PackageCloud
2
2
  MAJOR_VERSION = "0"
3
3
  MINOR_VERSION = "3"
4
- PATCH_VERSION = "09"
4
+ PATCH_VERSION = "14"
5
5
 
6
6
  VERSION = [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION].join(".")
7
7
  end
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_runtime_dependency "json_pure", "~> 2.3.0"
26
26
  spec.add_runtime_dependency "rainbow", "2.2.2"
27
27
 
28
- spec.add_development_dependency "bundler", "~> 1.3"
28
+ spec.add_development_dependency "bundler"
29
29
  spec.add_development_dependency "rake"
30
30
  spec.add_development_dependency "mdl"
31
31
  end
data.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,14 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: package_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.09
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Damato
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2022-07-15 00:00:00.000000000 Z
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
12
32
  dependencies:
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: thor
@@ -84,16 +104,16 @@ dependencies:
84
104
  name: bundler
85
105
  requirement: !ruby/object:Gem::Requirement
86
106
  requirements:
87
- - - "~>"
107
+ - - ">="
88
108
  - !ruby/object:Gem::Version
89
- version: '1.3'
109
+ version: '0'
90
110
  type: :development
91
111
  prerelease: false
92
112
  version_requirements: !ruby/object:Gem::Requirement
93
113
  requirements:
94
- - - "~>"
114
+ - - ">="
95
115
  - !ruby/object:Gem::Version
96
- version: '1.3'
116
+ version: '0'
97
117
  - !ruby/object:Gem::Dependency
98
118
  name: rake
99
119
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
198
  - !ruby/object:Gem::Version
179
199
  version: '0'
180
200
  requirements: []
181
- rubygems_version: 3.2.3
201
+ rubygems_version: 3.4.16
182
202
  signing_key:
183
203
  specification_version: 4
184
204
  summary: The https://packagecloud.io CLI for uploading Node.js, Debian, RPM, RubyGem,
metadata.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ (S-3��� �]C�Q�޽�%�].�*m��5W��R��E�!�M��cm��1.=���ܹ���\,uw�P�7p,"a�l�'
2
+ �ؔ�z���k)��}����p�D��#� ����FQ�f��.�\17�[Z��_�~�����y�b��C�3��a,V}z|릈��_1 �Z���iJ7m��9]*��+�Yլ��hnOX�wȍ��w�d� �(��h����"��Έ)l|���.��Ӫ�ӈ΋f���8���k��Qt'$