package_cloud 0.2.38 → 0.2.39

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: 766d7c9ea3818b1746f5dfb1971a734ff8c1f51b
4
- data.tar.gz: d2fad59918f7b07dd55e61373da286b0642800d7
3
+ metadata.gz: 8e76372c7e8b4af4d84af99971707593808571b3
4
+ data.tar.gz: 8c628eedff567d35d46039c4c630051cad5a09b6
5
5
  SHA512:
6
- metadata.gz: d680c4370a337c0401370ea8921c8c9abfe0e5b8a82afe14d5116691d262a41940ff439dc4302f66fd0e50740247bb6fd2e4cdd5a72b601b2d7c5de013f54371
7
- data.tar.gz: a831c57060ec01b18f7c2e6dfc8c9ebc25d45d08184aa2ec5ecf151f2d5e08c6b1962537f1a38af0c4e176942e85fbf5a3ef052d69c42d5c4a1b33bc24cc2388
6
+ metadata.gz: 2f52f775a3ab2547c41229873ff4e7970b5dd195bc77f7de82bf25b70fd02957dabdd4e5cf602394c683cc6c9198f9551fa1202cc9516a4d53914ec62acb15c7
7
+ data.tar.gz: 421b231fcc1b1d17ff1b606b5af01487b1ca2adda034d477c12a83cc804bcaa4789289f89ce09ed357b284fae7159c5e29a5af202fa412a0bb53667ff8284641
@@ -13,6 +13,31 @@ module PackageCloud
13
13
  desc "read_token SUBCMD ...ARGS", "manage read tokens"
14
14
  subcommand "read_token", ReadToken
15
15
 
16
+ desc "promote user/repo[/distro/version] package_name user/destination_repo",
17
+ "promotes a package from user/repo [in dist/version] to user/destination_repo [also in dist/version]"
18
+ def promote(source_repo_desc, package_name, dest_repo_desc)
19
+ repo_name = source_repo_desc.split("/")[0..1].join("/")
20
+ dist = source_repo_desc.split("/")[2..3].join("/")
21
+
22
+ dest_repo_name = dest_repo_desc.split("/")[0..1].join("/")
23
+
24
+ if dist == "" && package_name =~ /\.gem$/
25
+ dist = "gems"
26
+ end
27
+
28
+ print "Looking for source repository at #{repo_name}... "
29
+ src_repo = client.repository(source_repo_desc)
30
+ print "success!\n"
31
+
32
+ print "Looking for destination repository at #{dest_repo_name}... "
33
+ repo = client.repository(dest_repo_desc)
34
+ print "success!\n"
35
+
36
+ print "Attempting to promote #{repo_name}/#{dist}/#{package_name} to #{dest_repo_name}..."
37
+ packages = src_repo.promote(dist, package_name, dest_repo_name)
38
+ puts "done!".color(:green)
39
+ end
40
+
16
41
  desc "yank user/repo[/distro/version] package_name",
17
42
  "yank package from user/repo [in dist/version]"
18
43
  def yank(repo_desc, package_name)
@@ -100,6 +100,22 @@ module PackageCloud
100
100
  resp
101
101
  end
102
102
 
103
+ def promote(dist, package_name, dest_repo_name)
104
+ begin
105
+ url = PackageCloud::Util.compute_url(@config.base_url, paths["self"] + "/" + [dist, package_name, "promote.json"].compact.join("/"))
106
+ resp = RestClient.post(url, :destination => dest_repo_name)
107
+ resp = JSON.parse(resp)
108
+ rescue RestClient::ResourceNotFound => e
109
+ print "error:\n".color(:red)
110
+ json = JSON.parse(e.response)
111
+ json.each do |k,v|
112
+ puts "\n\t#{k}: #{v.join(", ")}\n"
113
+ end
114
+ puts ""
115
+ exit(1)
116
+ end
117
+ end
118
+
103
119
  def yank(dist, package_name)
104
120
  begin
105
121
  url = PackageCloud::Util.compute_url(@config.base_url, paths["self"] + "/" + [dist, package_name].compact.join("/"))
@@ -1,7 +1,7 @@
1
1
  module PackageCloud
2
2
  MAJOR_VERSION = "0"
3
3
  MINOR_VERSION = "2"
4
- PATCH_VERSION = "38"
4
+ PATCH_VERSION = "39"
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.2.38
4
+ version: 0.2.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Damato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-09 00:00:00.000000000 Z
11
+ date: 2016-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -165,4 +165,3 @@ signing_key:
165
165
  specification_version: 4
166
166
  summary: https://packagecloud.io
167
167
  test_files: []
168
- has_rdoc: