package_cloud 0.2.29 → 0.2.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/package_cloud.rb +1 -0
- data/lib/package_cloud/auth.rb +2 -1
- data/lib/package_cloud/client.rb +10 -10
- data/lib/package_cloud/master_token.rb +1 -1
- data/lib/package_cloud/repository.rb +6 -5
- data/lib/package_cloud/util.rb +15 -0
- data/lib/package_cloud/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ced12075ca5e4f0d8ae967e781c871985ff8f8c
|
4
|
+
data.tar.gz: 47545f8aae344a494c4781c0906de17860e6753b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 513729f4c35a1597098b8ddee56f18c5fa2b84aef17ac7df3bdf29751fcd2c33e04bff8eea21cc98e9f0669155eb00447b1768e201bbbdca5e4789bbfa962c26
|
7
|
+
data.tar.gz: 74b9e5ca7471acd39c537100cf9684e24daf64cd9ed8cff7ad540cd69ece3fb77fdcac9145e07d7897524ced0f1e1adbf01c67f550215eebafee4ea8e6560b2f
|
data/lib/package_cloud.rb
CHANGED
data/lib/package_cloud/auth.rb
CHANGED
@@ -5,7 +5,8 @@ module PackageCloud
|
|
5
5
|
module Auth
|
6
6
|
class << self
|
7
7
|
def get_token(url)
|
8
|
-
|
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
|
data/lib/package_cloud/client.rb
CHANGED
@@ -8,9 +8,9 @@ module PackageCloud
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def repositories
|
11
|
-
|
11
|
+
url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/repos.json")
|
12
12
|
begin
|
13
|
-
attrs = JSON.parse(RestClient.get(
|
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(
|
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
|
-
|
39
|
+
url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/repos.json")
|
40
40
|
begin
|
41
|
-
JSON.parse(RestClient.post(
|
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
|
-
|
54
|
+
url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/distributions.json")
|
55
55
|
begin
|
56
|
-
JSON.parse(RestClient.get(
|
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
|
-
|
64
|
+
url = PackageCloud::Util.compute_url(@config.base_url, "/api/v1/gem_version")
|
65
65
|
begin
|
66
|
-
JSON.parse(RestClient.get(
|
66
|
+
JSON.parse(RestClient.get(url))
|
67
67
|
rescue RestClient::ResourceNotFound => e
|
68
68
|
print "failed!\n".red
|
69
69
|
exit(127)
|
@@ -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
|
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
|
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
|
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
|
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
|
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.
|
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: 2016-
|
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
|