package_cloud 0.3.05 → 0.3.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: '092367368ac01d15e6e21b8f34017ed5d1313ccd'
4
- data.tar.gz: 2b802351b14a7d73f9dec8bf1c21930d0b06d7ed
2
+ SHA256:
3
+ metadata.gz: d491d33c62c74e03dde03e4befd3275b54e7ce3e534745b5fc6499dbb6616aab
4
+ data.tar.gz: ded90eb0fedeea5494ed879fef5d53b2e9ca80f3f39533e625129bbe38013feb
5
5
  SHA512:
6
- metadata.gz: 2faddb5c7c061833d26a27ee13d453ecdbfed1a681debca4a6d12f0c758b28c1f5e0ceb3c1b474f6cd79bf8597e44575ed2dacdbfe0c514fd21c33784412b95e
7
- data.tar.gz: 5df6f89cf42745308e8f185cd23831eb611520f9f394b33eaa86b1e331ebf6b43b1406c85348d0dcf94c2b3802f69406ddaf26c0fd59c04eeb39c660751a3861
6
+ metadata.gz: 9d32155e5a921709dce335ac92cc013322c10cbf1e77c9612628094aa0fb6a4f69f1ce07136677ac271c10880d09e9a1ad05fa598b98a8dbed3c036700294195
7
+ data.tar.gz: 5922fd817b64d24facc5a23139f1a7165f7ba9fa8718a7c127e93f9f44cea9441605441be0ceaa0d6be996af4d4d10318d144b4debd46b3b0a99cb88ba72ea76
checksums.yaml.gz.sig ADDED
Binary file
data/README.md CHANGED
@@ -164,6 +164,24 @@ repository owned by `example-user` as a RubyGem package.
164
164
  Note that unlike all other package types, RubyGems do not require any
165
165
  additional specification on upload.
166
166
 
167
+ #### Uploading a arbitrary file
168
+
169
+ NOTE:
170
+
171
+ Currently supported files:
172
+
173
+ * .asc (armored ascii signature file)
174
+
175
+ You can upload a Anyfile package found at the path `/tmp/example.asc` by
176
+ running:
177
+
178
+ ```
179
+ package_cloud push example-user/example-repository/anyfile /tmp/example.asc
180
+ ```
181
+
182
+ This command will upload `/tmp/example.asc` to the `example-repository`
183
+ repository owned by `example-user` as an Anyfile package.
184
+
167
185
  #### Uploading a Python package
168
186
 
169
187
  You can upload a Python package found at the path `/tmp/example.whl` by
@@ -12,7 +12,7 @@ module PackageCloud
12
12
  if distros
13
13
  puts "Listing distributions for #{package_type}:"
14
14
  distros.each do |distro|
15
- next if distro["index_name"] == "any"
15
+ next if (distro["index_name"] == "any" || distro["index_name"] == "rpm_any")
16
16
  puts "\n #{parse_display_name(distro["display_name"])} (#{distro["index_name"]}):\n\n"
17
17
  distro["versions"].each do |ver|
18
18
  puts " #{parse_version_name(ver["display_name"])} (#{ver["index_name"]})"
@@ -1,9 +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"]
5
- NODE_EXTS = ["tgz"]
6
- SUPPORTED_EXTS = JAVA_EXTS + PY_EXTS + NODE_EXTS + ["gem", "deb", "rpm", "dsc"]
4
+ PY_EXTS = ["gz", "bz2", "z", "tar", "egg-info", "whl", "egg"]
5
+ ANYFILE_EXTS = ["asc"]
6
+ NODE_EXTS = []
7
+ AMBIGUOUS_EXTS = ["tgz", "apk", "zip"]
8
+ SUPPORTED_EXTS = JAVA_EXTS + PY_EXTS + ANYFILE_EXTS + AMBIGUOUS_EXTS + ["gem", "deb", "rpm", "dsc"]
7
9
 
8
10
  class Entry < Base
9
11
  desc "repository SUBCMD ...ARGS", "manage repositories"
