package_cloud 0.2.37 → 0.2.38

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: 0626038049264352dd55411a6e39b6db28547382
4
- data.tar.gz: fab3fbac02f8269bc70215427250569371b77cc3
3
+ metadata.gz: 766d7c9ea3818b1746f5dfb1971a734ff8c1f51b
4
+ data.tar.gz: d2fad59918f7b07dd55e61373da286b0642800d7
5
5
  SHA512:
6
- metadata.gz: 6484fdd476d6a070193d745e63ef1df43aed3bb77a4d18622dfbee691c196a29eced50197e6aba29f0fc8aa45a17140d21c54100929663552a3ac19d2c9bab64
7
- data.tar.gz: 83ab9216a08dc107d99b8ff55e78648e99b2294f4f54306aaa9d937a88cc02e92fab780f7784dd39a3c51c6514b410a50d63262ee0e7ab6f41e56522fce4286c
6
+ metadata.gz: d680c4370a337c0401370ea8921c8c9abfe0e5b8a82afe14d5116691d262a41940ff439dc4302f66fd0e50740247bb6fd2e4cdd5a72b601b2d7c5de013f54371
7
+ data.tar.gz: a831c57060ec01b18f7c2e6dfc8c9ebc25d45d08184aa2ec5ecf151f2d5e08c6b1962537f1a38af0c4e176942e85fbf5a3ef052d69c42d5c4a1b33bc24cc2388
@@ -42,8 +42,10 @@ module PackageCloud
42
42
  print "Locating repository at #{repo}... "
43
43
  repo = client.repository(repo)
44
44
  print "success!\n"
45
- pid = fork { exec(repo.install_script(package_type)) }
45
+ script = repo.install_script(package_type)
46
+ pid = fork { exec("/bin/bash", script.path) }
46
47
  Process.waitpid(pid)
48
+ script.unlink
47
49
  end
48
50
  end
49
51
  end
@@ -1,3 +1,5 @@
1
+ require 'tempfile'
2
+
1
3
  module PackageCloud
2
4
  class Repository < Object
3
5
  def initialize(attrs, config)
@@ -56,8 +58,23 @@ module PackageCloud
56
58
 
57
59
  def install_script(type)
58
60
  url = urls["install_script"].gsub(/:package_type/, type)
59
- url = PackageCloud::Util.compute_url(@config.base_url, url)
60
- RestClient.get(url)
61
+
62
+ # the URL we've obtained above already contains the correct tokens
63
+ # because the install script URL uses a master token for access, not
64
+ # your API token, so if we pass @config.base_url in to compute_url,
65
+ # we'll end up generating a URL like: https://token:@https://token:@...
66
+ # because @config.base_url has the url with the API token in it and url
67
+ # has the url (lol) with the master token in it.
68
+ #
69
+ # so just pass url in here.
70
+ url = PackageCloud::Util.compute_url(url, '')
71
+ script = RestClient.get(url)
72
+
73
+ # persist the script to a tempfile to make it easier to execute
74
+ file = Tempfile.new('foo')
75
+ file.write(script)
76
+ file.close
77
+ file
61
78
  end
62
79
 
63
80
  def master_tokens
@@ -1,7 +1,7 @@
1
1
  module PackageCloud
2
2
  MAJOR_VERSION = "0"
3
3
  MINOR_VERSION = "2"
4
- PATCH_VERSION = "37"
4
+ PATCH_VERSION = "38"
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.37
4
+ version: 0.2.38
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-10-11 00:00:00.000000000 Z
11
+ date: 2016-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -165,3 +165,4 @@ signing_key:
165
165
  specification_version: 4
166
166
  summary: https://packagecloud.io
167
167
  test_files: []
168
+ has_rdoc: