shelly 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/shelly/cli/main.rb +8 -0
- data/lib/shelly/client.rb +2 -0
- data/lib/shelly/version.rb +1 -1
- data/spec/shelly/cli/main_spec.rb +20 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Shelly Cloud command line tool [](http://travis-ci.org/Ragnarson/shelly)
|
2
2
|
|
3
3
|
## Installation
|
4
4
|
|
data/lib/shelly/cli/main.rb
CHANGED
@@ -204,6 +204,10 @@ We have been notified about it. We will be adding new resources shortly}
|
|
204
204
|
say_error "Not starting. Invoice for cloud '#{app}' was declined."
|
205
205
|
end
|
206
206
|
exit 1
|
207
|
+
rescue Client::LockedException => e
|
208
|
+
say_error "Deployment is currently blocked:", :with_exit => false
|
209
|
+
say_error e[:message]
|
210
|
+
exit 1
|
207
211
|
end
|
208
212
|
|
209
213
|
desc "setup", "Set up git remotes for deployment on Shelly Cloud"
|
@@ -345,6 +349,10 @@ We have been notified about it. We will be adding new resources shortly}
|
|
345
349
|
exit 1
|
346
350
|
else raise
|
347
351
|
end
|
352
|
+
rescue Client::LockedException => e
|
353
|
+
say_error "Deployment is currently blocked:", :with_exit => false
|
354
|
+
say_error e[:message]
|
355
|
+
exit 1
|
348
356
|
end
|
349
357
|
|
350
358
|
desc "open", "Open application page in browser"
|
data/lib/shelly/client.rb
CHANGED
@@ -22,6 +22,7 @@ module Shelly
|
|
22
22
|
class ConflictException < APIException; end
|
23
23
|
class GemVersionException < APIException; end
|
24
24
|
class GatewayTimeoutException < APIException; end
|
25
|
+
class LockedException < APIException; end
|
25
26
|
class ValidationException < APIException
|
26
27
|
def errors
|
27
28
|
self[:errors]
|
@@ -247,6 +248,7 @@ module Shelly
|
|
247
248
|
when 409; ConflictException
|
248
249
|
when 412; GemVersionException
|
249
250
|
when 422; ValidationException
|
251
|
+
when 423; LockedException
|
250
252
|
when 504; GatewayTimeoutException
|
251
253
|
else; APIException
|
252
254
|
end
|
data/lib/shelly/version.rb
CHANGED
@@ -702,6 +702,14 @@ We have been notified about it. We will be adding new resources shortly")
|
|
702
702
|
lambda { invoke(@main, :start) }.should raise_error(SystemExit)
|
703
703
|
end
|
704
704
|
|
705
|
+
it "should show message about blocked deploy" do
|
706
|
+
exception = Shelly::Client::LockedException.new("message" => "reason of block")
|
707
|
+
@client.should_receive(:start_cloud).with("foo-production").and_raise(exception)
|
708
|
+
$stdout.should_receive(:puts).with(red "Deployment is currently blocked:")
|
709
|
+
$stdout.should_receive(:puts).with(red "reason of block")
|
710
|
+
lambda { invoke(@main, :start) }.should raise_error(SystemExit)
|
711
|
+
end
|
712
|
+
|
705
713
|
def raise_conflict(options = {})
|
706
714
|
body = {"state" => "no_code"}.merge(options)
|
707
715
|
exception = Shelly::Client::ConflictException.new(body)
|
@@ -1202,6 +1210,18 @@ We have been notified about it. We will be adding new resources shortly")
|
|
1202
1210
|
end
|
1203
1211
|
end
|
1204
1212
|
|
1213
|
+
context "when deployment is blocked" do
|
1214
|
+
it "should display reason of the block" do
|
1215
|
+
exception = Shelly::Client::LockedException.new("message" => "reason of block")
|
1216
|
+
@client.should_receive(:redeploy).with("foo-production").and_raise(exception)
|
1217
|
+
$stdout.should_receive(:puts).with(red "Deployment is currently blocked:")
|
1218
|
+
$stdout.should_receive(:puts).with(red "reason of block")
|
1219
|
+
lambda {
|
1220
|
+
invoke(@main, :redeploy)
|
1221
|
+
}.should raise_error(SystemExit)
|
1222
|
+
end
|
1223
|
+
end
|
1224
|
+
|
1205
1225
|
it "should re-raise exception on unknown state" do
|
1206
1226
|
exception = Shelly::Client::ConflictException.new("state" => "doing_something")
|
1207
1227
|
@client.should_receive(:redeploy).with("foo-production").and_raise(exception)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shelly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.33
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -345,7 +345,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
345
345
|
version: '0'
|
346
346
|
segments:
|
347
347
|
- 0
|
348
|
-
hash:
|
348
|
+
hash: 3939130509060040795
|
349
349
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
350
350
|
none: false
|
351
351
|
requirements:
|
@@ -354,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
354
354
|
version: '0'
|
355
355
|
segments:
|
356
356
|
- 0
|
357
|
-
hash:
|
357
|
+
hash: 3939130509060040795
|
358
358
|
requirements: []
|
359
359
|
rubyforge_project: shelly
|
360
360
|
rubygems_version: 1.8.24
|