package_cloud 0.2.28 → 0.2.30

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: 02d994dda1b1b78f952e161efd99885a92aee2d4
4
- data.tar.gz: 6d1583d1f3a3674379575e09299528cb8bd61635
3
+ metadata.gz: 8ced12075ca5e4f0d8ae967e781c871985ff8f8c
4
+ data.tar.gz: 47545f8aae344a494c4781c0906de17860e6753b
5
5
  SHA512:
6
- metadata.gz: 4fb6489dc0f362ac9caef41b1c4f3112c1c7f305d16952fd2dd3e7fa774153a9805a3fc7fa7221c7174fbca0cc9f41e82ae2b067c56345e550d84222fa788de1
7
- data.tar.gz: 7fa96e848841b8405de75282dbb5e423fc761c99b2f9c76bc251615502116b8f628afba0cbb82c7c28f7960ca34e99010b5941b2e1e0df1a07dd9915c32a26c5
6
+ metadata.gz: 513729f4c35a1597098b8ddee56f18c5fa2b84aef17ac7df3bdf29751fcd2c33e04bff8eea21cc98e9f0669155eb00447b1768e201bbbdca5e4789bbfa962c26
7
+ data.tar.gz: 74b9e5ca7471acd39c537100cf9684e24daf64cd9ed8cff7ad540cd69ece3fb77fdcac9145e07d7897524ced0f1e1adbf01c67f550215eebafee4ea8e6560b2f
@@ -11,4 +11,5 @@ module PackageCloud
11
11
  autoload :ReadToken, "package_cloud/read_token"
12
12
  autoload :Repository, "package_cloud/repository"
13
13
  autoload :Validator, "package_cloud/validator"
14
+ autoload :Util, "package_cloud/util"
14
15
  end
@@ -5,7 +5,8 @@ module PackageCloud
5
5
  module Auth
6
6
  class << self
7
7
  def get_token(url)
8
- JSON.parse(RestClient.get("#{url}/api/v1/token.json"))["token"]
8
+ url = PackageCloud::Util.compute_url(url, "/api/v1/token.json")
9
+ JSON.parse(RestClient.get(url))["token"]
9
10
  end
10
11
  end
11
12
  end
@@ -169,6 +169,9 @@ module PackageCloud
169
169
  print "File #{f["filename"]} has size: #{disk_size}, expected: #{f["size"]}\n".red
170
170
  abort("Aborting...".red)
171
171
  end
172
+
173
+ print "Found DSC package file #{f["filename"]} for upload\n"
174
+
172
175
  file_paths << filepath
173
176
  end
174
177
  file_paths
@@ -8,9 +8,9 @@ module PackageCloud
8
8
  end
9
9
 
10
10
  def repositories
11
- base_url = @config.base_url
11
+ url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/repos.json")
12
12
  begin
13
- attrs = JSON.parse(RestClient.get("#{base_url}/api/v1/repos.json"))
13
+ attrs = JSON.parse(RestClient.get(url))
14
14
  attrs.map { |a| Repository.new(a, @config) }
15
15
  rescue RestClient::ResourceNotFound => e
16
16
  print "failed!\n".red
@@ -19,10 +19,10 @@ module PackageCloud
19
19
  end
20
20
 
21
21
  def repository(name)
22
- base_url = @config.base_url
23
22
  user, repo = name.split("/")
23
+ url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/repos/#{user}/#{repo}.json")
24
24
  begin
25
- attrs = JSON.parse(RestClient.get("#{base_url}/api/v1/repos/#{user}/#{repo}.json"))
25
+ attrs = JSON.parse(RestClient.get(url))
26
26
  if attrs["error"] == "not_found"
27
27
  print "failed... Repository #{user}/#{repo} not found!\n".red
28
28
  exit(127)
@@ -36,9 +36,9 @@ module PackageCloud
36
36
  end
37
37
 
38
38
  def create_repo(name, priv)
39
- base_url = @config.base_url
39
+ url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/repos.json")
40
40
  begin
41
- JSON.parse(RestClient.post("#{base_url}/api/v1/repos.json", :repository => {:name => name, :private => priv == "private" ? "1" : "0"}))
41
+ JSON.parse(RestClient.post(url, :repository => {:name => name, :private => priv == "private" ? "1" : "0"}))
42
42
  rescue RestClient::UnprocessableEntity => e
43
43
  print "error!\n".red
44
44
  json = JSON.parse(e.response)
@@ -51,9 +51,9 @@ module PackageCloud
51
51
  end
52
52
 
53
53
  def distributions
54
- base_url = @config.base_url
54
+ url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/distributions.json")
55
55
  begin