@@ -101,6 +103,9 @@ module PackageCloud
101
103
  option "skip-errors", :type => :boolean,
102
104
  :desc => "Skip errors encountered during a package push and continue pushing the next package."
103
105
 
106
+ option "skip-duplicates", :type => :boolean,
107
+ :desc => "Skip packages which already exist and continue pushing the next package."
108
+
104
109
  option "coordinates", :type => :string,
105
110
  :desc => "Specify the exact maven coordinates to use for a JAR. Useful for JARs without coordinates, 'fat JARs', and WARs."
106
111
 
@@ -128,7 +133,8 @@ module PackageCloud
128
133
  invalid_packages.each do |p|
129
134
  message << " #{p}\n"
130
135
  end
131
- 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)
132
138
  abort(message)
133
139
  end
134
140
 
@@ -145,11 +151,15 @@ module PackageCloud
145
151
  validator = Validator.new(client)
146
152
  if PY_EXTS.include?(exts.first.downcase)
147
153
  dist_id = validator.distribution_id(repo, package_files, 'py')
154
+ elsif ANYFILE_EXTS.include?(exts.first.downcase)
155
+ dist_id = validator.distribution_id(repo, package_files, 'anyfile')
148
156
  elsif NODE_EXTS.include?(exts.first.downcase)
149
157
  dist_id = validator.distribution_id(repo, package_files, 'node')
150
158
  elsif JAVA_EXTS.include?(exts.first.downcase)
151
159
  abort_if_snapshot!(package_files)
152
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)
153
163
  else
154
164
  dist_id = validator.distribution_id(repo, package_files, exts.first)
155
165
  end
@@ -178,6 +188,8 @@ module PackageCloud
178
188
  measurement = Benchmark.measure do
179
189
  if options.has_key?("skip-errors")
180
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"])
181
193
  else
182
194
  create_package(client_repo, f, dist_id, files, ext, options["coordinates"])
183
195
  end
@@ -201,6 +213,8 @@ module PackageCloud
201
213
  'java/maven2'
202
214
  when 'python'
203
215
  'python/1'
216
+ when 'anyfile'
217
+ 'anyfile/1'
204
218
  when 'node'
205
219
  'node/1'
206
220
  else
@@ -237,6 +251,28 @@ module PackageCloud
237
251
  end
238
252
  end
239
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
+
240
276
  def create_package(client_repo, f, dist_id, files, ext, coordinates=nil)
241
277
  begin
242
278
  client_repo.create_package(f, dist_id, files, ext, coordinates)
@@ -265,7 +301,7 @@ module PackageCloud
265
301
  file_paths = []
266
302
  files.each do |f|
267
303
  filepath = File.join(dir, f["filename"])
268
- if !File.exists?(filepath)
304
+ if !File.exist?(filepath)
269
305
  print "Unable to find file name: #{f["filename"]} for source package: #{filepath}\n".color(:red)
270
306
  abort("Aborting...".color(:red))
271
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,12 +4,25 @@ 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("/")
10
23
 
11
24
  # These are all 'single version' distros
12
- if (dist_sel == "python" || dist_sel == "java" || dist_sel == "node")
25
+ if (dist_sel == "python" || dist_sel == "java" || dist_sel == "node" || dist_sel == "anyfile")
13
26
  dist = distributions[package_type].detect { |d| d["index_name"] == dist_sel }
14
27
  dist["versions"].first["id"]
15
28
  elsif dist_sel && ver_sel
@@ -69,7 +82,7 @@ module PackageCloud
69
82
  puts "If you don't see your OS or version here, send us an email at support@packagecloud.io:\n\n"
70
83
  all_distros = distributions[package_type]
71
84
 
72
- filtered_distros = all_distros.select {|dist| dist["index_name"] != "any"}
85
+ filtered_distros = all_distros.select {|dist| dist["index_name"] != "any" && dist["index_name"] != "rpm_any" }
73
86
 
74
87
  filtered_distros.each_with_index do |dist, index|
75
88
  puts "\t#{index}. #{dist["display_name"]}"
