shelly 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/lib/shelly/cli/backup.rb +1 -2
- data/lib/shelly/cli/deploy.rb +2 -0
- data/lib/shelly/cli/main.rb +6 -6
- data/lib/shelly/cli/runner.rb +3 -0
- data/lib/shelly/version.rb +1 -1
- data/spec/shelly/cli/backup_spec.rb +1 -1
- data/spec/shelly/cli/deploy_spec.rb +1 -0
- data/spec/shelly/cli/main_spec.rb +9 -9
- data/spec/shelly/cli/runner_spec.rb +16 -0
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 0.4.5 / 2013-09-24
|
2
|
+
|
3
|
+
* [improvement] Print user-friendly message for bad .netrc file permission.
|
4
|
+
* [improvement] Added 'Running' prefix for commands executed by gem.
|
5
|
+
|
1
6
|
## 0.4.4 / 2013-09-10
|
2
7
|
|
3
8
|
* [bugfix] Do not show `shelly deploys show last` instruction if last deployment was made by admin and was failed.
|
data/lib/shelly/cli/backup.rb
CHANGED
@@ -130,7 +130,6 @@ module Shelly
|
|
130
130
|
say "Uploading done", :green
|
131
131
|
say "Importing database", :green
|
132
132
|
app.import_database(kind, archive, connection["server"])
|
133
|
-
say "Database imported successfully", :green
|
134
133
|
rescue Client::ConflictException => e
|
135
134
|
say_error "Cloud #{app} wasn't deployed properly. Cannot import database."
|
136
135
|
end
|
@@ -138,7 +137,7 @@ module Shelly
|
|
138
137
|
no_tasks do
|
139
138
|
def compress(filename)
|
140
139
|
archive_name = "#{::File.basename(filename)}-#{Time.now.to_i}.tar.bz2"
|
141
|
-
say "
|
140
|
+
say "Running: tar -cjf #{archive_name} #{filename}", :green
|
142
141
|
system("tar -cjf #{archive_name} #{filename}")
|
143
142
|
archive_name
|
144
143
|
end
|
data/lib/shelly/cli/deploy.rb
CHANGED
@@ -73,6 +73,8 @@ module Shelly
|
|
73
73
|
desc "pending", "Show commits which haven't been deployed yet"
|
74
74
|
def pending
|
75
75
|
app = multiple_clouds(options[:cloud], "deploy pending")
|
76
|
+
say "Running: git fetch shelly"
|
77
|
+
say_new_line
|
76
78
|
app.git_fetch_remote
|
77
79
|
if app.deployed?
|
78
80
|
commits = app.pending_commits
|
data/lib/shelly/cli/main.rb
CHANGED
@@ -178,9 +178,9 @@ Wait until cloud is in 'turned off' state and try again.}
|
|
178
178
|
say_new_line
|
179
179
|
app.git_url = app.attributes["git_info"]["repository_url"]
|
180
180
|
if overwrite_default_remote?(app)
|
181
|
-
say "git remote add shelly #{app.git_url}"
|
181
|
+
say "Running: git remote add shelly #{app.git_url}"
|
182
182
|
app.add_git_remote
|
183
|
-
say "git fetch shelly"
|
183
|
+
say "Running: git fetch shelly"
|
184
184
|
app.git_fetch_remote
|
185
185
|
else
|
186
186
|
loop do
|
@@ -188,9 +188,9 @@ Wait until cloud is in 'turned off' state and try again.}
|
|
188
188
|
if app.git_remote_exist?(remote)
|
189
189
|
say("Remote '#{remote}' already exists")
|
190
190
|
else
|
191
|
-
say "git remote add #{remote} #{app.git_url}"
|
191
|
+
say "Running: git remote add #{remote} #{app.git_url}"
|
192
192
|
app.add_git_remote(remote)
|
193
|
-
say "git fetch #{remote}"
|
193
|
+
say "Running: git fetch #{remote}"
|
194
194
|
app.git_fetch_remote(remote)
|
195
195
|
break
|
196
196
|
end
|
@@ -386,7 +386,7 @@ Wait until cloud is in 'turned off' state and try again.}
|
|
386
386
|
|
387
387
|
def add_remote(app)
|
388
388
|
remote = if overwrite_default_remote?(app)
|
389
|
-
say "
|
389
|
+
say "Running: git remote add shelly #{app.git_url}", :green
|
390
390
|
"shelly"
|
391
391
|
else
|
392
392
|
loop do
|
@@ -394,7 +394,7 @@ Wait until cloud is in 'turned off' state and try again.}
|
|
394
394
|
if app.git_remote_exist?(remote)
|
395
395
|
say("Remote '#{remote}' already exists")
|
396
396
|
else
|
397
|
-
say "
|
397
|
+
say "Running: git remote add #{remote} #{app.git_url}", :green
|
398
398
|
break remote
|
399
399
|
end
|
400
400
|
end
|
data/lib/shelly/cli/runner.rb
CHANGED
@@ -34,6 +34,9 @@ module Shelly
|
|
34
34
|
raise if debug?
|
35
35
|
say_new_line
|
36
36
|
say_error "[canceled]"
|
37
|
+
rescue Netrc::Error => e
|
38
|
+
raise if debug?
|
39
|
+
say_error e.message
|
37
40
|
rescue Client::APIException => e
|
38
41
|
raise if debug?
|
39
42
|
say_error "You have found a bug in the shelly gem. We're sorry.",
|
data/lib/shelly/version.rb
CHANGED
@@ -278,7 +278,7 @@ describe Shelly::CLI::Backup do
|
|
278
278
|
|
279
279
|
it "should compress file" do
|
280
280
|
@backup.should_receive(:system).with("tar -cjf dump.sql-1370879705.tar.bz2 dump.sql")
|
281
|
-
$stdout.should_receive(:puts).with(green "
|
281
|
+
$stdout.should_receive(:puts).with(green "Running: tar -cjf dump.sql-1370879705.tar.bz2 dump.sql")
|
282
282
|
fake_stdin(["yes"]) do
|
283
283
|
invoke(@backup, :import, "postgresql", "dump.sql")
|
284
284
|
end
|
@@ -132,6 +132,7 @@ describe Shelly::CLI::Deploy do
|
|
132
132
|
end
|
133
133
|
|
134
134
|
it "should fetch git references from shelly" do
|
135
|
+
$stdout.should_receive(:puts).with("Running: git fetch shelly")
|
135
136
|
@app.should_receive(:git_fetch_remote)
|
136
137
|
@app.stub(:pending_commits => "commit")
|
137
138
|
invoke(@deploys, :pending)
|
@@ -444,7 +444,7 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository\e[0m
|
|
444
444
|
|
445
445
|
context "git remote" do
|
446
446
|
it "should add one if it doesn't exist" do
|
447
|
-
$stdout.should_receive(:puts).with("
|
447
|
+
$stdout.should_receive(:puts).with(green "Running: git remote add shelly git@git.shellycloud.com:foooo.git")
|
448
448
|
@app.should_receive(:add_git_remote).with("shelly")
|
449
449
|
|
450
450
|
fake_stdin(["foooo", ""]) do
|
@@ -459,7 +459,7 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository\e[0m
|
|
459
459
|
|
460
460
|
it "should ask if one exist and overwrite" do
|
461
461
|
$stdout.should_receive(:print).with("Git remote shelly exists, overwrite (yes/no): ")
|
462
|
-
$stdout.should_receive(:puts).with(green "
|
462
|
+
$stdout.should_receive(:puts).with(green "Running: git remote add shelly git@git.shellycloud.com:foooo.git")
|
463
463
|
@app.should_receive(:add_git_remote).with("shelly")
|
464
464
|
|
465
465
|
fake_stdin(["foooo", "", "yes"]) do
|
@@ -471,7 +471,7 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository\e[0m
|
|
471
471
|
@app.stub(:git_remote_exist?).with('test').and_return(false)
|
472
472
|
$stdout.should_receive(:print).with("Git remote shelly exists, overwrite (yes/no): ")
|
473
473
|
$stdout.should_receive(:print).with("Specify remote name: ")
|
474
|
-
$stdout.should_receive(:puts).with(green "
|
474
|
+
$stdout.should_receive(:puts).with(green "Running: git remote add test git@git.shellycloud.com:foooo.git")
|
475
475
|
$stdout.should_receive(:puts).with(" git push test master")
|
476
476
|
@app.should_receive(:add_git_remote).with("test")
|
477
477
|
|
@@ -1072,8 +1072,8 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
1072
1072
|
|
1073
1073
|
it "should show info about adding remote and fetching changes" do
|
1074
1074
|
$stdout.should_receive(:puts).with(green "Setting up foo-staging cloud")
|
1075
|
-
$stdout.should_receive(:puts).with("git remote add shelly git_url")
|
1076
|
-
$stdout.should_receive(:puts).with("git fetch shelly")
|
1075
|
+
$stdout.should_receive(:puts).with("Running: git remote add shelly git_url")
|
1076
|
+
$stdout.should_receive(:puts).with("Running: git fetch shelly")
|
1077
1077
|
$stdout.should_receive(:puts).with(green "Your application is set up.")
|
1078
1078
|
invoke(@main, :setup)
|
1079
1079
|
end
|
@@ -1104,8 +1104,8 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
1104
1104
|
|
1105
1105
|
it "should show info about adding default remote and fetching changes" do
|
1106
1106
|
$stdout.should_receive(:puts).with(green "Setting up foo-staging cloud")
|
1107
|
-
$stdout.should_receive(:puts).with("git remote add shelly git_url")
|
1108
|
-
$stdout.should_receive(:puts).with("git fetch shelly")
|
1107
|
+
$stdout.should_receive(:puts).with("Running: git remote add shelly git_url")
|
1108
|
+
$stdout.should_receive(:puts).with("Running: git fetch shelly")
|
1109
1109
|
$stdout.should_receive(:puts).with(green "Your application is set up.")
|
1110
1110
|
fake_stdin(["yes"]) do
|
1111
1111
|
invoke(@main, :setup)
|
@@ -1130,8 +1130,8 @@ Wait until cloud is in 'turned off' state and try again.")
|
|
1130
1130
|
it "should show info about adding custom remote and fetching changes" do
|
1131
1131
|
$stdout.should_receive(:puts).with(green "Setting up foo-staging cloud")
|
1132
1132
|
$stdout.should_receive(:print).with("Specify remote name: ")
|
1133
|
-
$stdout.should_receive(:puts).with("git remote add remote git_url")
|
1134
|
-
$stdout.should_receive(:puts).with("git fetch remote")
|
1133
|
+
$stdout.should_receive(:puts).with("Running: git remote add remote git_url")
|
1134
|
+
$stdout.should_receive(:puts).with("Running: git fetch remote")
|
1135
1135
|
$stdout.should_receive(:puts).with(green "Your application is set up.")
|
1136
1136
|
fake_stdin(["no", "remote"]) do
|
1137
1137
|
invoke(@main, :setup)
|
@@ -107,6 +107,13 @@ describe Shelly::CLI::Runner do
|
|
107
107
|
}.should raise_error(RuntimeError)
|
108
108
|
end
|
109
109
|
|
110
|
+
it "should re-raise netrc exception" do
|
111
|
+
Shelly::CLI::Main.stub(:start).and_raise(Netrc::Error.new)
|
112
|
+
lambda {
|
113
|
+
@runner.start
|
114
|
+
}.should raise_error(Netrc::Error)
|
115
|
+
end
|
116
|
+
|
110
117
|
it "should re-raise unauthorized exception" do
|
111
118
|
Shelly::CLI::Main.stub(:start).and_raise(Shelly::Client::UnauthorizedException.new)
|
112
119
|
lambda {
|
@@ -139,6 +146,15 @@ describe Shelly::CLI::Runner do
|
|
139
146
|
}.should raise_error(SystemExit)
|
140
147
|
end
|
141
148
|
|
149
|
+
it "should rescue netrc exception and display message" do
|
150
|
+
Shelly::CLI::Main.stub(:start).and_raise(Netrc::Error.new("Error"))
|
151
|
+
runner = Shelly::CLI::Runner.new(%w(start))
|
152
|
+
$stdout.should_receive(:puts).with("Error")
|
153
|
+
lambda {
|
154
|
+
runner.start
|
155
|
+
}.should raise_error(SystemExit)
|
156
|
+
end
|
157
|
+
|
142
158
|
it "should catch exception thrown by API Client" do
|
143
159
|
Shelly::CLI::Main.stub(:start).and_raise(Shelly::Client::APIException.new({}, 500, "test123"))
|
144
160
|
runner = Shelly::CLI::Runner.new(%w(version))
|
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.4.
|
4
|
+
version: 0.4.5
|
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-09-
|
12
|
+
date: 2013-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -322,7 +322,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
322
322
|
version: '0'
|
323
323
|
segments:
|
324
324
|
- 0
|
325
|
-
hash:
|
325
|
+
hash: 74743708609339319
|
326
326
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
327
327
|
none: false
|
328
328
|
requirements:
|
@@ -331,7 +331,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
331
331
|
version: '0'
|
332
332
|
segments:
|
333
333
|
- 0
|
334
|
-
hash:
|
334
|
+
hash: 74743708609339319
|
335
335
|
requirements: []
|
336
336
|
rubyforge_project: shelly
|
337
337
|
rubygems_version: 1.8.25
|