56
- JSON.parse(RestClient.get("#{base_url}/api/v1/distributions.json"))
56
+ JSON.parse(RestClient.get(url))
57
57
  rescue RestClient::ResourceNotFound => e
58
58
  print "failed!\n".red
59
59
  exit(127)
@@ -61,9 +61,9 @@ module PackageCloud
61
61
  end
62
62
 
63
63
  def gem_version
64
- base_url = @config.base_url
64
+ url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/gem_version")
65
65
  begin
66
- JSON.parse(RestClient.get("#{base_url}/api/v1/gem_version"))
66
+ JSON.parse(RestClient.get(url))
67
67
  rescue RestClient::ResourceNotFound => e
68
68
  print "failed!\n".red
69
69
  exit(127)
@@ -12,7 +12,7 @@ module PackageCloud
12
12
  end
13
13
 
14
14
  def destroy
15
- url = @config.base_url + paths["self"]
15
+ url = PackageCloud::Util.compute_url(@config.base_url, paths["self"])
16
16
  RestClient.delete(url)
17
17
  end
18
18
  end
@@ -8,7 +8,7 @@ module PackageCloud
8
8
  def parse_dsc(dsc_path, dist_id)
9
9
  file_data = File.new(dsc_path, 'rb')
10
10
  base_url = @config.base_url
11
- url = base_url + paths["package_contents"]
11
+ url = PackageCloud::Util.compute_url(base_url, paths["package_contents"])
12
12
  begin
13
13
  resp = RestClient::Request.execute(:method => 'post',
14
14
  :url => url,
@@ -32,7 +32,7 @@ module PackageCloud
32
32
  def create_package(file_path, dist_id, files=nil, filetype=nil)
33
33
  file_data = File.new(file_path, 'rb')
34
34
  base_url = @config.base_url
35
- url = base_url + paths["create_package"]
35
+ url = PackageCloud::Util.compute_url(base_url, paths["create_package"])
36
36
  params = { :package_file => file_data,
37
37
  :distro_version_id => dist_id }
38
38
 
@@ -52,17 +52,18 @@ module PackageCloud
52
52
 
53
53
  def install_script(type)
54
54
  url = urls["install_script"].gsub(/:package_type/, type)
55
+ url = PackageCloud::Util.compute_url(@config.base_url, url)
55
56
  RestClient.get(url)
56
57
  end
57
58
 
58
59
  def master_tokens
59
- url = @config.base_url + paths["master_tokens"]
60
+ url = PackageCloud::Util.compute_url(@config.base_url, paths["master_tokens"])
60
61
  attrs = JSON.parse(RestClient.get(url))
61
62
  attrs.map { |a| MasterToken.new(a, @config) }
62
63
  end
63
64
 
64
65
  def create_master_token(name)
65
- url = @config.base_url + paths["create_master_token"]
66
+ url = PackageCloud::Util.compute_url(@config.base_url, paths["create_master_token"])
66
67
  begin
67
68
  resp = RestClient.post(url, :master_token => {:name => name})
68
69
  resp = JSON.parse(resp)
@@ -79,8 +80,8 @@ module PackageCloud
79
80
  end
80
81
 
81
82
  def yank(dist, package_name)
82
- url = @config.base_url + paths["self"] + "/" + [dist, package_name].compact.join("/")
83
83
  begin
84
+ url = PackageCloud::Util.compute_url(@config.base_url, paths["self"] + "/" + [dist, package_name].compact.join("/"))
84
85
  RestClient.delete(url)
85
86
  rescue RestClient::ResourceNotFound => e
86
87
  print "error:\n".red
@@ -0,0 +1,15 @@
1
+ module PackageCloud
2
+ class Util
3
+ class << self
4
+ def compute_url(base_url, path)
5
+ url = base_url + path
6
+ proxy_uri = URI.parse(url).find_proxy()
7
+ if proxy_uri
8
+ RestClient.proxy = proxy_uri.to_s
9
+ end
10
+
11
+ url
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,7 +1,7 @@
1
1
  module PackageCloud
2
2
  MAJOR_VERSION = "0"
3
3
  MINOR_VERSION = "2"
4
- PATCH_VERSION = "28"
4
+ PATCH_VERSION = "30"
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.28
4
+ version: 0.2.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Damato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-30 00:00:00.000000000 Z
11
+ date: 2016-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -136,6 +136,7 @@ files:
136
136
  - lib/package_cloud/object.rb
137
137
  - lib/package_cloud/read_token.rb
138
138
  - lib/package_cloud/repository.rb
139
+ - lib/package_cloud/util.rb
139
140
  - lib/package_cloud/validator.rb
140
141
  - lib/package_cloud/version.rb
141
142
  - package_cloud.gemspec