package_cloud 0.3.09 → 0.3.11

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: 6b5523eccf8d9b23c5a3b222818a680bd585560c2e898bee15a88a7c35b969f0
4
+ data.tar.gz: ab27f540c2bd98e2a312ad0b8ed34ff036a78b3ef440355d0b65a0812fb2b6a9
5
5
  SHA512:
6
- metadata.gz: bb785da285b810f8b6bebe17354a9f782ec5afa4c36acc32a74628908ef332003b07af77cef3db5a4c550a939bce529bc4320dcc98dc28beb4af4ef4fec8a442
7
- data.tar.gz: 1aa70e22f8d994b0f0a5a2324d534a7c25f02d60e76d8298b4eb0307ecd915a4a72fb45ce0c7e6d4350c68b9db4b7c4eb20b87fc0142b11446beac2c5c5c6265
6
+ metadata.gz: 7b7f861f0cebb2a24d4ed81c1119656198638b7b574f2d72fdc07efb68564b42b5b4a850b8980483fcca18cac817ea7c9302803ba439dd755f36e5dfe622269b
7
+ data.tar.gz: 9034cef17e319ab4e4d962e55e8488d6e3a31df096f38f371bc40c71adbe02f1476401eac44f812e2ebf761be1c41efa95a3c98b20f068d02de782dfa2a61d0c
@@ -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"
@@ -111,7 +112,6 @@ module PackageCloud
111
112
  package_files << package_file
112
113
 
113
114
  exts = package_files.map { |f| f.split(".").last }.uniq
114
- exts = handle_special_exts(repo, exts)
115
115
 
116
116
  if package_files.length > 1 && exts.length > 1
117
117
  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 +130,8 @@ module PackageCloud
130
130
  invalid_packages.each do |p|
131
131
  message << " #{p}\n"
132
132
  end
133
- message << "\npackage_cloud only supports node.js, deb, gem, java, python, or rpm packages".color(:red)
133
+ message << "\npackage_cloud only supports node.js, deb, gem, java, python, "\
134
+ "rpm, alpine, helm, anyfile (.zip, .asc) packages".color(:red)
134
135
  abort(message)
135
136
  end
136
137
 
@@ -154,6 +155,8 @@ module PackageCloud
154
155
  elsif JAVA_EXTS.include?(exts.first.downcase)
155
156
  abort_if_snapshot!(package_files)
156
157
  dist_id = validator.distribution_id(repo, package_files, 'jar')
158
+ elsif AMBIGUOUS_EXTS.include?(exts.first.downcase)
159
+ dist_id = validator.distribution_id_from_repo_url(repo, package_files)
157
160
  else
158
161
  dist_id = validator.distribution_id(repo, package_files, exts.first)
159
162
  end
@@ -199,17 +202,6 @@ module PackageCloud
199
202
  end
200
203
 
201
204
  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
205
  def expand_dist_shortcut(dist)
214
206
  case dist
215
207
  when 'java'
@@ -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 = "11"
5
5
 
6
6
  VERSION = [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION].join(".")
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Damato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-15 00:00:00.000000000 Z
11
+ date: 2022-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor