shelly 0.0.55.pre → 0.0.55
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/shelly/app.rb +8 -0
- data/lib/shelly/cli/main.rb +63 -21
- data/lib/shelly/helpers.rb +8 -0
- data/lib/shelly/templates/Cloudfile.erb +1 -1
- data/lib/shelly/version.rb +1 -1
- data/spec/shelly/app_spec.rb +16 -1
- data/spec/shelly/cli/main_spec.rb +123 -21
- metadata +154 -167
data/lib/shelly/app.rb
CHANGED
@@ -25,6 +25,14 @@ module Shelly
|
|
25
25
|
IO.popen("git remote").read.include?(code_name)
|
26
26
|
end
|
27
27
|
|
28
|
+
def git_fetch_remote
|
29
|
+
system("git fetch #{code_name} > /dev/null 2>&1")
|
30
|
+
end
|
31
|
+
|
32
|
+
def git_add_tracking_branch
|
33
|
+
system("git checkout -b #{code_name} --track #{code_name}/master > /dev/null 2>&1")
|
34
|
+
end
|
35
|
+
|
28
36
|
def remove_git_remote
|
29
37
|
system("git remote rm #{code_name} > /dev/null 2>&1")
|
30
38
|
end
|
data/lib/shelly/cli/main.rb
CHANGED
@@ -16,9 +16,9 @@ module Shelly
|
|
16
16
|
check_unknown_options!(:except => :rake)
|
17
17
|
|
18
18
|
# FIXME: it should be possible to pass single symbol, instead of one element array
|
19
|
-
before_hook :logged_in?, :only => [:add, :status, :list, :start, :stop, :logs, :delete, :ip, :logout, :execute, :rake]
|
20
|
-
before_hook :inside_git_repository?, :only => [:add]
|
21
|
-
before_hook :cloudfile_present?, :only => [:logs, :stop, :start, :ip, :execute, :rake]
|
19
|
+
before_hook :logged_in?, :only => [:add, :status, :list, :start, :stop, :logs, :delete, :ip, :logout, :execute, :rake, :setup]
|
20
|
+
before_hook :inside_git_repository?, :only => [:add, :setup]
|
21
|
+
before_hook :cloudfile_present?, :only => [:logs, :stop, :start, :ip, :execute, :rake, :setup]
|
22
22
|
|
23
23
|
map %w(-v --version) => :version
|
24
24
|
desc "version", "Display shelly version"
|
@@ -32,6 +32,7 @@ module Shelly
|
|
32
32
|
say "Registering with email: #{email}" if email
|
33
33
|
user.email = (email || ask_for_email)
|
34
34
|
user.password = ask_for_password
|
35
|
+
ask_for_acceptance_of_terms
|
35
36
|
user.register
|
36
37
|
if user.ssh_key_exists?
|
37
38
|
say "Uploading your public SSH key from #{user.ssh_key_path}"
|
@@ -81,8 +82,7 @@ module Shelly
|
|
81
82
|
@app.databases = options["databases"] || ask_for_databases
|
82
83
|
@app.create
|
83
84
|
|
84
|
-
|
85
|
-
if !git_remote or (git_remote and yes?("Git remote #{@app} exists, overwrite (yes/no): "))
|
85
|
+
if overwrite_remote?(@app)
|
86
86
|
say "Adding remote #{@app} #{@app.git_url}", :green
|
87
87
|
@app.add_git_remote
|
88
88
|
else
|
@@ -117,10 +117,14 @@ module Shelly
|
|
117
117
|
apps = user.apps
|
118
118
|
unless apps.empty?
|
119
119
|
say "You have following clouds available:", :green
|
120
|
-
|
121
|
-
state = app["state"]
|
122
|
-
|
123
|
-
|
120
|
+
apps_table = apps.map do |app|
|
121
|
+
state = app["state"]
|
122
|
+
msg = if state == "deploy_failed" || state == "configuration_failed"
|
123
|
+
" (deployment log: `shelly deploys show last -c #{app["code_name"]}`)"
|
124
|
+
end
|
125
|
+
[app["code_name"], "| #{state.gsub("_", " ")}#{msg}"]
|
126
|
+
end
|
127
|
+
print_table(apps_table, :ident => 2)
|
124
128
|
else
|
125
129
|
say "You have no clouds yet", :green
|
126
130
|
end
|
@@ -150,30 +154,30 @@ module Shelly
|
|
150
154
|
multiple_clouds(options[:cloud], "start")
|
151
155
|
@app.start
|
152
156
|
say "Starting cloud #{@app}.", :green
|
157
|
+
say "This can take up to 10 minutes."
|
153
158
|
say "Check status with: `shelly list`"
|
154
159
|
rescue Client::ConflictException => e
|
155
160
|
case e[:state]
|
156
161
|
when "running"
|
157
|
-
say_error "Not starting: cloud '#{@app}' is already running"
|
162
|
+
say_error "Not starting: cloud '#{@app}' is already running"
|
158
163
|
when "deploying", "configuring"
|
159
|
-
say_error "Not starting: cloud '#{@app}' is currently deploying"
|
164
|
+
say_error "Not starting: cloud '#{@app}' is currently deploying"
|
160
165
|
when "no_code"
|
161
166
|
say_error "Not starting: no source code provided", :with_exit => false
|
162
167
|
say_error "Push source code using:", :with_exit => false
|
163
|
-
|
168
|
+
say " git push production master"
|
164
169
|
when "deploy_failed", "configuration_failed"
|
165
170
|
say_error "Not starting: deployment failed", :with_exit => false
|
166
171
|
say_error "Support has been notified", :with_exit => false
|
167
|
-
say_error "Check `shelly deploys show last --cloud #{@app}` for reasons of failure"
|
172
|
+
say_error "Check `shelly deploys show last --cloud #{@app}` for reasons of failure"
|
168
173
|
when "not_enough_resources"
|
169
174
|
say_error %{Sorry, There are no resources for your servers.
|
170
|
-
We have been notified about it. We will be adding new resources shortly}
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
say_error "
|
176
|
-
say_error url
|
175
|
+
We have been notified about it. We will be adding new resources shortly}
|
176
|
+
when "no_billing"
|
177
|
+
say_error "Please fill in billing details to start #{@app}.", :with_exit => false
|
178
|
+
say_error "Visit: #{@app.edit_billing_url}", :with_exit => false
|
179
|
+
when "payment_declined"
|
180
|
+
say_error "Not starting. Invoice for cloud '#{@app}' was declined."
|
177
181
|
end
|
178
182
|
exit 1
|
179
183
|
rescue Client::NotFoundException => e
|
@@ -181,6 +185,39 @@ We have been notified about it. We will be adding new resources shortly}, :with_
|
|
181
185
|
say_error "You have no access to '#{@app}' cloud defined in Cloudfile"
|
182
186
|
end
|
183
187
|
|
188
|
+
desc "setup", "Set up clouds"
|
189
|
+
def setup
|
190
|
+
say "Investigating Cloudfile"
|
191
|
+
cloudfile = Cloudfile.new
|
192
|
+
cloudfile.clouds.each do |cloud|
|
193
|
+
begin
|
194
|
+
app = App.new(cloud)
|
195
|
+
say "Adding #{app} cloud", :green
|
196
|
+
app.git_url = app.attributes["git_info"]["repository_url"]
|
197
|
+
if overwrite_remote?(app)
|
198
|
+
say "git remote add #{app} #{app.git_url}"
|
199
|
+
app.add_git_remote
|
200
|
+
say "git fetch production"
|
201
|
+
app.git_fetch_remote
|
202
|
+
say "git checkout -b #{app} --track #{app}/master"
|
203
|
+
app.git_add_tracking_branch
|
204
|
+
else
|
205
|
+
say "You have to manually add remote:"
|
206
|
+
say "`git remote add #{app} #{app.git_url}`"
|
207
|
+
say "`git fetch production`"
|
208
|
+
say "`git checkout -b #{app} --track #{app}/master`"
|
209
|
+
end
|
210
|
+
|
211
|
+
say_new_line
|
212
|
+
rescue Client::NotFoundException => e
|
213
|
+
raise unless e.resource == :cloud
|
214
|
+
say_error "You have no access to '#{app}' cloud defined in Cloudfile"
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
say "Your application is set up.", :green
|
219
|
+
end
|
220
|
+
|
184
221
|
desc "stop", "Stop the cloud"
|
185
222
|
method_option :cloud, :type => :string, :aliases => "-c", :desc => "Specify cloud"
|
186
223
|
def stop
|
@@ -286,7 +323,7 @@ We have been notified about it. We will be adding new resources shortly}, :with_
|
|
286
323
|
case e[:state]
|
287
324
|
when "deploying", "configuring"
|
288
325
|
say_error "Your application is being redeployed at the moment"
|
289
|
-
when "no_code", "turned_off"
|
326
|
+
when "no_code", "no_billing", "turned_off"
|
290
327
|
say_error "Cloud #{@app} is not running", :with_exit => false
|
291
328
|
say "Start your cloud with `shelly start --cloud #{@app}`"
|
292
329
|
exit 1
|
@@ -331,6 +368,11 @@ We have been notified about it. We will be adding new resources shortly}, :with_
|
|
331
368
|
databases.all? { |kind| kinds.include?(kind) }
|
332
369
|
end
|
333
370
|
|
371
|
+
def overwrite_remote?(app)
|
372
|
+
git_remote = app.git_remote_exist?
|
373
|
+
!git_remote or (git_remote and yes?("Git remote #{app} exists, overwrite (yes/no): "))
|
374
|
+
end
|
375
|
+
|
334
376
|
def ask_for_password(options = {})
|
335
377
|
options = {:with_confirmation => true}.merge(options)
|
336
378
|
loop do
|
data/lib/shelly/helpers.rb
CHANGED
@@ -45,6 +45,14 @@ module Shelly
|
|
45
45
|
exit 1 unless delete_application == "yes"
|
46
46
|
end
|
47
47
|
|
48
|
+
def ask_for_acceptance_of_terms
|
49
|
+
acceptance_question = "Do you accept the Terms of Service of Shelly Cloud (https://shellycloud.com/terms_of_service) (yes/no)"
|
50
|
+
acceptance = ask(acceptance_question)
|
51
|
+
unless acceptance == "yes"
|
52
|
+
say_error "You must accept the Terms of Service to use Shelly Cloud"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
48
56
|
def inside_git_repository?
|
49
57
|
say_error "Must be run inside your project git repository" unless App.inside_git_repository?
|
50
58
|
end
|
data/lib/shelly/version.rb
CHANGED
data/spec/shelly/app_spec.rb
CHANGED
@@ -67,6 +67,21 @@ describe Shelly::App do
|
|
67
67
|
end
|
68
68
|
end
|
69
69
|
|
70
|
+
describe "git_fetch_remote" do
|
71
|
+
it "should try to remove existing git remote" do
|
72
|
+
@app.should_receive(:system).with("git fetch foo-staging > /dev/null 2>&1")
|
73
|
+
@app.git_fetch_remote
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe "git_add_tracking_branch" do
|
78
|
+
it "should try to remove existing git remote" do
|
79
|
+
@app.should_receive(:system).with("git checkout -b foo-staging --track foo-staging/master > /dev/null 2>&1")
|
80
|
+
@app.git_add_tracking_branch
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
|
70
85
|
describe "git_remote_exist" do
|
71
86
|
it "should return true if git remote exist" do
|
72
87
|
io = mock(:read => "origin\nfoo-staging")
|
@@ -150,7 +165,7 @@ describe Shelly::App do
|
|
150
165
|
FakeFS.deactivate!
|
151
166
|
expected = <<-config
|
152
167
|
foo-staging:
|
153
|
-
ruby_version: 1.9.
|
168
|
+
ruby_version: 1.9.3 # 1.9.3, 1.9.2 or ree-1.8.7
|
154
169
|
environment: production # RAILS_ENV
|
155
170
|
monitoring_email: bob@example.com
|
156
171
|
domains:
|
@@ -39,6 +39,7 @@ Tasks:
|
|
39
39
|
shelly rake TASK # Run rake task
|
40
40
|
shelly redeploy # Redeploy application
|
41
41
|
shelly register [EMAIL] # Register new account
|
42
|
+
shelly setup # Set up clouds
|
42
43
|
shelly start # Start the cloud
|
43
44
|
shelly stop # Stop the cloud
|
44
45
|
shelly user <command> # Manage collaborators
|
@@ -83,7 +84,7 @@ OUT
|
|
83
84
|
File.exists?(@key_path).should be_false
|
84
85
|
$stdout.should_receive(:puts).with(red "No such file or directory - #{@key_path}")
|
85
86
|
$stdout.should_receive(:puts).with(red "Use ssh-keygen to generate ssh key pair, after that use: `shelly login`")
|
86
|
-
fake_stdin(["better@example.com", "secret", "secret"]) do
|
87
|
+
fake_stdin(["better@example.com", "secret", "secret", "yes"]) do
|
87
88
|
invoke(@main, :register)
|
88
89
|
end
|
89
90
|
end
|
@@ -92,7 +93,7 @@ OUT
|
|
92
93
|
$stdout.should_receive(:print).with("Email: ")
|
93
94
|
$stdout.should_receive(:print).with("Password: ")
|
94
95
|
$stdout.should_receive(:print).with("Password confirmation: ")
|
95
|
-
fake_stdin(["better@example.com", "secret", "secret"]) do
|
96
|
+
fake_stdin(["better@example.com", "secret", "secret", "yes"]) do
|
96
97
|
invoke(@main, :register)
|
97
98
|
end
|
98
99
|
end
|
@@ -101,21 +102,21 @@ OUT
|
|
101
102
|
Shelly::User.stub(:guess_email).and_return("kate@example.com")
|
102
103
|
$stdout.should_receive(:print).with("Email (kate@example.com - default): ")
|
103
104
|
@client.should_receive(:register_user).with("kate@example.com", "secret", "ssh-key AAbbcc")
|
104
|
-
fake_stdin(["", "secret", "secret"]) do
|
105
|
+
fake_stdin(["", "secret", "secret", "yes"]) do
|
105
106
|
invoke(@main, :register)
|
106
107
|
end
|
107
108
|
end
|
108
109
|
|
109
110
|
it "should use email provided by user" do
|
110
111
|
@client.should_receive(:register_user).with("better@example.com", "secret", "ssh-key AAbbcc")
|
111
|
-
fake_stdin(["better@example.com", "secret", "secret"]) do
|
112
|
+
fake_stdin(["better@example.com", "secret", "secret", "yes"]) do
|
112
113
|
invoke(@main, :register)
|
113
114
|
end
|
114
115
|
end
|
115
116
|
|
116
117
|
it "should not ask about email if it's provided as argument" do
|
117
118
|
$stdout.should_receive(:puts).with("Registering with email: kate@example.com")
|
118
|
-
fake_stdin(["secret", "secret"]) do
|
119
|
+
fake_stdin(["secret", "secret", "yes"]) do
|
119
120
|
invoke(@main, :register, "kate@example.com")
|
120
121
|
end
|
121
122
|
end
|
@@ -125,7 +126,7 @@ OUT
|
|
125
126
|
Shelly::User.stub(:guess_email).and_return("")
|
126
127
|
$stdout.should_receive(:puts).with("\e[31mEmail can't be blank, please try again\e[0m")
|
127
128
|
lambda {
|
128
|
-
fake_stdin(["", "bob@example.com", "only-pass", "only-pass"]) do
|
129
|
+
fake_stdin(["", "bob@example.com", "only-pass", "only-pass", "yes"]) do
|
129
130
|
invoke(@main, :register)
|
130
131
|
end
|
131
132
|
}.should raise_error(SystemExit)
|
@@ -137,7 +138,7 @@ OUT
|
|
137
138
|
FileUtils.mkdir_p("~/.ssh")
|
138
139
|
File.open(@key_path, "w") { |f| f << "key" }
|
139
140
|
$stdout.should_receive(:puts).with("Uploading your public SSH key from #{@key_path}")
|
140
|
-
fake_stdin(["kate@example.com", "secret", "secret"]) do
|
141
|
+
fake_stdin(["kate@example.com", "secret", "secret", "yes"]) do
|
141
142
|
invoke(@main, :register)
|
142
143
|
end
|
143
144
|
end
|
@@ -148,7 +149,7 @@ OUT
|
|
148
149
|
@user.stub(:ssh_key_registered?)
|
149
150
|
FileUtils.rm_rf(@key_path)
|
150
151
|
$stdout.should_not_receive(:puts).with("Uploading your public SSH key from #{@key_path}")
|
151
|
-
fake_stdin(["kate@example.com", "secret", "secret"]) do
|
152
|
+
fake_stdin(["kate@example.com", "secret", "secret", "yes"]) do
|
152
153
|
invoke(@main, :register)
|
153
154
|
end
|
154
155
|
end
|
@@ -159,7 +160,7 @@ OUT
|
|
159
160
|
@client.stub(:register_user).and_return(true)
|
160
161
|
$stdout.should_receive(:puts).with("Successfully registered!")
|
161
162
|
$stdout.should_receive(:puts).with("Check you mailbox for email address confirmation")
|
162
|
-
fake_stdin(["kate@example.com", "pass", "pass"]) do
|
163
|
+
fake_stdin(["kate@example.com", "pass", "pass", "yes"]) do
|
163
164
|
invoke(@main, :register)
|
164
165
|
end
|
165
166
|
end
|
@@ -172,7 +173,18 @@ OUT
|
|
172
173
|
@client.stub(:register_user).and_raise(exception)
|
173
174
|
$stdout.should_receive(:puts).with("\e[31mEmail has been already taken\e[0m")
|
174
175
|
lambda {
|
175
|
-
fake_stdin(["kate@example.com", "pass", "pass"]) do
|
176
|
+
fake_stdin(["kate@example.com", "pass", "pass", "yes"]) do
|
177
|
+
invoke(@main, :register)
|
178
|
+
end
|
179
|
+
}.should raise_error(SystemExit)
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
context "on rejected Terms of Service" do
|
184
|
+
it "should display error and exit with 1" do
|
185
|
+
$stdout.should_receive(:puts).with("\e[31mYou must accept the Terms of Service to use Shelly Cloud\e[0m")
|
186
|
+
lambda {
|
187
|
+
fake_stdin(["kate@example.com", "pass", "pass", "no"]) do
|
176
188
|
invoke(@main, :register)
|
177
189
|
end
|
178
190
|
}.should raise_error(SystemExit)
|
@@ -494,8 +506,11 @@ OUT
|
|
494
506
|
before do
|
495
507
|
@user = Shelly::User.new
|
496
508
|
@client.stub(:token).and_return("abc")
|
497
|
-
@client.stub(:apps).and_return([
|
498
|
-
|
509
|
+
@client.stub(:apps).and_return([
|
510
|
+
{"code_name" => "abc", "state" => "running"},
|
511
|
+
{"code_name" => "fooo", "state" => "deploy_failed"},
|
512
|
+
{"code_name" => "bar", "state" => "configuration_failed"}
|
513
|
+
])
|
499
514
|
Shelly::User.stub(:new).and_return(@user)
|
500
515
|
end
|
501
516
|
|
@@ -506,7 +521,8 @@ OUT
|
|
506
521
|
it "should display user's clouds" do
|
507
522
|
$stdout.should_receive(:puts).with("\e[32mYou have following clouds available:\e[0m")
|
508
523
|
$stdout.should_receive(:puts).with(/abc\s+\| running/)
|
509
|
-
$stdout.should_receive(:puts).with(/fooo\s+\| deploy failed \(
|
524
|
+
$stdout.should_receive(:puts).with(/fooo\s+\| deploy failed \(deployment log: `shelly deploys show last -c fooo`\)/)
|
525
|
+
$stdout.should_receive(:puts).with(/bar\s+\| configuration failed \(deployment log: `shelly deploys show last -c bar`\)/)
|
510
526
|
invoke(@main, :list)
|
511
527
|
end
|
512
528
|
|
@@ -566,6 +582,7 @@ OUT
|
|
566
582
|
it "should start the cloud" do
|
567
583
|
@client.stub(:start_cloud)
|
568
584
|
$stdout.should_receive(:puts).with(green "Starting cloud foo-production.")
|
585
|
+
$stdout.should_receive(:puts).with("This can take up to 10 minutes.")
|
569
586
|
$stdout.should_receive(:puts).with("Check status with: `shelly list`")
|
570
587
|
invoke(@main, :start)
|
571
588
|
end
|
@@ -613,7 +630,7 @@ OUT
|
|
613
630
|
raise_conflict("state" => "no_code")
|
614
631
|
$stdout.should_receive(:puts).with(red "Not starting: no source code provided")
|
615
632
|
$stdout.should_receive(:puts).with(red "Push source code using:")
|
616
|
-
$stdout.should_receive(:puts).with(
|
633
|
+
$stdout.should_receive(:puts).with(" git push production master")
|
617
634
|
lambda { invoke(@main, :start) }.should raise_error(SystemExit)
|
618
635
|
end
|
619
636
|
|
@@ -635,17 +652,23 @@ We have been notified about it. We will be adding new resources shortly")
|
|
635
652
|
lambda { invoke(@main, :start) }.should raise_error(SystemExit)
|
636
653
|
end
|
637
654
|
|
638
|
-
it "should show
|
655
|
+
it "should show messages about billing" do
|
656
|
+
raise_conflict("state" => "no_billing")
|
657
|
+
@app.stub(:edit_billing_url).and_return("http://example.com/billing/edit")
|
658
|
+
$stdout.should_receive(:puts).with(red "Please fill in billing details to start foo-production.")
|
659
|
+
$stdout.should_receive(:puts).with(red "Visit: http://example.com/billing/edit")
|
639
660
|
@client.stub(:shellyapp_url).and_return("http://example.com")
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
661
|
+
lambda { invoke(@main, :start) }.should raise_error(SystemExit)
|
662
|
+
end
|
663
|
+
|
664
|
+
it "should show messge about payment declined" do
|
665
|
+
raise_conflict("state" => "payment_declined")
|
666
|
+
$stdout.should_receive(:puts).with(red "Not starting. Invoice for cloud 'foo-production' was declined.")
|
644
667
|
lambda { invoke(@main, :start) }.should raise_error(SystemExit)
|
645
668
|
end
|
646
669
|
|
647
670
|
def raise_conflict(options = {})
|
648
|
-
body = {"state" => "no_code"
|
671
|
+
body = {"state" => "no_code"}.merge(options)
|
649
672
|
exception = Shelly::Client::ConflictException.new(body)
|
650
673
|
@client.stub(:start_cloud).and_raise(exception)
|
651
674
|
end
|
@@ -748,6 +771,85 @@ We have been notified about it. We will be adding new resources shortly")
|
|
748
771
|
end
|
749
772
|
end
|
750
773
|
|
774
|
+
describe "#setup" do
|
775
|
+
before do
|
776
|
+
Shelly::App.stub(:inside_git_repository?).and_return(true)
|
777
|
+
@client.stub(:token).and_return("abc")
|
778
|
+
@client.stub(:app).and_return("git_info" => {"repository_url" => "git_url"})
|
779
|
+
@app = Shelly::App.new("foo-staging")
|
780
|
+
@app.stub(:git_remote_exist?).and_return(false)
|
781
|
+
@app.stub(:system)
|
782
|
+
Shelly::App.stub(:new).and_return(@app)
|
783
|
+
File.open("Cloudfile", 'w') {|f| f.write("foo-staging:\n") }
|
784
|
+
end
|
785
|
+
|
786
|
+
it "should ensure user has logged in" do
|
787
|
+
hooks(@main, :setup).should include(:logged_in?)
|
788
|
+
end
|
789
|
+
|
790
|
+
it "should ensure that user is inside git repo" do
|
791
|
+
hooks(@main, :setup).should include(:inside_git_repository?)
|
792
|
+
end
|
793
|
+
|
794
|
+
it "should ensure that cloudfile is present" do
|
795
|
+
hooks(@main, :setup).should include(:cloudfile_present?)
|
796
|
+
end
|
797
|
+
|
798
|
+
it "should show info about adding remote and branch" do
|
799
|
+
$stdout.should_receive(:puts).with("Investigating Cloudfile")
|
800
|
+
$stdout.should_receive(:puts).with(green "Adding foo-staging cloud")
|
801
|
+
$stdout.should_receive(:puts).with("git remote add foo-staging git_url")
|
802
|
+
$stdout.should_receive(:puts).with("git fetch production")
|
803
|
+
$stdout.should_receive(:puts).with("git checkout -b foo-staging --track foo-staging/master")
|
804
|
+
$stdout.should_receive(:puts).with(green "Your application is set up.")
|
805
|
+
invoke(@main, :setup)
|
806
|
+
end
|
807
|
+
|
808
|
+
it "should add git remote" do
|
809
|
+
@app.should_receive(:add_git_remote)
|
810
|
+
invoke(@main, :setup)
|
811
|
+
end
|
812
|
+
|
813
|
+
it "should fetch remote" do
|
814
|
+
@app.should_receive(:git_fetch_remote)
|
815
|
+
invoke(@main, :setup)
|
816
|
+
end
|
817
|
+
|
818
|
+
it "should add tracking branch" do
|
819
|
+
@app.should_receive(:git_add_tracking_branch)
|
820
|
+
invoke(@main, :setup)
|
821
|
+
end
|
822
|
+
|
823
|
+
context "when remote exists" do
|
824
|
+
before do
|
825
|
+
@app.stub(:git_remote_exist?).and_return(true)
|
826
|
+
end
|
827
|
+
|
828
|
+
context "and user answers yes" do
|
829
|
+
it "should overwrite remote" do
|
830
|
+
@app.should_receive(:add_git_remote)
|
831
|
+
@app.should_receive(:git_fetch_remote)
|
832
|
+
@app.should_receive(:git_add_tracking_branch)
|
833
|
+
fake_stdin(["yes"]) do
|
834
|
+
invoke(@main, :setup)
|
835
|
+
end
|
836
|
+
end
|
837
|
+
end
|
838
|
+
|
839
|
+
context "and user answers no" do
|
840
|
+
it "should display commands to perform manually " do
|
841
|
+
@app.should_not_receive(:add_git_remote)
|
842
|
+
@app.should_not_receive(:git_fetch_remote)
|
843
|
+
@app.should_not_receive(:git_add_tracking_branch)
|
844
|
+
fake_stdin(["no"]) do
|
845
|
+
invoke(@main, :setup)
|
846
|
+
end
|
847
|
+
end
|
848
|
+
end
|
849
|
+
|
850
|
+
end
|
851
|
+
end
|
852
|
+
|
751
853
|
describe "#delete" do
|
752
854
|
before do
|
753
855
|
Shelly::App.stub(:inside_git_repository?).and_return(true)
|
@@ -1172,7 +1274,7 @@ We have been notified about it. We will be adding new resources shortly")
|
|
1172
1274
|
end
|
1173
1275
|
end
|
1174
1276
|
|
1175
|
-
%w(no_code turned_off).each do |state|
|
1277
|
+
%w(no_code no_billing turned_off).each do |state|
|
1176
1278
|
context "when application is in #{state} state" do
|
1177
1279
|
it "should display error that cloud is not running" do
|
1178
1280
|
exception = Shelly::Client::ConflictException.new("state" => state)
|
metadata
CHANGED
@@ -1,191 +1,167 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: shelly
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 55
|
10
|
-
- pre
|
11
|
-
version: 0.0.55.pre
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.55
|
5
|
+
prerelease:
|
12
6
|
platform: ruby
|
13
|
-
authors:
|
7
|
+
authors:
|
14
8
|
- Shelly Cloud team
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
date: 2012-03-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &70362431758420 !ruby/object:Gem::Requirement
|
23
17
|
none: false
|
24
|
-
requirements:
|
18
|
+
requirements:
|
25
19
|
- - ~>
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
hash: 47
|
28
|
-
segments:
|
29
|
-
- 2
|
30
|
-
- 8
|
31
|
-
- 0
|
20
|
+
- !ruby/object:Gem::Version
|
32
21
|
version: 2.8.0
|
33
|
-
requirement: *id001
|
34
|
-
prerelease: false
|
35
22
|
type: :development
|
36
|
-
name: rspec
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 3
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
47
|
-
requirement: *id002
|
48
23
|
prerelease: false
|
49
|
-
|
24
|
+
version_requirements: *70362431758420
|
25
|
+
- !ruby/object:Gem::Dependency
|
50
26
|
name: rake
|
51
|
-
|
52
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
27
|
+
requirement: &70362431757980 !ruby/object:Gem::Requirement
|
53
28
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
61
|
-
requirement: *id003
|
62
|
-
prerelease: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
63
33
|
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70362431757980
|
36
|
+
- !ruby/object:Gem::Dependency
|
64
37
|
name: guard
|
65
|
-
|
66
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
38
|
+
requirement: &70362431757520 !ruby/object:Gem::Requirement
|
67
39
|
none: false
|
68
|
-
requirements:
|
69
|
-
- -
|
70
|
-
- !ruby/object:Gem::Version
|
71
|
-
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
version: "0"
|
75
|
-
requirement: *id004
|
76
|
-
prerelease: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
77
44
|
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70362431757520
|
47
|
+
- !ruby/object:Gem::Dependency
|
78
48
|
name: guard-rspec
|
79
|
-
|
80
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
49
|
+
requirement: &70362431757100 !ruby/object:Gem::Requirement
|
81
50
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
|
86
|
-
segments:
|
87
|
-
- 0
|
88
|
-
version: "0"
|
89
|
-
requirement: *id005
|
90
|
-
prerelease: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
91
55
|
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70362431757100
|
58
|
+
- !ruby/object:Gem::Dependency
|
92
59
|
name: simplecov
|
93
|
-
|
94
|
-
|
60
|
+
requirement: &70362431756680 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70362431756680
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ruby_gntp
|
71
|
+
requirement: &70362431756220 !ruby/object:Gem::Requirement
|
95
72
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
|
100
|
-
|
101
|
-
- 0
|
102
|
-
version: "0"
|
103
|
-
requirement: *id006
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
104
78
|
prerelease: false
|
79
|
+
version_requirements: *70362431756220
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rb-fsevent
|
82
|
+
requirement: &70362431755800 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
105
88
|
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70362431755800
|
91
|
+
- !ruby/object:Gem::Dependency
|
106
92
|
name: fakefs
|
107
|
-
|
108
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
93
|
+
requirement: &70362431755380 !ruby/object:Gem::Requirement
|
109
94
|
none: false
|
110
|
-
requirements:
|
111
|
-
- -
|
112
|
-
- !ruby/object:Gem::Version
|
113
|
-
|
114
|
-
segments:
|
115
|
-
- 0
|
116
|
-
version: "0"
|
117
|
-
requirement: *id007
|
118
|
-
prerelease: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
119
99
|
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70362431755380
|
102
|
+
- !ruby/object:Gem::Dependency
|
120
103
|
name: fakeweb
|
121
|
-
|
122
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
104
|
+
requirement: &70362431754960 !ruby/object:Gem::Requirement
|
123
105
|
none: false
|
124
|
-
requirements:
|
125
|
-
- -
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
|
128
|
-
|
129
|
-
- 0
|
130
|
-
- 14
|
131
|
-
- 7
|
132
|
-
version: 0.14.7
|
133
|
-
requirement: *id008
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
134
111
|
prerelease: false
|
135
|
-
|
112
|
+
version_requirements: *70362431754960
|
113
|
+
- !ruby/object:Gem::Dependency
|
136
114
|
name: wijet-thor
|
137
|
-
|
138
|
-
version_requirements: &id009 !ruby/object:Gem::Requirement
|
115
|
+
requirement: &70362431754460 !ruby/object:Gem::Requirement
|
139
116
|
none: false
|
140
|
-
requirements:
|
141
|
-
- -
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
|
144
|
-
segments:
|
145
|
-
- 0
|
146
|
-
version: "0"
|
147
|
-
requirement: *id009
|
148
|
-
prerelease: false
|
117
|
+
requirements:
|
118
|
+
- - ~>
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 0.14.7
|
149
121
|
type: :runtime
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70362431754460
|
124
|
+
- !ruby/object:Gem::Dependency
|
150
125
|
name: rest-client
|
151
|
-
|
152
|
-
version_requirements: &id010 !ruby/object:Gem::Requirement
|
126
|
+
requirement: &70362431754040 !ruby/object:Gem::Requirement
|
153
127
|
none: false
|
154
|
-
requirements:
|
155
|
-
- -
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
version: "0"
|
161
|
-
requirement: *id010
|
162
|
-
prerelease: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
163
132
|
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *70362431754040
|
135
|
+
- !ruby/object:Gem::Dependency
|
164
136
|
name: json
|
165
|
-
|
166
|
-
version_requirements: &id011 !ruby/object:Gem::Requirement
|
137
|
+
requirement: &70362431753580 !ruby/object:Gem::Requirement
|
167
138
|
none: false
|
168
|
-
requirements:
|
169
|
-
- -
|
170
|
-
- !ruby/object:Gem::Version
|
171
|
-
|
172
|
-
segments:
|
173
|
-
- 0
|
174
|
-
version: "0"
|
175
|
-
requirement: *id011
|
176
|
-
prerelease: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
177
143
|
type: :runtime
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *70362431753580
|
146
|
+
- !ruby/object:Gem::Dependency
|
178
147
|
name: progressbar
|
148
|
+
requirement: &70362431753160 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
type: :runtime
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: *70362431753160
|
179
157
|
description: Tool for managing applications and clouds at shellycloud.com
|
180
|
-
email:
|
158
|
+
email:
|
181
159
|
- support@shellycloud.com
|
182
|
-
executables:
|
160
|
+
executables:
|
183
161
|
- shelly
|
184
162
|
extensions: []
|
185
|
-
|
186
163
|
extra_rdoc_files: []
|
187
|
-
|
188
|
-
files:
|
164
|
+
files:
|
189
165
|
- .gitignore
|
190
166
|
- .travis.yml
|
191
167
|
- Gemfile
|
@@ -237,38 +213,49 @@ files:
|
|
237
213
|
- spec/thor/options_spec.rb
|
238
214
|
homepage: http://shellycloud.com
|
239
215
|
licenses: []
|
240
|
-
|
241
216
|
post_install_message:
|
242
217
|
rdoc_options: []
|
243
|
-
|
244
|
-
require_paths:
|
218
|
+
require_paths:
|
245
219
|
- lib
|
246
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
220
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
247
221
|
none: false
|
248
|
-
requirements:
|
249
|
-
- -
|
250
|
-
- !ruby/object:Gem::Version
|
251
|
-
|
252
|
-
segments:
|
222
|
+
requirements:
|
223
|
+
- - ! '>='
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '0'
|
226
|
+
segments:
|
253
227
|
- 0
|
254
|
-
|
255
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
|
+
hash: -3746119301699962948
|
229
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
256
230
|
none: false
|
257
|
-
requirements:
|
258
|
-
- -
|
259
|
-
- !ruby/object:Gem::Version
|
260
|
-
|
261
|
-
segments:
|
262
|
-
-
|
263
|
-
-
|
264
|
-
- 1
|
265
|
-
version: 1.3.1
|
231
|
+
requirements:
|
232
|
+
- - ! '>='
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '0'
|
235
|
+
segments:
|
236
|
+
- 0
|
237
|
+
hash: -3746119301699962948
|
266
238
|
requirements: []
|
267
|
-
|
268
239
|
rubyforge_project: shelly
|
269
|
-
rubygems_version: 1.8.
|
240
|
+
rubygems_version: 1.8.16
|
270
241
|
signing_key:
|
271
242
|
specification_version: 3
|
272
243
|
summary: Shelly Cloud command line tool
|
273
|
-
test_files:
|
274
|
-
|
244
|
+
test_files:
|
245
|
+
- spec/helpers.rb
|
246
|
+
- spec/input_faker.rb
|
247
|
+
- spec/shelly/app_spec.rb
|
248
|
+
- spec/shelly/backup_spec.rb
|
249
|
+
- spec/shelly/cli/backup_spec.rb
|
250
|
+
- spec/shelly/cli/config_spec.rb
|
251
|
+
- spec/shelly/cli/deploys_spec.rb
|
252
|
+
- spec/shelly/cli/main_spec.rb
|
253
|
+
- spec/shelly/cli/runner_spec.rb
|
254
|
+
- spec/shelly/cli/user_spec.rb
|
255
|
+
- spec/shelly/client_spec.rb
|
256
|
+
- spec/shelly/cloudfile_spec.rb
|
257
|
+
- spec/shelly/download_progress_bar_spec.rb
|
258
|
+
- spec/shelly/model_spec.rb
|
259
|
+
- spec/shelly/user_spec.rb
|
260
|
+
- spec/spec_helper.rb
|
261
|
+
- spec/thor/options_spec.rb
|