@@ -1,7 +1,7 @@
1
1
  module PackageCloud
2
2
  MAJOR_VERSION = "0"
3
3
  MINOR_VERSION = "3"
4
- PATCH_VERSION = "05"
4
+ PATCH_VERSION = "14"
5
5
 
6
6
  VERSION = [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION].join(".")
7
7
  end
@@ -19,13 +19,13 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency "thor", "~> 0.18"
23
- spec.add_runtime_dependency "highline", "1.6.20"
22
+ spec.add_runtime_dependency "thor", "~> 1.2"
23
+ spec.add_runtime_dependency "highline", "~> 2.0.0"
24
24
  spec.add_runtime_dependency "rest-client", "~> 2.0"
25
- spec.add_runtime_dependency "json_pure", "1.8.1"
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.05
4
+ version: 0.3.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Damato
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2018-03-13 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDKDCCAhCgAwIBAgIBAjANBgkqhkiG9w0BAQsFADA6MQ0wCwYDVQQDDARzajI2
14
+ MRQwEgYKCZImiZPyLGQBGRYEc2oyNjETMBEGCgmSJomT8ixkARkWA2NvbTAe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000000000 Z
12
32
  dependencies:
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: thor
@@ -16,28 +36,28 @@ dependencies:
16
36
  requirements:
17
37
  - - "~>"
18
38
  - !ruby/object:Gem::Version
19
- version: '0.18'
39
+ version: '1.2'
20
40
  type: :runtime
21
41
  prerelease: false
22
42
  version_requirements: !ruby/object:Gem::Requirement
23
43
  requirements:
24
44
  - - "~>"
25
45
  - !ruby/object:Gem::Version
26
- version: '0.18'
46
+ version: '1.2'
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: highline
29
49
  requirement: !ruby/object:Gem::Requirement
30
50
  requirements:
31
- - - '='
51
+ - - "~>"
32
52
  - !ruby/object:Gem::Version
33
- version: 1.6.20
53
+ version: 2.0.0
34
54
  type: :runtime
35
55
  prerelease: false
36
56
  version_requirements: !ruby/object:Gem::Requirement
37
57
  requirements:
38
- - - '='
58
+ - - "~>"
39
59
  - !ruby/object:Gem::Version
40
- version: 1.6.20
60
+ version: 2.0.0
41
61
  - !ruby/object:Gem::Dependency
42
62
  name: rest-client
43
63
  requirement: !ruby/object:Gem::Requirement
@@ -56,16 +76,16 @@ dependencies:
56
76
  name: json_pure
57
77
  requirement: !ruby/object:Gem::Requirement
58
78
  requirements:
59
- - - '='
79
+ - - "~>"
60
80
  - !ruby/object:Gem::Version
61
- version: 1.8.1
81
+ version: 2.3.0
62
82
  type: :runtime
63
83
  prerelease: false
64
84
  version_requirements: !ruby/object:Gem::Requirement
65
85
  requirements:
66
- - - '='
86
+ - - "~>"
67
87
  - !ruby/object:Gem::Version
68
- version: 1.8.1
88
+ version: 2.3.0
69
89
  - !ruby/object:Gem::Dependency
70
90
  name: rainbow
71
91
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -163,7 +183,7 @@ homepage: https://packagecloud.io
163
183
  licenses:
164
184
  - MIT
165
185
  metadata: {}
166
- post_install_message:
186
+ post_install_message:
167
187
  rdoc_options: []
168
188
  require_paths:
169
189
  - lib
@@ -178,9 +198,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
198
  - !ruby/object:Gem::Version
179
199
  version: '0'
180
200
  requirements: []
181
- rubyforge_project:
182
- rubygems_version: 2.6.13
183
- signing_key:
201
+ rubygems_version: 3.4.16
202
+ signing_key:
184
203
  specification_version: 4
185
204
  summary: The https://packagecloud.io CLI for uploading Node.js, Debian, RPM, RubyGem,
186
205
  Python, and Java packages. Check our website or the RubyDoc documentation for detailed
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'$