rumm 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +11 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +6 -0
- data/app.rb +7 -0
- data/app/controllers/attachments_controller.rb +39 -0
- data/app/controllers/authentication_controller.rb +47 -0
- data/app/controllers/containers_controller.rb +32 -0
- data/app/controllers/databases_controller.rb +43 -0
- data/app/controllers/files_controller.rb +41 -0
- data/app/controllers/images_controller.rb +7 -0
- data/app/controllers/instances_controller.rb +34 -0
- data/app/controllers/loadbalancers_controller.rb +32 -0
- data/app/controllers/nodes_controller.rb +45 -0
- data/app/controllers/servers_controller.rb +52 -0
- data/app/controllers/volumes_controller.rb +35 -0
- data/app/forms/loadbalancers/create_form.rb +35 -0
- data/app/models/loadbalancers/node.rb +10 -0
- data/app/models/node.rb +0 -0
- data/app/providers/compute_provider.rb +15 -0
- data/app/providers/console_provider.rb +5 -0
- data/app/providers/containers_provider.rb +15 -0
- data/app/providers/credentials_provider.rb +12 -0
- data/app/providers/databases_provider.rb +13 -0
- data/app/providers/instance_provider.rb +8 -0
- data/app/providers/instances_provider.rb +13 -0
- data/app/providers/loadbalancers_provider.rb +13 -0
- data/app/providers/naming/adj.txt +20574 -0
- data/app/providers/naming/nouns.txt +50277 -0
- data/app/providers/naming_provider.rb +106 -0
- data/app/providers/nodes_provider.rb +13 -0
- data/app/providers/user_provider.rb +23 -0
- data/app/providers/volumes_provider.rb +14 -0
- data/app/routes.rb +59 -0
- data/app/views/attachments/attach.txt.erb +3 -0
- data/app/views/attachments/detach.txt.erb +3 -0
- data/app/views/attachments/index.txt.erb +7 -0
- data/app/views/attachments/show.txt.erb +5 -0
- data/app/views/authentication/login.txt.erb +2 -0
- data/app/views/authentication/logout.txt.erb +1 -0
- data/app/views/containers/create.txt.erb +5 -0
- data/app/views/containers/destroy.txt.erb +1 -0
- data/app/views/containers/index.txt.erb +7 -0
- data/app/views/containers/show.txt.erb +5 -0
- data/app/views/databases/create.txt.erb +1 -0
- data/app/views/databases/destroy.txt.erb +1 -0
- data/app/views/databases/index.txt.erb +8 -0
- data/app/views/databases/show.txt.erb +1 -0
- data/app/views/files/create.txt.erb +5 -0
- data/app/views/files/destroy.txt.erb +1 -0
- data/app/views/files/download.txt.erb +3 -0
- data/app/views/files/index.txt.erb +7 -0
- data/app/views/files/show.txt.erb +5 -0
- data/app/views/images/index.txt.erb +3 -0
- data/app/views/instances/create.txt.erb +2 -0
- data/app/views/instances/destroy.txt.erb +1 -0
- data/app/views/instances/index.txt.erb +8 -0
- data/app/views/instances/show.txt.erb +1 -0
- data/app/views/loadbalancers/create.txt.erb +1 -0
- data/app/views/loadbalancers/destroy.txt.erb +1 -0
- data/app/views/loadbalancers/index.txt.erb +8 -0
- data/app/views/loadbalancers/show.txt.erb +4 -0
- data/app/views/nodes/create.txt.erb +5 -0
- data/app/views/nodes/destroy.txt.erb +1 -0
- data/app/views/nodes/index.txt.erb +4 -0
- data/app/views/nodes/show.txt.erb +5 -0
- data/app/views/servers/create.txt.erb +2 -0
- data/app/views/servers/destroy.txt.erb +1 -0
- data/app/views/servers/index.txt.erb +8 -0
- data/app/views/servers/show.txt.erb +5 -0
- data/app/views/volumes/create.txt.erb +5 -0
- data/app/views/volumes/destroy.txt.erb +1 -0
- data/app/views/volumes/index.txt.erb +7 -0
- data/app/views/volumes/show.txt.erb +5 -0
- data/bin/rumm +5 -0
- data/lib/rumm.rb +5 -0
- data/lib/rumm/version.rb +3 -0
- data/rumm.gemspec +24 -0
- data/spec/features/login_spec.rb +29 -0
- data/spec/features/servers_spec.rb +39 -0
- data/spec/fixtures/cassettes/create-server.yml +144 -0
- data/spec/fixtures/cassettes/destroy-server.yml +159 -0
- data/spec/fixtures/cassettes/show-server.yml +214 -0
- data/spec/fixtures/cassettes/show-servers.yml +141 -0
- data/spec/spec_helper.rb +51 -0
- metadata +203 -0
@@ -0,0 +1,106 @@
|
|
1
|
+
class NamingProvider
|
2
|
+
|
3
|
+
def value
|
4
|
+
self
|
5
|
+
end
|
6
|
+
|
7
|
+
def generate_name adj, noun
|
8
|
+
if adj == nil and noun == nil
|
9
|
+
get_adj + "-" + get_noun
|
10
|
+
else
|
11
|
+
get_adj_bound(adj) + "-" + get_noun_bound(noun)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def get_adj
|
18
|
+
a = rand(20748)
|
19
|
+
counter = 0
|
20
|
+
dict = File.new(File.expand_path "../naming/adj.txt", __FILE__)
|
21
|
+
dict.each_line do |line|
|
22
|
+
if counter == a
|
23
|
+
return line.delete("\n")
|
24
|
+
end
|
25
|
+
counter+=1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_noun
|
30
|
+
a = rand(50432)
|
31
|
+
counter = 0
|
32
|
+
dict = File.new(File.expand_path "../naming/nouns.txt", __FILE__)
|
33
|
+
dict.each_line do |line|
|
34
|
+
if counter == a
|
35
|
+
return line.delete("\n")
|
36
|
+
end
|
37
|
+
counter+=1
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def get_adj_bound letter
|
42
|
+
higher = true
|
43
|
+
upper = 20748
|
44
|
+
lower = 0
|
45
|
+
a = 0
|
46
|
+
word = ""
|
47
|
+
done = false
|
48
|
+
until done
|
49
|
+
if higher
|
50
|
+
lower = a
|
51
|
+
else
|
52
|
+
upper = a
|
53
|
+
end
|
54
|
+
a = rand lower..upper
|
55
|
+
counter = 0
|
56
|
+
dict = File.new(File.expand_path "../naming/adj.txt", __FILE__)
|
57
|
+
dict.each_line do |line|
|
58
|
+
if counter == a
|
59
|
+
word = line.delete("\n")
|
60
|
+
break
|
61
|
+
end
|
62
|
+
counter+=1
|
63
|
+
end
|
64
|
+
if word[0] == letter
|
65
|
+
return word
|
66
|
+
elsif word[0] <= letter
|
67
|
+
higher = true
|
68
|
+
else
|
69
|
+
higher = false
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def get_noun_bound letter
|
75
|
+
higher = true
|
76
|
+
upper = 50432
|
77
|
+
lower = 0
|
78
|
+
a = 0
|
79
|
+
word = ""
|
80
|
+
done = false
|
81
|
+
until done
|
82
|
+
if higher
|
83
|
+
lower = a
|
84
|
+
else
|
85
|
+
upper = a
|
86
|
+
end
|
87
|
+
a = rand lower..upper
|
88
|
+
counter = 0
|
89
|
+
dict = File.new(File.expand_path "../naming/nouns.txt", __FILE__)
|
90
|
+
dict.each_line do |line|
|
91
|
+
if counter == a
|
92
|
+
word = line.delete("\n")
|
93
|
+
break
|
94
|
+
end
|
95
|
+
counter+=1
|
96
|
+
end
|
97
|
+
if word[0] == letter
|
98
|
+
return word
|
99
|
+
elsif word[0] <= letter
|
100
|
+
higher = true
|
101
|
+
else
|
102
|
+
higher = false
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'fog'
|
2
|
+
class NodesProvider
|
3
|
+
requires :credentials
|
4
|
+
|
5
|
+
def value
|
6
|
+
options = {
|
7
|
+
:rackspace_username => credentials.username,
|
8
|
+
:rackspace_api_key => credentials.api_key,
|
9
|
+
:rackspace_region => credentials.rackspace_region
|
10
|
+
}
|
11
|
+
Fog::Rackspace::LoadBalancers.new(options).nodes
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'io/console'
|
2
|
+
|
3
|
+
class UserProvider
|
4
|
+
requires :command
|
5
|
+
|
6
|
+
def value
|
7
|
+
name = get_name
|
8
|
+
password = get_password
|
9
|
+
Map(name: name, password: password)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def get_name
|
15
|
+
command.output.print "Username: "
|
16
|
+
command.input.gets.chomp
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_password
|
20
|
+
command.output.print "Password: "
|
21
|
+
command.input.noecho(&:gets).chomp
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'fog'
|
2
|
+
|
3
|
+
class VolumesProvider
|
4
|
+
requires :credentials
|
5
|
+
|
6
|
+
def value
|
7
|
+
options = {
|
8
|
+
:rackspace_username => credentials.username,
|
9
|
+
:rackspace_api_key => credentials.api_key,
|
10
|
+
:rackspace_region => credentials.rackspace_region
|
11
|
+
}
|
12
|
+
Fog::Rackspace::BlockStorage.new(options).volumes
|
13
|
+
end
|
14
|
+
end
|
data/app/routes.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
match 'login' => 'authentication#login'
|
2
|
+
match 'logout' => 'authentication#logout'
|
3
|
+
|
4
|
+
match 'show images' => 'images#index'
|
5
|
+
|
6
|
+
match 'show servers' => 'servers#index'
|
7
|
+
match 'show server :id' => 'servers#show'
|
8
|
+
match 'create server' => 'servers#create'
|
9
|
+
match 'update server :id' => 'servers#update'
|
10
|
+
match 'destroy server :id' => 'servers#destroy'
|
11
|
+
|
12
|
+
match 'show loadbalancers' => 'loadbalancers#index'
|
13
|
+
match 'show loadbalancer :id' => 'loadbalancers#show'
|
14
|
+
match 'create loadbalancer' => 'loadbalancers#create'
|
15
|
+
match 'update loadbalancer :id' => 'loadbalancers#update'
|
16
|
+
match 'destroy loadbalancer :id' => 'loadbalancers#destroy'
|
17
|
+
|
18
|
+
match 'show nodes on loadbalancer :loadbalancer_id' => 'nodes#index'
|
19
|
+
match 'show node :id on loadbalancer :loadbalancer_id' => 'nodes#show'
|
20
|
+
match 'create node on loadbalancer :loadbalancer_id' => 'nodes#create'
|
21
|
+
match 'update node :id on loadbalancer :loadbalancer_id' => 'nodes#update'
|
22
|
+
match 'destroy node :id on loadbalancer :loadbalancer_id' => 'nodes#destroy'
|
23
|
+
|
24
|
+
match 'show dbinstances' => 'instances#index'
|
25
|
+
match 'show dbinstance :id' => 'instances#show'
|
26
|
+
match 'create dbinstance' => 'instances#create'
|
27
|
+
match 'update dbinstance :id' => 'instances#update'
|
28
|
+
match 'destroy dbinstance :id' => 'instances#destroy'
|
29
|
+
|
30
|
+
match 'show databases on dbinstance :instance_id' => 'databases#index'
|
31
|
+
match 'show database :id on dbinstance :instance_id' => 'databases#show'
|
32
|
+
match 'create database on dbinstance :instance_id' => 'databases#create'
|
33
|
+
match 'update database :id on dbinstance :instance_id' => 'databases#update'
|
34
|
+
match 'destroy database :id on dbinstance :instance_id' => 'databases#destroy'
|
35
|
+
|
36
|
+
match 'ssh :id' => 'servers#ssh'
|
37
|
+
|
38
|
+
match 'show containers' => 'containers#index'
|
39
|
+
match 'show container :id' => 'containers#show'
|
40
|
+
match 'create container' => 'containers#create'
|
41
|
+
match 'update container :id' => 'containers#update'
|
42
|
+
match 'destroy container :id' => 'containers#destroy'
|
43
|
+
|
44
|
+
match 'show files in container :container_id' => 'files#index'
|
45
|
+
match 'show file :id in container :container_id' => 'files#show'
|
46
|
+
match 'create file :id in container :container_id' => 'files#create'
|
47
|
+
match 'update file :id in container :container_id' => 'files#update'
|
48
|
+
match 'destroy file :id in container :container_id' => 'files#destroy'
|
49
|
+
match 'download file :id in container :container_id' => 'files#download'
|
50
|
+
|
51
|
+
match 'show volumes' => 'volumes#index'
|
52
|
+
match 'show volume :id' => 'volumes#show'
|
53
|
+
match 'create volume' => 'volumes#create'
|
54
|
+
match 'update volume :id' => 'volumes#update'
|
55
|
+
match 'destroy volume :id' => 'volumes#destroy'
|
56
|
+
|
57
|
+
match 'show attachments on server :server_id' => 'attachments#index'
|
58
|
+
match 'attach volume :id to server :server_id' => 'attachments#attach'
|
59
|
+
match 'detach volume :id from server :server_id' => 'attachments#detach'
|
@@ -0,0 +1 @@
|
|
1
|
+
logged out.
|
@@ -0,0 +1 @@
|
|
1
|
+
requested destruction of container <%= self %>
|
@@ -0,0 +1 @@
|
|
1
|
+
created database: <%= name %>
|
@@ -0,0 +1 @@
|
|
1
|
+
database instance <%= name %> queued for destruction
|
@@ -0,0 +1 @@
|
|
1
|
+
name: <%= name %>
|
@@ -0,0 +1 @@
|
|
1
|
+
requested destruction of container <%= self %>
|
@@ -0,0 +1 @@
|
|
1
|
+
requested destruction of instance <%= name %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= name %> -> id: <%= id %>, status: <%= state %>
|
@@ -0,0 +1 @@
|
|
1
|
+
created load balancer: <%= name %>
|
@@ -0,0 +1 @@
|
|
1
|
+
requested destruction of load balancer <%= name %>
|
@@ -0,0 +1 @@
|
|
1
|
+
requested destruction of node <%= self %>
|
@@ -0,0 +1 @@
|
|
1
|
+
requested destruction of server <%= name %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% if empty? %>
|
2
|
+
you don't have any servers, but you can create one by running:
|
3
|
+
rumm create server
|
4
|
+
<% else %>
|
5
|
+
<% each do |server| %>
|
6
|
+
<%= server.name %> -> id: <%= server.id %>, status: <%= server.state %><%= "(#{server.progress}%)" unless server.state == 'ACTIVE' %>, ipv4: <%= server.ipv4_address == '' ? 'not available' : server.ipv4_address %>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
requested destruction of container <%= self %>
|