shelly 0.2.2 → 0.2.3
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/CHANGELOG.md +4 -0
- data/lib/shelly/app.rb +1 -1
- data/lib/shelly/cli/main.rb +18 -4
- data/lib/shelly/helpers.rb +0 -6
- data/lib/shelly/version.rb +1 -1
- data/spec/shelly/cli/main_spec.rb +39 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
data/lib/shelly/app.rb
CHANGED
data/lib/shelly/cli/main.rb
CHANGED
@@ -258,10 +258,24 @@ Wait until cloud is in 'turned off' state and try again.}
|
|
258
258
|
method_option :cloud, :type => :string, :aliases => "-c", :desc => "Specify cloud"
|
259
259
|
def stop
|
260
260
|
app = multiple_clouds(options[:cloud], "stop")
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
261
|
+
stop_question = "Are you sure you want to shut down '#{app}' cloud (yes/no):"
|
262
|
+
if ask(stop_question) == "yes"
|
263
|
+
app.stop
|
264
|
+
say_new_line
|
265
|
+
say "Cloud '#{app}' stopped"
|
266
|
+
end
|
267
|
+
rescue Client::ConflictException => e
|
268
|
+
case e[:state]
|
269
|
+
when "deploying"
|
270
|
+
say_error "Your cloud is currently being deployed and it can not be stopped."
|
271
|
+
when "no_code"
|
272
|
+
say_error "You need to deploy your cloud first.", :with_exit => false
|
273
|
+
say "More information can be found at:"
|
274
|
+
say "#{app.shelly.shellyapp_url}/documentation/deployment"
|
275
|
+
exit 1
|
276
|
+
when "turning_off"
|
277
|
+
say_error "Your cloud is turning off."
|
278
|
+
end
|
265
279
|
rescue Client::NotFoundException => e
|
266
280
|
raise unless e.resource == :cloud
|
267
281
|
say_error "You have no access to '#{app}' cloud defined in Cloudfile"
|
data/lib/shelly/helpers.rb
CHANGED
@@ -54,12 +54,6 @@ module Shelly
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
def ask_to_stop_application
|
58
|
-
stop_question = "Are you sure you want to shut down your application (yes/no):"
|
59
|
-
stop_application = ask(stop_question)
|
60
|
-
exit 1 unless stop_application == "yes"
|
61
|
-
end
|
62
|
-
|
63
57
|
def inside_git_repository?
|
64
58
|
unless App.inside_git_repository?
|
65
59
|
say_error %q{Current directory is not a git repository.
|
data/lib/shelly/version.rb
CHANGED
@@ -836,7 +836,7 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
836
836
|
|
837
837
|
it "should stop the cloud" do
|
838
838
|
@client.stub(:stop_cloud)
|
839
|
-
$stdout.should_receive(:print).with("Are you sure you want to shut down
|
839
|
+
$stdout.should_receive(:print).with("Are you sure you want to shut down 'foo-production' cloud (yes/no): ")
|
840
840
|
$stdout.should_receive(:puts).with("\n")
|
841
841
|
$stdout.should_receive(:puts).with("Cloud 'foo-production' stopped")
|
842
842
|
fake_stdin(["yes"]) do
|
@@ -844,6 +844,44 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
844
844
|
end
|
845
845
|
end
|
846
846
|
|
847
|
+
it "should show messages about app being deployed" do
|
848
|
+
raise_conflict("state" => "deploying")
|
849
|
+
$stdout.should_receive(:puts).with(red "Your cloud is currently being deployed and it can not be stopped.")
|
850
|
+
lambda do
|
851
|
+
fake_stdin(["yes"]) do
|
852
|
+
invoke(@main, :stop)
|
853
|
+
end
|
854
|
+
end.should raise_error(SystemExit)
|
855
|
+
end
|
856
|
+
|
857
|
+
it "should show messge about app's no_code" do
|
858
|
+
raise_conflict("state" => "no_code")
|
859
|
+
@client.stub(:shellyapp_url).and_return("https://example.com")
|
860
|
+
$stdout.should_receive(:puts).with(red "You need to deploy your cloud first.")
|
861
|
+
$stdout.should_receive(:puts).with('More information can be found at:')
|
862
|
+
$stdout.should_receive(:puts).with('https://example.com/documentation/deployment')
|
863
|
+
lambda do
|
864
|
+
fake_stdin(["yes"]) do
|
865
|
+
invoke(@main, :stop)
|
866
|
+
end
|
867
|
+
end.should raise_error(SystemExit)
|
868
|
+
end
|
869
|
+
|
870
|
+
it "should show messge about app turning off" do
|
871
|
+
raise_conflict("state" => "turning_off")
|
872
|
+
$stdout.should_receive(:puts).with(red "Your cloud is turning off.")
|
873
|
+
lambda do
|
874
|
+
fake_stdin(["yes"]) do
|
875
|
+
invoke(@main, :stop)
|
876
|
+
end
|
877
|
+
end.should raise_error(SystemExit)
|
878
|
+
end
|
879
|
+
|
880
|
+
def raise_conflict(options = {})
|
881
|
+
body = {"state" => "no_code"}.merge(options)
|
882
|
+
exception = Shelly::Client::ConflictException.new(body)
|
883
|
+
@client.stub(:stop_cloud).and_raise(exception)
|
884
|
+
end
|
847
885
|
end
|
848
886
|
|
849
887
|
describe "#info" do
|
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.2.
|
4
|
+
version: 0.2.3
|
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: 2013-02-
|
12
|
+
date: 2013-02-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -317,7 +317,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
317
317
|
version: '0'
|
318
318
|
segments:
|
319
319
|
- 0
|
320
|
-
hash: -
|
320
|
+
hash: -2582762142314582273
|
321
321
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
322
322
|
none: false
|
323
323
|
requirements:
|
@@ -326,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
326
326
|
version: '0'
|
327
327
|
segments:
|
328
328
|
- 0
|
329
|
-
hash: -
|
329
|
+
hash: -2582762142314582273
|
330
330
|
requirements: []
|
331
331
|
rubyforge_project: shelly
|
332
332
|
rubygems_version: 1.8.25
|