package_cloud 0.3.02 → 0.3.08

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
2
  SHA1:
3
- metadata.gz: a53ac5d579105b8fa81aad30b5da73057ebea78e
4
- data.tar.gz: 05def5f60f2367cd5bf1136b93280e6165e18a4c
3
+ metadata.gz: 6e1fc0d6c0b52dce5f3eee51b11195bf9bd92cd3
4
+ data.tar.gz: 64c4a8aa6956f450f97bfa21314e4ea2188c992e
5
5
  SHA512:
6
- metadata.gz: b0f41df24be0a738ed0cd5c255c6a184449690189357b81ace3a9c7c41edc860db7c7ba13da643822d79be27d0cc122050ce4f6d8fe84fb896738678dce159f6
7
- data.tar.gz: 0b4dc62bfe2f6e13e5f5956a067b065b88966160dd5120d05a07336e9015b72cd110632fc164e1e2a68663856d1b9007e9c4b4e01baeb809874f5737b86a4db1
6
+ metadata.gz: 996714d5fa00f98de2f548d75747e31967c3246c0943b4083ea20d317419efb14edc8890b20bd710ac196840ea57023f6295dcff3808cd87ab6b55bd9ecdef5b
7
+ data.tar.gz: 892b3eccf25a659292f7f66403ddea716444a547982758c2afb53a44dabd0d5ccaffc1cd1edf26ae41f45c4f26cdf17bda9cf6933d8d1486d99817726a92dc60
data/README.md CHANGED
@@ -3,29 +3,36 @@
3
3
  Greetings! Welcome to the [packagecloud](https://packagecloud.io) command line
4
4
  client, `package_cloud`.
5
5
 
6
- #### Requirements
6
+ ## Requirements
7
+
7
8
  Only Ruby 2.x and greater is supported, please use version 0.2.45 for Ruby 1.9 support.
8
9
 
9
10
  ## Overview
11
+
10
12
  The `package_cloud` command line client allows you to easily:
11
13
 
12
- * Create Node.js, Debian, RPM, RubyGem, Python, and Maven package repositories on [packagecloud](https://packagecloud.io).
13
- * Upload Node.js, Debian, RPM, RubyGem, Python, and Java JAR/WAR/AAR packages to your repositories.
14
+ * Create Node.js, Debian, RPM, RubyGem, Python, and Maven package repositories
15
+ on [packagecloud](https://packagecloud.io).
16
+ * Upload Node.js, Debian, RPM, RubyGem, Python, and Java JAR/WAR/AAR packages
17
+ to your repositories.
14
18
  * [Delete packages](https://packagecloud.io/docs#yank_pkg).
15
- * [Promote packages](https://packagecloud.io/docs#promote_pkg) between repositories.
19
+ * [Promote packages](https://packagecloud.io/docs#promote_pkg) between
20
+ repositories.
16
21
  * Upload a package signing GPG key.
17
22
  * Create and delete [master and read
18
23
  tokens](https://packagecloud.io/docs#token_auth) to control repository
19
24
  access.
20
25
 
21
26
  This tool is intended to be used on the command line either manually or in an
22
- automated environment (like a build or CI process).
27
+ automated environment (like a build or CI process). See more examples on how
28
+ to use the command-line interface by visiting the
29
+ [CLI page](https://packagecloud.io/l/cli).
23
30
 
24
31
  ## Installation
25
32
 
26
33
  Simply run:
27
34
 
28
- $ gem install package_cloud
35
+ gem install package_cloud
29
36
 
30
37
  to install the command line client.
31
38
 
@@ -51,10 +58,11 @@ You can interact with our system programmatically as well by using our
51
58
 
52
59
  ### Creating a repository
53
60
 
54
- You can create a package repository named 'example' on [packagecloud](https://packagecloud.io) by running:
61
+ You can create a package repository named 'example' on
62
+ [packagecloud](https://packagecloud.io) by running:
55
63
 
56
64
  ```
57
- $ package_cloud repository create example
65
+ package_cloud repository create example
58
66
  ```
59
67
 
60
68
  ### Environment variables
@@ -66,11 +74,12 @@ that will override the settings found in `~/.packagecloud`:
66
74
  token (available [here](https://packagecloud.io/api_token)). If set, the
67
75
  CLI *will not* read the `~/.packagecloud` configuration file to get the API
68
76
  token.
77
+
69
78
  2. If and only if the `PACKAGECLOUD_TOKEN` variable is set, you may also set
70
79
  `PACKAGECLOUD_URL`. This environment should only be used by
71
80
  packagecloud:enterprise customers. It allows you to set the URL of the
72
81
  packagecloud installation. Customers using our hosted, cloud based product
73
- should not set this variable; it is defaulted to http://packagecloud.io
82
+ should not set this variable; it is defaulted to `http://packagecloud.io`
74
83
  automatically.
75
84
 
76
85
  ### Pushing a package
@@ -81,7 +90,8 @@ repository you've created by using the `push` command.
81
90
  Most package types require specifying a `distribution/version` pair when
82
91
  uploading. See the examples that follow for more information.
83
92
 
84
- Please note that packages will be available for download via the packagecloud web UI
93
+ Please note that packages will be available for download via the packagecloud
94
+ web UI
85
95
  immediately after they are uploaded, but they will not necessarily be
86
96
  available for installation via a package manager immediately. This is because
87
97
  our system regenerates the repository metadata needed by package managers as a
@@ -89,7 +99,8 @@ background job on our system. Jobs are added to a queue and processed.
89
99
  Processing time depends on the number of packages in your repository and the
90
100
  number of reindex jobs in front of yours.
91
101
 
92
- The following examples will show an example user name of `example-user` and a repository
102
+ The following examples will show an example user name of `example-user` and a
103
+ repository
93
104
  name of `example-repository`.
94
105
 
95
106
  After the examples below, there will be an additional section documenting
@@ -97,10 +108,11 @@ important optional parameters you can specify when pushing packages.
97
108
 
98
109
  #### Uploading a Debian package
99
110
 
100
- You can upload a Debian package found at the path `/tmp/example.deb` for Ubuntu Xenial by running:
111
+ You can upload a Debian package found at the path `/tmp/example.deb` for
112
+ Ubuntu Xenial by running:
101
113
 
102
114
  ```
103
- $ package_cloud push example-user/example-repository/ubuntu/xenial /tmp/example.deb
115
+ package_cloud push example-user/example-repository/ubuntu/xenial /tmp/example.deb
104
116
  ```
105
117
 
106
118
  This command will upload `/tmp/example.deb` to the `example-repository`
@@ -110,7 +122,7 @@ We also support Debian source packages (DSCs). You can upload a
110
122
  `/tmp/example.dsc` for Ubuntu Xenial by running:
111
123
 
112
124
  ```
113
- $ package_cloud push example-user/example-repository/ubuntu/xenial /tmp/example.dsc
125
+ package_cloud push example-user/example-repository/ubuntu/xenial /tmp/example.dsc
114
126
  ```
115
127
 
116
128
  Note that all files associated with the DSC (like source tarballs, patches,
@@ -126,7 +138,7 @@ You can upload an RPM package found at the path `/tmp/example.rpm` for CentOS
126
138
  6 by running:
127
139
 
128
140
  ```
129
- $ package_cloud push example-user/example-repository/el/6 /tmp/example.rpm
141
+ package_cloud push example-user/example-repository/el/6 /tmp/example.rpm
130
142
  ```
131
143
 
132
144
  This command will upload `/tmp/example.rpm` to the `example-repository`
@@ -143,7 +155,7 @@ You can upload a RubyGem package found at the path `/tmp/example.gem` by
143
155
  running:
144
156
 
145
157
  ```
146
- $ package_cloud push example-user/example-repository /tmp/example.gem
158
+ package_cloud push example-user/example-repository /tmp/example.gem
147
159
  ```
148
160
 
149
161
  This command will upload `/tmp/example.gem` to the `example-repository`
@@ -158,7 +170,7 @@ You can upload a Python package found at the path `/tmp/example.whl` by
158
170
  running:
159
171
 
160
172
  ```
161
- $ package_cloud push example-user/example-repository/python /tmp/example.whl
173
+ package_cloud push example-user/example-repository/python /tmp/example.whl
162
174
  ```
163
175
 
164
176
  This command will upload `/tmp/example.whl` to the `example-repository`
@@ -171,7 +183,7 @@ eggs in PyPI repositories.
171
183
  If you'd like to upload a Python egg despite this, you can do so by running:
172
184
 
173
185
  ```
174
- $ package_cloud push example-user/example-repository/python /tmp/example.egg
186
+ package_cloud push example-user/example-repository/python /tmp/example.egg
175
187
  ```
176
188
 
177
189
  #### Uploading a Java JAR, WAR, or AAR package
@@ -180,27 +192,29 @@ You can upload a Java JAR package found at the path `/tmp/example.jar` by
180
192
  running:
181
193
 
182
194
  ```
183
- $ package_cloud push example-user/example-repository/java/maven2 /tmp/example.jar
195
+ package_cloud push example-user/example-repository/java/maven2 /tmp/example.jar
184
196
  ```
185
197
 
186
198
  WAR files can be uploaded the same way.
187
199
 
188
200
  It is important to note that in some cases (for example: 'fat JARs', or JARs
189
- without `pom.xml` files, etc) our system will not be able to automatically detect
201
+ without `pom.xml` files, etc) our system will not be able to automatically
202
+ detect
190
203
  the [Maven coordinates](https://maven.apache.org/pom.html#Maven_Coordinates).
191
204
  In these cases you will receive an error, and you should specify the
192
205
  coordinates manually on the command line:
193
206
 
194
207
  ```
195
- $ package_cloud push example-user/example-repository/java/maven2 /tmp/example.jar --coordinates=com.mygroup:packagename:1.0.2
208
+ package_cloud push example-user/example-repository/java/maven2 /tmp/example.jar --coordinates=com.mygroup:packagename:1.0.2
196
209
  ```
197
210
 
198
211
  #### Uploading a Node.js package
199
212
 
200
- To upload a Node.js package located at `/tmp/test-1.0.0.tgz` to a packagecloud NPM registry called `example-user/example-repository`:
213
+ To upload a Node.js package located at `/tmp/test-1.0.0.tgz` to a packagecloud
214
+ NPM registry called `example-user/example-repository`:
201
215
 
202
216
  ```
203
- $ package_cloud push example-user/example-repository/node /tmp/example-1.0.tgz
217
+ package_cloud push example-user/example-repository/node /tmp/example-1.0.tgz
204
218
  ```
205
219
 
206
220
  #### Additional options
@@ -222,7 +236,8 @@ more advanced use cases:
222
236
  continue uploading packages.
223
237
  * `--coordinates` - This flag is used for Java JARs or WARs which do not have
224
238
  an internal `pom.xml` specifying the Maven coordinates. You can specify your
225
- own Maven coordinates for this file using this flag: `--coordinates=com.mygroup:packagename:1.0.2`.
239
+ own Maven coordinates for this file using this flag:
240
+ `--coordinates=com.mygroup:packagename:1.0.2`.
226
241
  * `--config` - This flag is used to specify a custom configuration file path
227
242
  for the CLI. This file specifies the website URL and your API token. This is
228
243
  default to `~/.packagecloud`.
@@ -251,7 +266,7 @@ uploaded for Ubuntu Xenial from the repository `example-repository` owned by
251
266
  the user `example-user` by running the following command:
252
267
 
253
268
  ```
254
- $ package_cloud yank example-user/example-repository/ubuntu/xenial example_1.0.1-1_amd64.deb
269
+ package_cloud yank example-user/example-repository/ubuntu/xenial example_1.0.1-1_amd64.deb
255
270
  ```
256
271
 
257
272
  This will delete the package and trigger a reindex of the repository's
@@ -264,7 +279,7 @@ uploaded for CentOS 6 from the repository `example-repository` owned by
264
279
  the user `example-user` by running the following command:
265
280
 
266
281
  ```
267
- $ package_cloud yank example-user/example-repository/el/6 example-1.0-1.x86_64.rpm
282
+ package_cloud yank example-user/example-repository/el/6 example-1.0-1.x86_64.rpm
268
283
  ```
269
284
 
270
285
  This will delete the package and trigger a reindex of the repository's
@@ -272,12 +287,12 @@ metadata.
272
287
 
273
288
  #### Deleting a RubyGem package
274
289
 
275
- You can delete a RubyGem package named `example-1.0.gem' from the
290
+ You can delete a RubyGem package named `example-1.0.gem` from the
276
291
  repository `example-repository` owned by the user `example-user`
277
292
  by running the following command:
278
293
 
279
294
  ```
280
- $ package_cloud yank example-user/example-repository example-1.0.gem
295
+ package_cloud yank example-user/example-repository example-1.0.gem
281
296
  ```
282
297
 
283
298
  This will delete the package and trigger a reindex of the repository's
@@ -290,21 +305,21 @@ You can delete a Python package named `example-1.0.1.whl` from the repository
290
305
  command:
291
306
 
292
307
  ```
293
- $ package_cloud yank example-user/example-repository/python example-1.0.1.whl
308
+ package_cloud yank example-user/example-repository/python example-1.0.1.whl
294
309
  ```
295
310
 
296
311
  This will delete the package and trigger a reindex of the repository's metadata.
297
312
  Python eggs and sdists can be deleted in a similar manner.
298
313
 
299
-
300
314
  #### Deleting a Java package
301
315
 
302
- You can delete a Java package named `example-1.0.3.jar` with the group `com.groupid` from the repository
316
+ You can delete a Java package named `example-1.0.3.jar` with the group
317
+ `com.groupid` from the repository
303
318
  `example-repository` owned by the user `example-user` by running the following
304
319
  command:
305
320
 
306
321
  ```
307
- $ package_cloud yank example-user/example-repository/java com.groupid/example-1.0.3.jar
322
+ package_cloud yank example-user/example-repository/java com.groupid/example-1.0.3.jar
308
323
  ```
309
324
 
310
325
  This will delete the package and trigger a reindex of the repository's
@@ -317,18 +332,24 @@ You can delete a Node.js package named `example-1.0.tgz` from the NPM registry
317
332
  command:
318
333
 
319
334
  ```
320
- $ package_cloud yank example-user/example-repository/node example-1.0.tgz
335
+ package_cloud yank example-user/example-repository/node example-1.0.tgz
321
336
  ```
322
337
 
323
338
  If the package has a scope, you can delete it by passing the scope like so:
324
339
 
325
340
  ```
326
- $ package_cloud yank example-user/example-repository/node @scoped-user/example-1.0.tgz
341
+ package_cloud yank example-user/example-repository/node @scoped-user/example-1.0.tgz
327
342
  ```
328
343
 
329
344
  This will delete the package and trigger a reindex of the registry's
330
345
  metadata.
331
346
 
347
+ Note that deleting Node.js packages can have unexpected side effects when
348
+ mixed with
349
+ [NPM distribution tags](https://docs.npmjs.com/getting-started/using-tags). Read
350
+ more about how [promoting on packagecloud can affect dist tags
351
+ here.](https://packagecloud.io/docs/#node_promote)
352
+
332
353
  ### GPG Keys
333
354
 
334
355
  Some package managers use [GPG keys](https://packagecloud.io/docs#gpg)
@@ -351,7 +372,7 @@ your system at `/tmp/gpg.key` for the repository `example-repository` owned by
351
372
  the user `example-user`, you can run the following command:
352
373
 
353
374
  ```
354
- $ package_cloud gpg_key create example-user/example-repository /tmp/gpg.key
375
+ package_cloud gpg_key create example-user/example-repository /tmp/gpg.key
355
376
  ```
356
377
 
357
378
  Note that if you attempt to upload a private key to packagecloud, we will
@@ -364,7 +385,7 @@ You can list the GPG keys associated with the repository `example-repository`
364
385
  owned by user `example-user` by running the following command:
365
386
 
366
387
  ```
367
- $ package_cloud gpg_key list example-user/example-repository
388
+ package_cloud gpg_key list example-user/example-repository
368
389
  ```
369
390
 
370
391
  The key name specified in the output of this command is the key name you should
@@ -378,7 +399,7 @@ named `example-repository` and owned by the user `example-user` by running the
378
399
  following command:
379
400
 
380
401
  ```
381
- $ package_cloud gpg_key destroy example-user/example-repository example-user-example-repository-56D06.pub.gpg
402
+ package_cloud gpg_key destroy example-user/example-repository example-user-example-repository-56D06.pub.gpg
382
403
  ```
383
404
 
384
405
  You can get the key name for a key you'd like to delete by using the GPG key
@@ -388,32 +409,39 @@ list command above.
388
409
 
389
410
  Package promotion is a feature which can be used to easily move packages
390
411
  between repositories. This is useful for moving a package from a private
391
- staging repository to a public production ready repository during a software release
392
- workflow.
412
+ staging repository to a public production ready repository during a software
413
+ release workflow.
393
414
 
394
415
  To move a package named `example_1.0-1_amd64.deb` from the user
395
416
  `example-user`'s repository named `repo1` over to the same users repository
396
417
  named `repo2`, you would issue the following command:
397
418
 
398
419
  ```
399
- $ package_cloud promote example-user/repo1/ubuntu/xenial example_1.0-1_amd64.deb example-user/repo2
420
+ package_cloud promote example-user/repo1/ubuntu/xenial example_1.0-1_amd64.deb example-user/repo2
400
421
  ```
401
422
 
402
- If the package has a scope (Node.js packages), you can promote it by including the scope like so:
423
+ If the package has a scope (Node.js packages), you can promote it by including
424
+ the scope like so:
403
425
 
404
426
  ```
405
- $ package_cloud promote example-user/repo1/node @scoped-user/example-1.0.tgz example-user/repo2
427
+ package_cloud promote example-user/repo1/node @scoped-user/example-1.0.tgz example-user/repo2
406
428
  ```
407
429
 
408
- If the package has a group (Java packages), you can promote it by including the group like so:
430
+ If the package has a group (Java packages), you can promote it by
431
+ including the group like so:
409
432
 
410
433
  ```
411
- $ package_cloud promote example-user/repo1/java com.groupid/jake-2.3.jar example-user/repo2
434
+ package_cloud promote example-user/repo1/java com.groupid/jake-2.3.jar example-user/repo2
412
435
  ```
413
436
 
437
+ After the package is moved, a reindex will be triggered for both `repo1`
438
+ and `repo2`.
414
439
 
415
- After the package is moved, a reindex will be triggered for both `repo1` and
416
- `repo2`.
440
+ Note that promoting Node.js packages can have unexpected side effects when
441
+ mixed with
442
+ [NPM distribution tags](https://docs.npmjs.com/getting-started/using-tags).
443
+ Read more about how [promoting on packagecloud can affect dist tags
444
+ here](https://packagecloud.io/docs/#node_promote).
417
445
 
418
446
  ### Creating, deleting, and listing master and read tokens
419
447
 
@@ -440,7 +468,7 @@ you can create a master token name "Example-Token" for the repository
440
468
  command:
441
469
 
442
470
  ```
443
- $ package_cloud master_token create example-user/example-repository Example-Token
471
+ package_cloud master_token create example-user/example-repository Example-Token
444
472
  ```
445
473
 
446
474
  #### Listing master tokens
@@ -450,7 +478,7 @@ You can list all master tokens associated with the repository
450
478
  command:
451
479
 
452
480
  ```
453
- $ package_cloud master_token list example-user/example-repository
481
+ package_cloud master_token list example-user/example-repository
454
482
  ```
455
483
 
456
484
  #### Deleting master tokens
@@ -460,7 +488,7 @@ repository `example-repository` owned by the user `example-user` by running
460
488
  the following command:
461
489
 
462
490
  ```
463
- $ package_cloud master_token destroy example-user/example-repository Example-Token
491
+ package_cloud master_token destroy example-user/example-repository Example-Token
464
492
  ```
465
493
 
466
494
  This will also automatically delete all read tokens associated with this
@@ -469,4 +497,5 @@ tokens.
469
497
 
470
498
  ## Still need help?
471
499
 
472
- Feel free to reach out to [support@packagecloud.io](mailto:support@packagecloud.io) with questions.
500
+ Feel free to reach out to
501
+ [support@packagecloud.io](mailto:support@packagecloud.io) with questions.
@@ -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"]})"
@@ -2,8 +2,9 @@ module PackageCloud
2
2
  module CLI
3
3
  JAVA_EXTS = ["jar", "aar", "war"]
4
4
  PY_EXTS = ["gz", "bz2", "z", "tar", "egg-info", "zip", "whl", "egg"]
5
+ ANYFILE_EXTS = ["asc"]
5
6
  NODE_EXTS = ["tgz"]
6
- SUPPORTED_EXTS = JAVA_EXTS + PY_EXTS + NODE_EXTS + ["gem", "deb", "rpm", "dsc"]
7
+ SUPPORTED_EXTS = JAVA_EXTS + PY_EXTS + ANYFILE_EXTS + NODE_EXTS + ["gem", "deb", "rpm", "dsc", "apk"]
7
8
 
8
9
  class Entry < Base
9
10
  desc "repository SUBCMD ...ARGS", "manage repositories"
@@ -25,7 +26,7 @@ module PackageCloud
25
26
  "promotes a package from user/repo [in dist/version] to user/destination_repo [also in dist/version]"
26
27
  def promote(source_repo_desc, package_name, dest_repo_desc)
27
28
  repo_name = source_repo_desc.split("/")[0..1].join("/")
28
- dist = source_repo_desc.split("/")[2..3].join("/")
29
+ dist = expand_dist_shortcut(source_repo_desc.split("/")[2..3].join("/"))
29
30
 
30
31
  dest_repo_name = expand_dist_shortcut(dest_repo_desc.split("/")[0..1].join("/"))
31
32
 
@@ -42,14 +43,19 @@ module PackageCloud
42
43
  print "success!\n"
43
44
 
44
45
  if package_name.include?('@')
45
- print "Attempting to promote scoped package #{repo_name}/#{dist} #{package_name} to #{dest_repo_name}..."
46
46
  scope, unscoped_package_name = package_scope(package_name)
47
+
48
+ print "Attempting to promote scoped package #{scope}/#{unscoped_package_name} from #{repo_name}/#{dist} to #{dest_repo_name}..."
47
49
  packages = src_repo.promote(dist, unscoped_package_name, dest_repo_name, scope)
48
50
  else
49
51
  print "Attempting to promote #{repo_name}/#{dist}/#{package_name} to #{dest_repo_name}..."
50
52
  packages = src_repo.promote(dist, package_name, dest_repo_name)
51
53
  end
52
54
  puts "done!".color(:green)
55
+
56
+ if dist == "node/1"
57
+ puts "WARNING: This Node.js package will NOT be downloadable by clients until a dist tag is created. Read more: https://packagecloud.io/docs/#node_promote".color(:yellow)
58
+ end
53
59
  end
54
60
 
55
61
  desc "yank user/repo[/distro/version] [@scope/]package_name",
@@ -78,6 +84,10 @@ module PackageCloud
78
84
  repo.yank(dist, package_name)
79
85
  end
80
86
  puts "done!".color(:green)
87
+
88
+ if dist == "node/1"
89
+ puts "WARNING: Deleting Node.js packages can have unexpected side effects with dist tags. Read more: https://packagecloud.io/docs/#node_delete".color(:yellow)
90
+ end
81
91
  end
82
92
 
83
93
  desc "push user/repo[/distro/version] /path/to/packages",
@@ -101,6 +111,7 @@ module PackageCloud
101
111
  package_files << package_file
102
112
 
103
113
  exts = package_files.map { |f| f.split(".").last }.uniq
114
+ exts = handle_special_exts(repo, exts)
104
115
 
105
116
  if package_files.length > 1 && exts.length > 1
106
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))
@@ -136,6 +147,8 @@ module PackageCloud
136
147
  validator = Validator.new(client)
137
148
  if PY_EXTS.include?(exts.first.downcase)
138
149
  dist_id = validator.distribution_id(repo, package_files, 'py')
150
+ elsif ANYFILE_EXTS.include?(exts.first.downcase)
151
+ dist_id = validator.distribution_id(repo, package_files, 'anyfile')
139
152
  elsif NODE_EXTS.include?(exts.first.downcase)
140
153
  dist_id = validator.distribution_id(repo, package_files, 'node')
141
154
  elsif JAVA_EXTS.include?(exts.first.downcase)
@@ -186,12 +199,25 @@ module PackageCloud
186
199
  end
187
200
 
188
201
  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
+
189
213
  def expand_dist_shortcut(dist)
190
214
  case dist
191
215
  when 'java'
192
216
  'java/maven2'
193
217
  when 'python'
194
218
  'python/1'
219
+ when 'anyfile'
220
+ 'anyfile/1'
195
221
  when 'node'
196
222
  'node/1'
197
223
  else
@@ -15,6 +15,10 @@ module PackageCloud
15
15
 
16
16
  def read_or_create
17
17
  if ENV["PACKAGECLOUD_TOKEN"]
18
+ if ENV["PACKAGECLOUD_TOKEN"].length < 48
19
+ puts "Found PACKAGECLOUD_TOKEN environment variable but is empty or too short! Visit https://packagecloud.io/api_token and confirm it is correct."
20
+ exit!
21
+ end
18
22
  @token = ENV["PACKAGECLOUD_TOKEN"]
19
23
  @url = URI(ENV["PACKAGECLOUD_URL"]) if ENV["PACKAGECLOUD_URL"]
20
24
  output_host_and_token
@@ -134,12 +134,12 @@ module PackageCloud
134
134
  begin
135
135
  url = PackageCloud::Util.compute_url(@config.base_url, paths["self"] + "/" + [dist, package_name, "promote.json"].compact.join("/"))
136
136
  resp = if scope
137
- RestClient.post(url, destination: dest_repo_name, scope: scope)
138
- else
139
- RestClient.post(url, destination: dest_repo_name)
140
- end
137
+ RestClient.post(url, destination: dest_repo_name, scope: scope)
138
+ else
139
+ RestClient.post(url, destination: dest_repo_name)
140
+ end
141
141
  resp = JSON.parse(resp)
142
- rescue RestClient::ResourceNotFound => e
142
+ rescue RestClient::UnprocessableEntity, RestClient::ResourceNotFound => e
143
143
  print "error:\n".color(:red)
144
144
  json = JSON.parse(e.response)
145
145
  json.each do |k,v|
@@ -9,7 +9,7 @@ module PackageCloud
9
9
  _,_,dist_sel,ver_sel = repo.split("/")
10
10
 
11
11
  # These are all 'single version' distros
12
- if (dist_sel == "python" || dist_sel == "java" || dist_sel == "node")
12
+ if (dist_sel == "python" || dist_sel == "java" || dist_sel == "node" || dist_sel == "anyfile")
13
13
  dist = distributions[package_type].detect { |d| d["index_name"] == dist_sel }
14
14
  dist["versions"].first["id"]
15
15
  elsif dist_sel && ver_sel
@@ -69,7 +69,7 @@ module PackageCloud
69
69
  puts "If you don't see your OS or version here, send us an email at support@packagecloud.io:\n\n"
70
70
  all_distros = distributions[package_type]
71
71
 
72
- filtered_distros = all_distros.select {|dist| dist["index_name"] != "any"}
72
+ filtered_distros = all_distros.select {|dist| dist["index_name"] != "any" && dist["index_name"] != "rpm_any" }
73
73
 
74
74
  filtered_distros.each_with_index do |dist, index|
75
75
  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 = "02"
4
+ PATCH_VERSION = "08"
5
5
 
6
6
  VERSION = [MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION].join(".")
7
7
  end
@@ -0,0 +1,2 @@
1
+ exclude_rule 'MD026' # trailing punctuation in header
2
+ rule 'MD029', style: "ordered" # ordered list item prefix
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_development_dependency "bundler", "~> 1.3"
29
29
  spec.add_development_dependency "rake"
30
+ spec.add_development_dependency "mdl"
30
31
  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.02
4
+ version: 0.3.08
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Damato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-28 00:00:00.000000000 Z
11
+ date: 2021-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: mdl
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: The https://packagecloud.io CLI for uploading Node.js, Debian, RPM, RubyGem,
112
126
  Python, and Java packages. Check our website or the RubyDoc documentation for detailed
113
127
  information.
@@ -143,6 +157,7 @@ files:
143
157
  - lib/package_cloud/util.rb
144
158
  - lib/package_cloud/validator.rb
145
159
  - lib/package_cloud/version.rb
160
+ - markdown_lint_config.rb
146
161
  - package_cloud.gemspec
147
162
  homepage: https://packagecloud.io
148
163
  licenses:
@@ -164,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
179
  version: '0'
165
180
  requirements: []
166
181
  rubyforge_project:
167
- rubygems_version: 2.6.13
182
+ rubygems_version: 2.5.2.3
168
183
  signing_key:
169
184
  specification_version: 4
170
185
  summary: The https://packagecloud.io CLI for uploading Node.js, Debian, RPM, RubyGem,