shelly 0.4.29 → 0.4.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +0 -3
- data/CHANGELOG.md +8 -0
- data/lib/shelly/app.rb +6 -2
- data/lib/shelly/cli/config.rb +8 -4
- data/lib/shelly/cli/main.rb +10 -8
- data/lib/shelly/client/apps.rb +0 -4
- data/lib/shelly/helpers.rb +16 -0
- data/lib/shelly/version.rb +1 -1
- data/spec/shelly/app_spec.rb +0 -25
- data/spec/shelly/cli/config_spec.rb +31 -0
- data/spec/shelly/cli/main_spec.rb +54 -47
- data/spec/shelly/client_spec.rb +0 -38
- metadata +38 -38
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
OWI4ZDNmNGI0ZWE2NmFkNDQzN2YzMDY3YjQ2ODczYzkzNmMzNGVlZg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 08f4c5b1816282bda6bfd4b66605efe25fbc739c
|
4
|
+
data.tar.gz: 2f0e18aab9fc1a5a19096c9ba3682c1ae0e99cad
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Mjc4MWRhMTRjN2I1ZGQ4OGY0YjVkODFmYjU4ZGY0Mjk2NDkxNjljNjhmZjQ2
|
11
|
-
NjE2YTgzMTI1ZWJkYjEzZmJkNGE1MTEyOTU2YzgzY2IzZmIxZGE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
M2ZkODAzMjBkZmMxOWUxNmE0NjQzM2IyY2QwZmVkMmIyYWYwMmU1ZTEwZTFk
|
14
|
-
OTQyODE4ZjZkYWJhY2QyMmNkM2ZhYzI0NzAyYTg4ZTUwZmQ5ZjFlNDJiYjgx
|
15
|
-
YTI0ZTZkY2Q3ZGJlOTMxMDM4MjZlNWFiMTU2ZTg1ZWZkZTAyNjQ=
|
6
|
+
metadata.gz: af1e79cc70081ab911b95bf40b7acdff0d8eb7a7a2fd68eff7f27cf470c9818693fe727c3168fdfc34a2504c556ae087e8122702c99e28cbb2657db6ee8810d5
|
7
|
+
data.tar.gz: 07846a4da96ee42fba0f9b72232b3d2d2818c648cd3ec26b19c0e643eced8a05a03d9d3c206c8582916983c162b58d00c8efad2e237d914b2b34d31ce3ba385f
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 0.4.30 / 2014-04-14
|
2
|
+
|
3
|
+
* [feature] `shelly config create` will check if config already exists in
|
4
|
+
specified path
|
5
|
+
* [bugfix] With multiple clouds in `Cloudfile`, `shelly config create`
|
6
|
+
should not open the editor if no cloud is specified
|
7
|
+
* [bugfix] Fixed wrong usage values given by `shelly info`
|
8
|
+
|
1
9
|
## 0.4.29 / 2014-03-27
|
2
10
|
|
3
11
|
* [bugfix] Use childprocess to start ssh related commands. Fixes tty issue
|
data/lib/shelly/app.rb
CHANGED
@@ -14,7 +14,7 @@ module Shelly
|
|
14
14
|
|
15
15
|
attr_accessor :code_name, :databases, :ruby_version, :environment,
|
16
16
|
:git_url, :domains, :web_server_ip, :size, :thin,
|
17
|
-
:organization_name, :zone_name
|
17
|
+
:organization_name, :zone_name, :usage, :traffic
|
18
18
|
|
19
19
|
def initialize(code_name = nil)
|
20
20
|
self.code_name = code_name
|
@@ -240,7 +240,11 @@ module Shelly
|
|
240
240
|
end
|
241
241
|
|
242
242
|
def usage
|
243
|
-
|
243
|
+
attributes["billing"]["current_month_costs"]["usage"]
|
244
|
+
end
|
245
|
+
|
246
|
+
def traffic
|
247
|
+
attributes["billing"]["current_month_costs"]["traffic"]
|
244
248
|
end
|
245
249
|
|
246
250
|
def system_user
|
data/lib/shelly/cli/config.rb
CHANGED
@@ -50,11 +50,15 @@ module Shelly
|
|
50
50
|
map "new" => :create
|
51
51
|
desc "create PATH", "Create configuration file"
|
52
52
|
def create(path)
|
53
|
-
output = open_editor(path)
|
54
53
|
app = multiple_clouds(options[:cloud], "create #{path}")
|
55
|
-
app.
|
56
|
-
|
57
|
-
|
54
|
+
if app.config_exists?(path)
|
55
|
+
say "File '#{path}' already exists. Use `shelly config edit #{path} --cloud #{options[:cloud]}` to update it.", :red
|
56
|
+
else
|
57
|
+
output = open_editor(path)
|
58
|
+
app.create_config(path, output)
|
59
|
+
say "File '#{path}' created.", :green
|
60
|
+
next_action_info(app)
|
61
|
+
end
|
58
62
|
rescue Client::ValidationException => e
|
59
63
|
e.each_error { |error| say_error error, :with_exit => false }
|
60
64
|
exit 1
|
data/lib/shelly/cli/main.rb
CHANGED
@@ -119,15 +119,17 @@ module Shelly
|
|
119
119
|
print_wrapped "Web server IP: #{app.web_server_ip}", :ident => 2
|
120
120
|
say_new_line
|
121
121
|
print_wrapped "Usage:", :ident => 2
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
122
|
+
if app.usage.present?
|
123
|
+
app.usage.each do |usage|
|
124
|
+
print_wrapped "#{usage['kind'].capitalize}:", :ident => 4
|
125
|
+
print_wrapped "Current: #{number_to_human_size(usage['current'])}", :ident => 6
|
126
|
+
print_wrapped "Average: #{number_to_human_size(usage['avg'])}", :ident => 6
|
127
|
+
end
|
128
|
+
end
|
128
129
|
print_wrapped "Traffic:", :ident => 4
|
129
|
-
print_wrapped "Incoming: #{app.
|
130
|
-
print_wrapped "Outgoing: #{app.
|
130
|
+
print_wrapped "Incoming: #{number_to_human_size(app.traffic['incoming'])}", :ident => 6
|
131
|
+
print_wrapped "Outgoing: #{number_to_human_size(app.traffic['outgoing'])}", :ident => 6
|
132
|
+
print_wrapped "Total: #{number_to_human_size(app.traffic['total'])}", :ident => 6
|
131
133
|
say_new_line
|
132
134
|
if app.statistics.present?
|
133
135
|
print_wrapped "Statistics:", :ident => 2
|
data/lib/shelly/client/apps.rb
CHANGED
data/lib/shelly/helpers.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Shelly
|
3
3
|
module Helpers
|
4
|
+
UNITS = %W(B KiB MiB GiB TiB).freeze
|
5
|
+
|
4
6
|
def say_new_line
|
5
7
|
say "\n"
|
6
8
|
end
|
@@ -188,5 +190,19 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository}
|
|
188
190
|
" (deployment log: `shelly deploys show last -c #{app}`)"
|
189
191
|
end
|
190
192
|
end
|
193
|
+
|
194
|
+
def number_to_human_size(number)
|
195
|
+
if number.to_i < 1024
|
196
|
+
exponent = 0
|
197
|
+
else
|
198
|
+
max_exp = UNITS.size - 1
|
199
|
+
exponent = (Math.log(number) / Math.log( 1024 )).to_i
|
200
|
+
exponent = max_exp if exponent > max_exp
|
201
|
+
|
202
|
+
number /= 1024.to_f ** exponent
|
203
|
+
end
|
204
|
+
|
205
|
+
"#{number.round(2)} #{UNITS[exponent]}"
|
206
|
+
end
|
191
207
|
end
|
192
208
|
end
|
data/lib/shelly/version.rb
CHANGED
data/spec/shelly/app_spec.rb
CHANGED
@@ -229,31 +229,6 @@ describe Shelly::App do
|
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
232
|
-
describe "#usage" do
|
233
|
-
before do
|
234
|
-
@response = {
|
235
|
-
"filesystem" => {
|
236
|
-
"avg" => "32 KiB",
|
237
|
-
"current" => "64 KiB"
|
238
|
-
},
|
239
|
-
"database" => {
|
240
|
-
"avg" => "64 KiB",
|
241
|
-
"current" => "128 KiB"
|
242
|
-
},
|
243
|
-
"traffic" => {
|
244
|
-
"incoming" => "32 KiB",
|
245
|
-
"outgoing" => "64 KiB"
|
246
|
-
}
|
247
|
-
}
|
248
|
-
@client.stub(:usage).and_return(@response)
|
249
|
-
end
|
250
|
-
|
251
|
-
it "should fetch app usage from API and cache them" do
|
252
|
-
@client.should_receive(:usage).with("foo-staging").exactly(:once).and_return(@response)
|
253
|
-
2.times { @app.usage }
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
232
|
describe "#start & #stop" do
|
258
233
|
it "should start cloud" do
|
259
234
|
@client.should_receive(:start_cloud).with("foo-staging").
|
@@ -86,6 +86,10 @@ describe Shelly::CLI::Config do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
describe "#create" do
|
89
|
+
before do
|
90
|
+
@config.stub(:multiple_clouds => @app)
|
91
|
+
end
|
92
|
+
|
89
93
|
it "should ensure user has logged in" do
|
90
94
|
hooks(@config, :create).should include(:logged_in?)
|
91
95
|
end
|
@@ -94,6 +98,7 @@ describe Shelly::CLI::Config do
|
|
94
98
|
[:add, :new].each do |a|
|
95
99
|
it "should respond to '#{a}' alias" do
|
96
100
|
@config.should_receive(:system).and_return(true)
|
101
|
+
@app.stub(:config_exists? => false)
|
97
102
|
@client.should_receive(:app_create_config)
|
98
103
|
invoke(@config, a, "path")
|
99
104
|
end
|
@@ -108,19 +113,43 @@ describe Shelly::CLI::Config do
|
|
108
113
|
it "should ensure multiple_clouds check" do
|
109
114
|
@config.should_receive(:system).with(/vim \/tmp\/shelly-edit/).and_return(true)
|
110
115
|
Shelly::App.stub(:new).and_return(@app)
|
116
|
+
@app.stub(:config_exists? => false)
|
111
117
|
@client.should_receive(:app_create_config).with("foo-production", "path", "\n").and_return({})
|
112
118
|
@config.should_receive(:multiple_clouds).and_return(@app)
|
113
119
|
invoke(@config, :create, "path")
|
114
120
|
end
|
115
121
|
|
122
|
+
it "should warn that config file already exists in specified path" do
|
123
|
+
Shelly::App.stub(:new).and_return(@app)
|
124
|
+
@app.stub(:config_exists? => true)
|
125
|
+
$stdout.should_receive(:puts).with(red "File 'new_config' already exists. Use `shelly config edit new_config --cloud ` to update it.")
|
126
|
+
invoke(@config, :create, "new_config")
|
127
|
+
end
|
128
|
+
|
129
|
+
context "when multiple clouds in Cloudfile" do
|
130
|
+
before do
|
131
|
+
File.open("Cloudfile", 'w') {|f|
|
132
|
+
f.write("foo-staging:\nfoo-production:\n") }
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should not open the editor if no cloud is specified" do
|
136
|
+
@config.unstub(:multiple_clouds)
|
137
|
+
@config.should_not_receive(:system)
|
138
|
+
$stdout.should_receive(:puts).with(red "You have multiple clouds in Cloudfile.")
|
139
|
+
lambda { invoke(@config, :create, "path") }.should raise_error(SystemExit)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
116
143
|
it "should ask to set EDITOR environment variable if not set" do
|
117
144
|
@config.stub(:system) {false}
|
145
|
+
@app.stub(:config_exists? => false)
|
118
146
|
$stdout.should_receive(:puts).with(red "Please set EDITOR environment variable")
|
119
147
|
lambda { invoke(@config, :create, "path") }.should raise_error(SystemExit)
|
120
148
|
end
|
121
149
|
|
122
150
|
context "cloud running" do
|
123
151
|
it "should create file" do
|
152
|
+
@app.stub(:config_exists? => false)
|
124
153
|
@config.should_receive(:system).with(/vim \/tmp\/shelly-edit/).and_return(true)
|
125
154
|
@client.should_receive(:app_create_config).with("foo-production", "path", "\n").and_return({})
|
126
155
|
$stdout.should_receive(:puts).with(green "File 'path' created.")
|
@@ -132,6 +161,7 @@ describe Shelly::CLI::Config do
|
|
132
161
|
|
133
162
|
context "cloud turned off" do
|
134
163
|
it "should print " do
|
164
|
+
@app.stub(:config_exists? => false)
|
135
165
|
@client.stub(:app).and_return('state' => 'turned_off')
|
136
166
|
@config.should_receive(:system).with(/vim \/tmp\/shelly-edit/).and_return(true)
|
137
167
|
@client.should_receive(:app_create_config).with("foo-production", "path", "\n").and_return({})
|
@@ -144,6 +174,7 @@ describe Shelly::CLI::Config do
|
|
144
174
|
|
145
175
|
context "on validation errors" do
|
146
176
|
it "should display validation errors" do
|
177
|
+
@app.stub(:config_exists? => false)
|
147
178
|
exception = Shelly::Client::ValidationException.new({"errors" => [["path", "is already taken"]]})
|
148
179
|
@config.should_receive(:system).with(/vim \/tmp\/shelly-edit/).and_return(true)
|
149
180
|
@client.stub(:app_create_config).and_raise(exception)
|
@@ -975,22 +975,7 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
975
975
|
"swap" => {"kilobyte" => "44332", "percent" => "2.8"},
|
976
976
|
"cpu" => {"wait" => "0.8", "system" => "0.0", "user" => "0.1"},
|
977
977
|
"load" => {"avg15" => "0.13", "avg05" => "0.15", "avg01" => "0.04"}}]
|
978
|
-
@usage = {
|
979
|
-
"filesystem" => {
|
980
|
-
"avg" => "32 KiB",
|
981
|
-
"current" => "64 KiB"
|
982
|
-
},
|
983
|
-
"database" => {
|
984
|
-
"avg" => "64 KiB",
|
985
|
-
"current" => "128 KiB"
|
986
|
-
},
|
987
|
-
"traffic" => {
|
988
|
-
"incoming" => "32 KiB",
|
989
|
-
"outgoing" => "64 KiB"
|
990
|
-
}
|
991
|
-
}
|
992
978
|
@app.stub(:statistics).and_return(@statistics)
|
993
|
-
@app.stub(:usage).and_return(@usage)
|
994
979
|
end
|
995
980
|
|
996
981
|
it "should ensure user has logged in" do
|
@@ -1013,20 +998,21 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
1013
998
|
$stdout.should_receive(:puts).with(" Deployed by: megan@example.com")
|
1014
999
|
$stdout.should_receive(:puts).with(" Repository URL: git@winniecloud.net:example-cloud")
|
1015
1000
|
$stdout.should_receive(:puts).with(" Web server IP: 22.22.22.22")
|
1016
|
-
$stdout.should_receive(:puts).with(" Usage:")
|
1017
|
-
$stdout.should_receive(:puts).with(" Filesystem:")
|
1018
|
-
$stdout.should_receive(:puts).with(" Average: 32 KiB")
|
1019
|
-
$stdout.should_receive(:puts).with(" Current: 64 KiB")
|
1020
|
-
$stdout.should_receive(:puts).with(" Database:")
|
1021
|
-
$stdout.should_receive(:puts).with(" Average: 64 KiB")
|
1022
|
-
$stdout.should_receive(:puts).with(" Current: 128 KiB")
|
1023
|
-
$stdout.should_receive(:puts).with(" Traffic:")
|
1024
|
-
$stdout.should_receive(:puts).with(" Incoming: 32 KiB")
|
1025
|
-
$stdout.should_receive(:puts).with(" Outgoing: 64 KiB")
|
1026
1001
|
$stdout.should_receive(:puts).with(" Statistics:")
|
1027
1002
|
$stdout.should_receive(:puts).with(" app1:")
|
1028
1003
|
$stdout.should_receive(:puts).with(" Load average: 1m: 0.04, 5m: 0.15, 15m: 0.13")
|
1029
1004
|
$stdout.should_receive(:puts).with(" CPU: 0.8%, MEM: 74.1%, SWAP: 2.8%")
|
1005
|
+
$stdout.should_receive(:puts).with(" Usage:")
|
1006
|
+
$stdout.should_receive(:puts).with(" Filesystem:")
|
1007
|
+
$stdout.should_receive(:puts).with(" Current: 2.04 GiB")
|
1008
|
+
$stdout.should_receive(:puts).with(" Average: 182.39 MiB")
|
1009
|
+
$stdout.should_receive(:puts).with(" Database:")
|
1010
|
+
$stdout.should_receive(:puts).with(" Current: 1.19 MiB")
|
1011
|
+
$stdout.should_receive(:puts).with(" Average: 18.24 MiB")
|
1012
|
+
$stdout.should_receive(:puts).with(" Traffic:")
|
1013
|
+
$stdout.should_receive(:puts).with(" Incoming: 11.54 GiB")
|
1014
|
+
$stdout.should_receive(:puts).with(" Outgoing: 1.15 GiB")
|
1015
|
+
$stdout.should_receive(:puts).with(" Total: 12.69 GiB")
|
1030
1016
|
invoke(@main, :info)
|
1031
1017
|
end
|
1032
1018
|
|
@@ -1045,20 +1031,21 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
1045
1031
|
$stdout.should_receive(:puts).with(" Deployed by: megan@example.com")
|
1046
1032
|
$stdout.should_receive(:puts).with(" Repository URL: git@winniecloud.net:example-cloud")
|
1047
1033
|
$stdout.should_receive(:puts).with(" Web server IP: 22.22.22.22")
|
1048
|
-
$stdout.should_receive(:puts).with(" Usage:")
|
1049
|
-
$stdout.should_receive(:puts).with(" Filesystem:")
|
1050
|
-
$stdout.should_receive(:puts).with(" Average: 32 KiB")
|
1051
|
-
$stdout.should_receive(:puts).with(" Current: 64 KiB")
|
1052
|
-
$stdout.should_receive(:puts).with(" Database:")
|
1053
|
-
$stdout.should_receive(:puts).with(" Average: 64 KiB")
|
1054
|
-
$stdout.should_receive(:puts).with(" Current: 128 KiB")
|
1055
|
-
$stdout.should_receive(:puts).with(" Traffic:")
|
1056
|
-
$stdout.should_receive(:puts).with(" Incoming: 32 KiB")
|
1057
|
-
$stdout.should_receive(:puts).with(" Outgoing: 64 KiB")
|
1058
1034
|
$stdout.should_receive(:puts).with(" Statistics:")
|
1059
1035
|
$stdout.should_receive(:puts).with(" app1:")
|
1060
1036
|
$stdout.should_receive(:puts).with(" Load average: 1m: 0.04, 5m: 0.15, 15m: 0.13")
|
1061
1037
|
$stdout.should_receive(:puts).with(" CPU: 0.8%, MEM: 74.1%, SWAP: 2.8%")
|
1038
|
+
$stdout.should_receive(:puts).with(" Usage:")
|
1039
|
+
$stdout.should_receive(:puts).with(" Filesystem:")
|
1040
|
+
$stdout.should_receive(:puts).with(" Current: 2.04 GiB")
|
1041
|
+
$stdout.should_receive(:puts).with(" Average: 182.39 MiB")
|
1042
|
+
$stdout.should_receive(:puts).with(" Database:")
|
1043
|
+
$stdout.should_receive(:puts).with(" Current: 1.19 MiB")
|
1044
|
+
$stdout.should_receive(:puts).with(" Average: 18.24 MiB")
|
1045
|
+
$stdout.should_receive(:puts).with(" Traffic:")
|
1046
|
+
$stdout.should_receive(:puts).with(" Incoming: 11.54 GiB")
|
1047
|
+
$stdout.should_receive(:puts).with(" Outgoing: 1.15 GiB")
|
1048
|
+
$stdout.should_receive(:puts).with(" Total: 12.69 GiB")
|
1062
1049
|
invoke(@main, :info)
|
1063
1050
|
end
|
1064
1051
|
end
|
@@ -1077,20 +1064,21 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
1077
1064
|
$stdout.should_receive(:puts).with(" Deployed by: megan@example.com")
|
1078
1065
|
$stdout.should_receive(:puts).with(" Repository URL: git@winniecloud.net:example-cloud")
|
1079
1066
|
$stdout.should_receive(:puts).with(" Web server IP: 22.22.22.22")
|
1080
|
-
$stdout.should_receive(:puts).with(" Usage:")
|
1081
|
-
$stdout.should_receive(:puts).with(" Filesystem:")
|
1082
|
-
$stdout.should_receive(:puts).with(" Average: 32 KiB")
|
1083
|
-
$stdout.should_receive(:puts).with(" Current: 64 KiB")
|
1084
|
-
$stdout.should_receive(:puts).with(" Database:")
|
1085
|
-
$stdout.should_receive(:puts).with(" Average: 64 KiB")
|
1086
|
-
$stdout.should_receive(:puts).with(" Current: 128 KiB")
|
1087
|
-
$stdout.should_receive(:puts).with(" Traffic:")
|
1088
|
-
$stdout.should_receive(:puts).with(" Incoming: 32 KiB")
|
1089
|
-
$stdout.should_receive(:puts).with(" Outgoing: 64 KiB")
|
1090
1067
|
$stdout.should_receive(:puts).with(" Statistics:")
|
1091
1068
|
$stdout.should_receive(:puts).with(" app1:")
|
1092
1069
|
$stdout.should_receive(:puts).with(" Load average: 1m: 0.04, 5m: 0.15, 15m: 0.13")
|
1093
1070
|
$stdout.should_receive(:puts).with(" CPU: 0.8%, MEM: 74.1%, SWAP: 2.8%")
|
1071
|
+
$stdout.should_receive(:puts).with(" Usage:")
|
1072
|
+
$stdout.should_receive(:puts).with(" Filesystem:")
|
1073
|
+
$stdout.should_receive(:puts).with(" Current: 2.04 GiB")
|
1074
|
+
$stdout.should_receive(:puts).with(" Average: 182.39 MiB")
|
1075
|
+
$stdout.should_receive(:puts).with(" Database:")
|
1076
|
+
$stdout.should_receive(:puts).with(" Current: 1.19 MiB")
|
1077
|
+
$stdout.should_receive(:puts).with(" Average: 18.24 MiB")
|
1078
|
+
$stdout.should_receive(:puts).with(" Traffic:")
|
1079
|
+
$stdout.should_receive(:puts).with(" Incoming: 11.54 GiB")
|
1080
|
+
$stdout.should_receive(:puts).with(" Outgoing: 1.15 GiB")
|
1081
|
+
$stdout.should_receive(:puts).with(" Total: 12.69 GiB")
|
1094
1082
|
invoke(@main, :info)
|
1095
1083
|
end
|
1096
1084
|
end
|
@@ -1119,13 +1107,32 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
1119
1107
|
{ "code_name" => "foo-production",
|
1120
1108
|
"state" => "running",
|
1121
1109
|
"state_description" => "running",
|
1122
|
-
"git_info" =>
|
1123
|
-
{
|
1110
|
+
"git_info" => {
|
1124
1111
|
"deployed_commit_message" => "Commit message",
|
1125
1112
|
"deployed_commit_sha" => "52e65ed2d085eaae560cdb81b2b56a7d76",
|
1126
1113
|
"repository_url" => "git@winniecloud.net:example-cloud",
|
1127
1114
|
"deployed_push_author" => "megan@example.com"
|
1128
1115
|
},
|
1116
|
+
"billing" => {
|
1117
|
+
"current_month_costs" => {
|
1118
|
+
"usage" => [
|
1119
|
+
{
|
1120
|
+
"kind" => "filesystem",
|
1121
|
+
"avg" => 191248000,
|
1122
|
+
"current" => 2191248000
|
1123
|
+
}, {
|
1124
|
+
"kind" => "database",
|
1125
|
+
"avg" => 19128000,
|
1126
|
+
"current" => 1248000
|
1127
|
+
}
|
1128
|
+
],
|
1129
|
+
"traffic" => {
|
1130
|
+
"incoming" => 12391283291,
|
1131
|
+
"outgoing" => 1239123843,
|
1132
|
+
"total" => 12391283291 + 1239123843
|
1133
|
+
}
|
1134
|
+
}
|
1135
|
+
},
|
1129
1136
|
"web_server_ip" => "22.22.22.22"}.merge(options)
|
1130
1137
|
end
|
1131
1138
|
end
|
data/spec/shelly/client_spec.rb
CHANGED
@@ -243,44 +243,6 @@ describe Shelly::Client do
|
|
243
243
|
end
|
244
244
|
end
|
245
245
|
|
246
|
-
describe "#usage" do
|
247
|
-
before do
|
248
|
-
FakeWeb.register_uri(:get,
|
249
|
-
api_url("apps/staging-foo/usage"),
|
250
|
-
:body => {
|
251
|
-
:filesystem => {
|
252
|
-
:avg => "32 KiB",
|
253
|
-
:current => "64 KiB"
|
254
|
-
},
|
255
|
-
:database => {
|
256
|
-
:avg => "64 KiB",
|
257
|
-
:current => "128 KiB"
|
258
|
-
},
|
259
|
-
:traffic => {
|
260
|
-
:incoming => "32 KiB",
|
261
|
-
:outgoing => "64 KiB"
|
262
|
-
}
|
263
|
-
}.to_json)
|
264
|
-
end
|
265
|
-
|
266
|
-
it "should fetch application usage from API" do
|
267
|
-
expect(@client.usage("staging-foo")).to eq({
|
268
|
-
"filesystem" => {
|
269
|
-
"avg" => "32 KiB",
|
270
|
-
"current" => "64 KiB"
|
271
|
-
},
|
272
|
-
"database" => {
|
273
|
-
"avg" => "64 KiB",
|
274
|
-
"current" => "128 KiB"
|
275
|
-
},
|
276
|
-
"traffic" => {
|
277
|
-
"incoming" => "32 KiB",
|
278
|
-
"outgoing" => "64 KiB"
|
279
|
-
}
|
280
|
-
})
|
281
|
-
end
|
282
|
-
end
|
283
|
-
|
284
246
|
describe "#command" do
|
285
247
|
it "should send post request with app code_name, body and type" do
|
286
248
|
@client.should_receive(:post).with("/apps/staging-foo/command",
|
metadata
CHANGED
@@ -1,237 +1,237 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shelly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shelly Cloud team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 2.11.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.11.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: ruby_gntp
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rb-fsevent
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: fakefs
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 0.4.3
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.4.3
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: fakeweb
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: wijet-thor
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: 0.14.10
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: 0.14.10
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rest-client
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: mime-types
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- - ~>
|
157
|
+
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '1.16'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- - ~>
|
164
|
+
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '1.16'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: json
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: progressbar
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: launchy
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ">="
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: '0'
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: netrc
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- -
|
213
|
+
- - ">="
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- -
|
220
|
+
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: childprocess
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- -
|
227
|
+
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
229
|
version: '0'
|
230
230
|
type: :runtime
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
|
-
- -
|
234
|
+
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '0'
|
237
237
|
description: Tool for managing applications and clouds at shellycloud.com
|
@@ -242,8 +242,8 @@ executables:
|
|
242
242
|
extensions: []
|
243
243
|
extra_rdoc_files: []
|
244
244
|
files:
|
245
|
-
- .gitignore
|
246
|
-
- .travis.yml
|
245
|
+
- ".gitignore"
|
246
|
+
- ".travis.yml"
|
247
247
|
- CHANGELOG.md
|
248
248
|
- Gemfile
|
249
249
|
- LICENSE
|
@@ -338,12 +338,12 @@ require_paths:
|
|
338
338
|
- lib
|
339
339
|
required_ruby_version: !ruby/object:Gem::Requirement
|
340
340
|
requirements:
|
341
|
-
- -
|
341
|
+
- - ">="
|
342
342
|
- !ruby/object:Gem::Version
|
343
343
|
version: '0'
|
344
344
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
345
345
|
requirements:
|
346
|
-
- -
|
346
|
+
- - ">="
|
347
347
|
- !ruby/object:Gem::Version
|
348
348
|
version: '0'
|
349
349
|
requirements: []
|