package_cloud 0.2.12 → 0.2.13
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/cli.rb +1 -0
- data/lib/package_cloud/cli/entry.rb +3 -0
- data/lib/package_cloud/cli/master_token.rb +1 -2
- data/lib/package_cloud/cli/read_token.rb +39 -0
- data/lib/package_cloud/master_token.rb +1 -1
- data/lib/package_cloud/read_token.rb +8 -1
- 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: da547c1bb5a039ffd16b0bd2ae9a7ed9bfcc595d
|
4
|
+
data.tar.gz: 05322c214d17a1dfdff07efdf98f796a1c025b70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa498f5144a3ed889a914dbbca47c9c141270f49c54b053cef0a3c89e21819bcd8aa224d7de3e3183e71963cbf14ba0b9929e8b6818be4d554e7c8841d738bda
|
7
|
+
data.tar.gz: 6044ec9e49b5d7afb6c44eb74e8084f2c99ca4fdf99cf55f1d831c7beaecffb271411ccdcc9fc14eca6ee4d83837db7ccb790dc826167a525f11f81cbec56f8e
|
data/lib/package_cloud/cli.rb
CHANGED
@@ -6,6 +6,7 @@ module PackageCloud
|
|
6
6
|
autoload :Distro, "package_cloud/cli/distro"
|
7
7
|
autoload :Entry, "package_cloud/cli/entry"
|
8
8
|
autoload :MasterToken, "package_cloud/cli/master_token"
|
9
|
+
autoload :ReadToken, "package_cloud/cli/read_token"
|
9
10
|
autoload :Repository, "package_cloud/cli/repository"
|
10
11
|
|
11
12
|
class Base < Thor
|
@@ -10,6 +10,9 @@ module PackageCloud
|
|
10
10
|
desc "master_token SUBCMD ...ARGS", "manage master tokens"
|
11
11
|
subcommand "master_token", MasterToken
|
12
12
|
|
13
|
+
desc "read_token SUBCMD ...ARGS", "manage read tokens"
|
14
|
+
subcommand "read_token", ReadToken
|
15
|
+
|
13
16
|
desc "yank user/repo[/distro/version] package_name",
|
14
17
|
"yank package from user/repo [in dist/version]"
|
15
18
|
def yank(repo_desc, package_name)
|
@@ -15,8 +15,7 @@ module PackageCloud
|
|
15
15
|
puts " #{token.name} (#{token.value})"
|
16
16
|
puts " read tokens:"
|
17
17
|
token.read_tokens.each do |read_token|
|
18
|
-
puts " #{read_token.name}"
|
19
|
-
puts " #{read_token.value}"
|
18
|
+
puts " { id: #{read_token.id}, name: #{read_token.name}, value: #{read_token.value} }"
|
20
19
|
puts
|
21
20
|
end
|
22
21
|
puts "" unless i == tokens.length - 1
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module PackageCloud
|
2
|
+
module CLI
|
3
|
+
class ReadToken < Base
|
4
|
+
desc "destroy user/repository mastertoken/readtoken",
|
5
|
+
"revokes read token associated to a master token"
|
6
|
+
def destroy(repo_name, master_and_read_token)
|
7
|
+
print "Looking for repository at #{repo_name}... "
|
8
|
+
repo = client.repository(repo_name)
|
9
|
+
|
10
|
+
given_master_token, given_read_token = master_and_read_token.split("/")
|
11
|
+
|
12
|
+
if given_master_token.nil? || given_read_token.nil?
|
13
|
+
print "invalid master token and/or read token!\n".red
|
14
|
+
exit(127)
|
15
|
+
end
|
16
|
+
|
17
|
+
master_token = repo.master_tokens.detect { |t| t.name == given_master_token }
|
18
|
+
|
19
|
+
if master_token.nil?
|
20
|
+
print "couldn't find master token named #{given_master_token}\n".red
|
21
|
+
exit(127)
|
22
|
+
end
|
23
|
+
|
24
|
+
read_token = master_token.read_tokens.detect { |t| t.name == given_read_token }
|
25
|
+
|
26
|
+
if read_token.nil?
|
27
|
+
print "couldn't find read token named #{given_read_token} for #{given_master_token}\n".red
|
28
|
+
exit(127)
|
29
|
+
end
|
30
|
+
|
31
|
+
master_token_path = master_token.paths["self"]
|
32
|
+
|
33
|
+
read_token.destroy(master_token_path, read_token.id)
|
34
|
+
|
35
|
+
print "success!\n"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,7 +1,14 @@
|
|
1
1
|
module PackageCloud
|
2
2
|
class ReadToken < Object
|
3
|
-
def initialize(attrs)
|
3
|
+
def initialize(config, attrs)
|
4
|
+
@config = config
|
4
5
|
@attrs = attrs
|
5
6
|
end
|
7
|
+
|
8
|
+
def destroy(master_token_path, read_token_id)
|
9
|
+
base_url = @config.base_url
|
10
|
+
url = "#{base_url}#{master_token_path}/read_tokens/#{read_token_id}"
|
11
|
+
RestClient.delete(url)
|
12
|
+
end
|
6
13
|
end
|
7
14
|
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.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Damato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -128,6 +128,7 @@ files:
|
|
128
128
|
- lib/package_cloud/cli/distro.rb
|
129
129
|
- lib/package_cloud/cli/entry.rb
|
130
130
|
- lib/package_cloud/cli/master_token.rb
|
131
|
+
- lib/package_cloud/cli/read_token.rb
|
131
132
|
- lib/package_cloud/cli/repository.rb
|
132
133
|
- lib/package_cloud/client.rb
|
133
134
|
- lib/package_cloud/config_file.rb
|