joyent 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/joyent +16 -9
- data/joyent.gemspec +2 -2
- data/lib/joyent/connection.rb +2 -2
- data/lib/joyent/datacenters.rb +4 -0
- metadata +23 -23
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/bin/joyent
CHANGED
@@ -9,10 +9,10 @@ require File.join(File.dirname(__FILE__), '../lib/joyent')
|
|
9
9
|
class JoyentCLI < Thor
|
10
10
|
private
|
11
11
|
|
12
|
-
def get_connection
|
12
|
+
def get_connection(datacenter = Joyent::Datacenters.default)
|
13
13
|
get_config unless load_config
|
14
14
|
|
15
|
-
Joyent::Connection.new(@username, @password)
|
15
|
+
Joyent::Connection.new(@username, @password, datacenter)
|
16
16
|
end
|
17
17
|
|
18
18
|
def load_config
|
@@ -121,8 +121,9 @@ class JoyentCLI < Thor
|
|
121
121
|
# Machines
|
122
122
|
#
|
123
123
|
desc "list_machines", "list all of the machines on the account"
|
124
|
+
method_option :datacenter, :type => :string, :aliases => "-D", :default => Joyent::Datacenters.default
|
124
125
|
def list_machines
|
125
|
-
conn = get_connection
|
126
|
+
conn = get_connection(options["datacenter"])
|
126
127
|
conn.machines.list.each do |m|
|
127
128
|
puts "#{m.name} [#{m.id}]: #{m.dataset} (#{m.state})"
|
128
129
|
end
|
@@ -132,47 +133,53 @@ class JoyentCLI < Thor
|
|
132
133
|
method_option :name, :type => :string, :aliases => "-n"
|
133
134
|
method_option :package, :type => :string, :aliases => "-p"
|
134
135
|
method_option :dataset, :type => :string, :aliases => "-d"
|
136
|
+
method_option :datacenter, :type => :string, :aliases => "-D", :default => Joyent::Datacenters.default
|
135
137
|
def create_machine
|
136
|
-
conn = get_connection
|
138
|
+
conn = get_connection(options["datacenter"])
|
137
139
|
m = conn.machines.create(options)
|
138
140
|
puts "#{m.name}: #{m.dataset} (#{m.state})"
|
139
141
|
end
|
140
142
|
|
141
143
|
desc "stop_machine ID", "stops the machine with the given ID"
|
144
|
+
method_option :datacenter, :type => :string, :aliases => "-D", :default => Joyent::Datacenters.default
|
142
145
|
def stop_machine(id)
|
143
|
-
conn = get_connection
|
146
|
+
conn = get_connection(options["datacenter"])
|
144
147
|
m = conn.machines.get(id)
|
145
148
|
m.stop
|
146
149
|
puts "#{m.name} [#{m.id}] STOPPED"
|
147
150
|
end
|
148
151
|
|
149
152
|
desc "start_machine ID", "starts the machine with the given ID"
|
153
|
+
method_option :datacenter, :type => :string, :aliases => "-D", :default => Joyent::Datacenters.default
|
150
154
|
def start_machine(id)
|
151
|
-
conn = get_connection
|
155
|
+
conn = get_connection(options["datacenter"])
|
152
156
|
m = conn.machines.get(id)
|
153
157
|
m.start
|
154
158
|
puts "#{m.name} [#{m.id}] STARTED"
|
155
159
|
end
|
156
160
|
|
157
161
|
desc "reboot_machine ID", "reboots the machine with the given ID"
|
162
|
+
method_option :datacenter, :type => :string, :aliases => "-D", :default => Joyent::Datacenters.default
|
158
163
|
def reboot_machine(id)
|
159
|
-
conn = get_connection
|
164
|
+
conn = get_connection(options["datacenter"])
|
160
165
|
m = conn.machines.get(id)
|
161
166
|
m.reboot
|
162
167
|
puts "#{m.name} [#{m.id}] REBOOTED"
|
163
168
|
end
|
164
169
|
|
165
170
|
desc "resize_machine ID PACKAGE", "stops the machine with the given ID to the specified PACKAGE"
|
171
|
+
method_option :datacenter, :type => :string, :aliases => "-D", :default => Joyent::Datacenters.default
|
166
172
|
def resize_machine(id, package)
|
167
|
-
conn = get_connection
|
173
|
+
conn = get_connection(options["datacenter"])
|
168
174
|
m = conn.machines.get(id)
|
169
175
|
m.resize(package)
|
170
176
|
puts "#{m.name} [#{m.id}] RESIZED to #{package}"
|
171
177
|
end
|
172
178
|
|
173
179
|
desc "delete_machine ID", "deletes the machine with the given ID"
|
180
|
+
method_option :datacenter, :type => :string, :aliases => "-D", :default => Joyent::Datacenters.default
|
174
181
|
def delete_machine(id)
|
175
|
-
conn = get_connection
|
182
|
+
conn = get_connection(options["datacenter"])
|
176
183
|
m = conn.machines.get(id)
|
177
184
|
m.delete
|
178
185
|
puts "#{m.name} [#{m.id}] DELETED"
|
data/joyent.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{joyent}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ben Wyrosdick"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-10-02}
|
13
13
|
s.default_executable = %q{joyent}
|
14
14
|
s.description = %q{Ruby interface to the joyent cloud API}
|
15
15
|
s.email = %q{ben.wyrosdick@gmail.com}
|
data/lib/joyent/connection.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Joyent
|
2
2
|
class Connection
|
3
|
-
def initialize(username, password)
|
4
|
-
@http_connection = Net::HTTP.new(
|
3
|
+
def initialize(username, password, datacenter = Datacenters.default)
|
4
|
+
@http_connection = Net::HTTP.new(datacenter, 443)
|
5
5
|
@http_connection.use_ssl = true
|
6
6
|
@http_connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
7
7
|
|
data/lib/joyent/datacenters.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: joyent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-02 00:00:00.000000000 -07:00
|
13
13
|
default_executable: joyent
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
17
|
-
requirement: &
|
17
|
+
requirement: &2172690260 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2172690260
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: thor
|
28
|
-
requirement: &
|
28
|
+
requirement: &2172689780 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2172689780
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: shoulda
|
39
|
-
requirement: &
|
39
|
+
requirement: &2172689300 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2172689300
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: yard
|
50
|
-
requirement: &
|
50
|
+
requirement: &2172688820 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 0.6.0
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2172688820
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: bundler
|
61
|
-
requirement: &
|
61
|
+
requirement: &2172705460 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 1.0.0
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2172705460
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: jeweler
|
72
|
-
requirement: &
|
72
|
+
requirement: &2172704980 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 1.6.4
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2172704980
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: rcov
|
83
|
-
requirement: &
|
83
|
+
requirement: &2172704500 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ! '>='
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: '0'
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *2172704500
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: highline
|
94
|
-
requirement: &
|
94
|
+
requirement: &2172704020 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,10 +99,10 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :runtime
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *2172704020
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: thor
|
105
|
-
requirement: &
|
105
|
+
requirement: &2172703540 !ruby/object:Gem::Requirement
|
106
106
|
none: false
|
107
107
|
requirements:
|
108
108
|
- - ! '>='
|
@@ -110,10 +110,10 @@ dependencies:
|
|
110
110
|
version: '0'
|
111
111
|
type: :runtime
|
112
112
|
prerelease: false
|
113
|
-
version_requirements: *
|
113
|
+
version_requirements: *2172703540
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: json
|
116
|
-
requirement: &
|
116
|
+
requirement: &2172703060 !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
119
119
|
- - ! '>='
|
@@ -121,7 +121,7 @@ dependencies:
|
|
121
121
|
version: '0'
|
122
122
|
type: :runtime
|
123
123
|
prerelease: false
|
124
|
-
version_requirements: *
|
124
|
+
version_requirements: *2172703060
|
125
125
|
description: Ruby interface to the joyent cloud API
|
126
126
|
email: ben.wyrosdick@gmail.com
|
127
127
|
executables:
|
@@ -170,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
170
|
version: '0'
|
171
171
|
segments:
|
172
172
|
- 0
|
173
|
-
hash:
|
173
|
+
hash: -2890318799223133059
|
174
174
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
175
|
none: false
|
176
176
|
requirements:
|