engineyard-serverside 1.5.23.ruby19.14 → 1.5.23.ruby19.15
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside/configuration.rb +4 -0
- data/lib/engineyard-serverside/deploy.rb +14 -3
- data/lib/engineyard-serverside/future.rb +3 -3
- data/lib/engineyard-serverside/server.rb +2 -1
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/deploy_hook_spec.rb +8 -7
- data/spec/rails31_deploy_spec.rb +21 -0
- metadata +25 -3
@@ -192,6 +192,10 @@ module EY
|
|
192
192
|
File.join(deploy_to, "releases")
|
193
193
|
end
|
194
194
|
|
195
|
+
def failed_release_dir
|
196
|
+
File.join(deploy_to, "releases_failed")
|
197
|
+
end
|
198
|
+
|
195
199
|
def release_path
|
196
200
|
@release_path ||= File.join(release_dir, Time.now.utc.strftime("%Y%m%d%H%M%S"))
|
197
201
|
end
|
@@ -213,9 +213,19 @@ WRAP
|
|
213
213
|
|
214
214
|
# task
|
215
215
|
def cleanup_old_releases
|
216
|
+
clean_release_directory(c.release_dir)
|
217
|
+
clean_release_directory(c.failed_release_dir)
|
218
|
+
end
|
219
|
+
|
220
|
+
# Remove all but the most-recent +count+ releases from the specified
|
221
|
+
# release directory.
|
222
|
+
# IMPORTANT: This expects the release directory naming convention to be
|
223
|
+
# something with a sensible lexical order. Violate that at your peril.
|
224
|
+
def clean_release_directory(dir, count = 3)
|
216
225
|
@cleanup_failed = true
|
217
|
-
|
218
|
-
|
226
|
+
ordinal = count.succ.to_s
|
227
|
+
info "~> Cleaning release directory: #{dir}"
|
228
|
+
sudo "ls -r #{dir} | tail -n +#{ordinal} | xargs -I@ rm -rf #{dir}/@"
|
219
229
|
@cleanup_failed = false
|
220
230
|
end
|
221
231
|
|
@@ -389,7 +399,8 @@ Deploy again if your services configuration appears incomplete or out of date.
|
|
389
399
|
def with_failed_release_cleanup
|
390
400
|
yield
|
391
401
|
rescue Exception
|
392
|
-
|
402
|
+
info "~> Release #{c.release_path} failed, saving release to #{c.failed_release_dir}."
|
403
|
+
sudo "mkdir -p #{c.failed_release_dir} && mv #{c.release_path} #{c.failed_release_dir}"
|
393
404
|
raise
|
394
405
|
end
|
395
406
|
|
@@ -20,10 +20,10 @@ module EY
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
if
|
24
|
-
require 'engineyard-serverside/futures/dataflow'
|
25
|
-
else
|
23
|
+
if defined?(Fiber)
|
26
24
|
require 'engineyard-serverside/futures/celluloid'
|
25
|
+
else
|
26
|
+
require 'engineyard-serverside/futures/dataflow'
|
27
27
|
end
|
28
28
|
end
|
29
29
|
end
|
@@ -108,7 +108,8 @@ module EY
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def install_gem(path)
|
111
|
-
|
111
|
+
# resin + ruby 1.8.6 need sudo privileges to install gems
|
112
|
+
run("sudo #{gem_command} install -q --no-ri --no-rdoc #{path}")
|
112
113
|
end
|
113
114
|
|
114
115
|
def gem_command
|
data/spec/deploy_hook_spec.rb
CHANGED
@@ -54,13 +54,14 @@ describe "the deploy-hook API" do
|
|
54
54
|
|
55
55
|
context "capistrano-ish methods" do
|
56
56
|
it "has them" do
|
57
|
-
run_hook { respond_to?(:latest_release)
|
58
|
-
run_hook { respond_to?(:previous_release)
|
59
|
-
run_hook { respond_to?(:all_releases)
|
60
|
-
run_hook { respond_to?(:current_path)
|
61
|
-
run_hook { respond_to?(:shared_path)
|
62
|
-
run_hook { respond_to?(:release_dir)
|
63
|
-
run_hook { respond_to?(:
|
57
|
+
run_hook { respond_to?(:latest_release) }.should be_true
|
58
|
+
run_hook { respond_to?(:previous_release) }.should be_true
|
59
|
+
run_hook { respond_to?(:all_releases) }.should be_true
|
60
|
+
run_hook { respond_to?(:current_path) }.should be_true
|
61
|
+
run_hook { respond_to?(:shared_path) }.should be_true
|
62
|
+
run_hook { respond_to?(:release_dir) }.should be_true
|
63
|
+
run_hook { respond_to?(:failed_release_dir)}.should be_true
|
64
|
+
run_hook { respond_to?(:release_path) }.should be_true
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
data/spec/rails31_deploy_spec.rb
CHANGED
@@ -77,6 +77,27 @@ EOF
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
context "and failing with errors" do
|
81
|
+
before(:all) do
|
82
|
+
begin
|
83
|
+
deploy_test_application(with_assets = false) do
|
84
|
+
deploy_dir = File.join(@config.shared_path, 'cached-copy', 'deploy')
|
85
|
+
FileUtils.mkdir_p(deploy_dir)
|
86
|
+
hook = File.join(deploy_dir, 'before_migrate.rb')
|
87
|
+
hook_contents = %Q[raise 'aaaaaaahhhhh']
|
88
|
+
File.open(hook, 'w') {|f| f.puts(hook_contents) }
|
89
|
+
File.chmod(0755, hook)
|
90
|
+
end
|
91
|
+
rescue EY::Serverside::RemoteFailure
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it "retains the failed release" do
|
96
|
+
release_name = File.basename(@config.release_path)
|
97
|
+
File.directory?(File.join(@deploy_dir, 'releases_failed', release_name)).should be_true
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
80
101
|
context "with existing precompilation in a deploy hook" do
|
81
102
|
before(:all) do
|
82
103
|
deploy_test_application do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-serverside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.23.ruby19.
|
4
|
+
version: 1.5.23.ruby19.15
|
5
5
|
prerelease: 7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,8 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
13
|
-
dependencies:
|
12
|
+
date: 2012-01-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: &2153140660 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - =
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.3.2
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2153140660
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake
|
27
|
+
requirement: &2153138160 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.9.2.2
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2153138160
|
14
36
|
description:
|
15
37
|
email: cloud@engineyard.com
|
16
38
|
executables:
|