oc 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/oc/version.rb +1 -1
- data/lib/system/get.rb +0 -58
- data/lib/system/run/commands/ssh.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c6c540ce620b7a8a9f090f8c278a0276c2b39d3
|
4
|
+
data.tar.gz: c700040a0a0e3adae614b1ea625d2e4f3ad50d91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae2d17626a62a4c46fea3c7aa8abb205679feb991b0f47f194bf2a68c13c5602ea7cfec52af79816ba92780ca3f69a9da7bc44b845a5f7a669e73ade720b1f22
|
7
|
+
data.tar.gz: 5af617b6443dedb5c07ba8cb5f5dd20b26aecaa9866d8fa1143361603d5d7e878333149b7232988d5fd53ede46b1f7a16b3ba2ebab1caa3786abffbf1041e2d0
|
data/README.md
CHANGED
@@ -63,13 +63,13 @@ Or install it yourself as:
|
|
63
63
|
$ oc ssh keys
|
64
64
|
|
65
65
|
Add SSH Key
|
66
|
-
$ oc ssh add [KEY_NAME] [
|
66
|
+
$ oc ssh add [KEY_NAME] [KEY_PUB]
|
67
67
|
|
68
68
|
Show SSH Key
|
69
69
|
$ oc ssh show [KEY_ID]
|
70
70
|
|
71
71
|
Edit SSH Key
|
72
|
-
$ oc ssh edit [KEY_ID] [KEY_NAME] [
|
72
|
+
$ oc ssh edit [KEY_ID] [KEY_NAME] [KEY_PUB]
|
73
73
|
|
74
74
|
Destroy SSH Key
|
75
75
|
$ oc ssh destroy [KEY_ID]
|
data/lib/oc/version.rb
CHANGED
data/lib/system/get.rb
CHANGED
@@ -3,66 +3,8 @@ require "json"
|
|
3
3
|
require "barge"
|
4
4
|
module Oc
|
5
5
|
class Get
|
6
|
-
def self.get_json path,filter=nil
|
7
|
-
source = "https://api.digitalocean.com/#{path}/?client_id=#{Oc::Config.get("client_id")}&api_key=#{Oc::Config.get("api_key")}&filter=#{filter}"
|
8
|
-
puts "I'm thinking, please wait..".blue
|
9
|
-
response = Net::HTTP.get_response(URI.parse(source))
|
10
|
-
data = response.body
|
11
|
-
result = JSON.parse(data)
|
12
|
-
end
|
13
|
-
|
14
6
|
def self.get_barge
|
15
7
|
barge = ::Barge::Client.new(access_token: Oc::Config.get(:api_key))
|
16
8
|
end
|
17
|
-
|
18
|
-
|
19
|
-
def self.get_json_parameter path, sub_path = nil ,parameters=[]
|
20
|
-
url = "https://api.digitalocean.com/#{path}"
|
21
|
-
|
22
|
-
unless sub_path.nil?
|
23
|
-
url += "/#{sub_path}"
|
24
|
-
end
|
25
|
-
|
26
|
-
url += "?client_id=#{Oc::Config.get("client_id")}&api_key=#{Oc::Config.get("api_key")}"
|
27
|
-
|
28
|
-
parameter = ""
|
29
|
-
if parameters.length > 0
|
30
|
-
parameters.each do |p,v|
|
31
|
-
parameter += "&#{p}=#{v}"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
parameter = URI::escape(parameter)
|
36
|
-
|
37
|
-
source = url + parameter
|
38
|
-
|
39
|
-
puts "I'm thinking, please wait..".blue
|
40
|
-
response = Net::HTTP.get_response(URI.parse(source))
|
41
|
-
data = response.body
|
42
|
-
result = JSON.parse(data)
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def self.get_json_url url ,parameters=[]
|
47
|
-
|
48
|
-
url += "?client_id=#{Oc::Config.get("client_id")}&api_key=#{Oc::Config.get("api_key")}"
|
49
|
-
|
50
|
-
parameter = ""
|
51
|
-
if parameters.length > 0
|
52
|
-
parameters.each do |p,v|
|
53
|
-
parameter += "&#{p}=#{v}"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
parameter = URI::escape(parameter)
|
58
|
-
|
59
|
-
source = url + parameter
|
60
|
-
|
61
|
-
puts "I'm thinking, please wait..".blue
|
62
|
-
response = Net::HTTP.get_response(URI.parse(source))
|
63
|
-
data = response.body
|
64
|
-
result = JSON.parse(data)
|
65
|
-
end
|
66
|
-
|
67
9
|
end
|
68
10
|
end
|
@@ -40,7 +40,7 @@ module Oc::Run
|
|
40
40
|
if name.nil? or pub_key.nil?
|
41
41
|
puts "Argument Error".red
|
42
42
|
puts "Usage".yellow
|
43
|
-
puts "$ oc ssh add [KEY_NAME] [
|
43
|
+
puts "$ oc ssh add [KEY_NAME] [KEY_PUB]".yellow
|
44
44
|
else
|
45
45
|
result = barge.key.create({
|
46
46
|
:name => name,
|
@@ -90,7 +90,7 @@ module Oc::Run
|
|
90
90
|
end
|
91
91
|
|
92
92
|
description "This method allows you to modify an existing public SSH key in your account."
|
93
|
-
syntax "oc ssh edit [KEY_ID] [KEY_NAME] [
|
93
|
+
syntax "oc ssh edit [KEY_ID] [KEY_NAME] [KEY_PUB]"
|
94
94
|
|
95
95
|
def update(*args)
|
96
96
|
id = args[0]
|