engineyard-serverside 2.0.0.pre2 → 2.0.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside/cli.rb +15 -3
- data/lib/engineyard-serverside/configuration.rb +4 -0
- data/lib/engineyard-serverside/deploy.rb +2 -2
- data/lib/engineyard-serverside/rails_asset_support.rb +10 -6
- data/lib/engineyard-serverside/shell/formatter.rb +1 -0
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/support/integration.rb +6 -2
- metadata +4 -4
@@ -233,14 +233,21 @@ module EY
|
|
233
233
|
|
234
234
|
servers = EY::Serverside::Server.all.find_all { |server| !server.local? }
|
235
235
|
|
236
|
+
shell.status "Propagating engineyard-serverside #{EY::Serverside::VERSION} to #{servers.size} server#{servers.size == 1 ? '' : 's' }."
|
237
|
+
|
236
238
|
commands = servers.map do |server|
|
239
|
+
shell.debug "Building propagate commands for #{server.hostname}"
|
240
|
+
|
237
241
|
egrep_escaped_version = EY::Serverside::VERSION.gsub(/\./, '\.')
|
238
242
|
# the [,)] is to stop us from looking for e.g. 0.5.1, seeing
|
239
243
|
# 0.5.11, and mistakenly thinking 0.5.1 is there
|
240
244
|
has_gem_cmd = "#{gem_binary} list engineyard-serverside | grep \"engineyard-serverside\" | egrep -q '#{egrep_escaped_version}[,)]'"
|
241
245
|
|
242
246
|
proc do
|
243
|
-
|
247
|
+
exists = shell.logged_system(server.command_on_server('sh -l -c', has_gem_cmd))
|
248
|
+
if exists.success?
|
249
|
+
exists # Future expects logged system result object
|
250
|
+
else # doesn't have this exact version
|
244
251
|
shell.status "Installing engineyard-serverside on #{server.hostname}"
|
245
252
|
|
246
253
|
shell.logged_system(Escape.shell_command([
|
@@ -249,13 +256,17 @@ module EY
|
|
249
256
|
local_gem_file,
|
250
257
|
"#{config.user}@#{server.hostname}:#{remote_gem_file}",
|
251
258
|
]))
|
252
|
-
|
259
|
+
install_gem_cmd = "#{gem_binary} install --no-rdoc --no-ri '#{remote_gem_file}'"
|
260
|
+
shell.logged_system(server.command_on_server('sudo sh -l -c', install_gem_cmd))
|
253
261
|
end
|
254
262
|
end
|
255
263
|
end
|
256
264
|
|
257
265
|
futures = EY::Serverside::Future.call(commands)
|
258
|
-
EY::Serverside::Future.success?(futures)
|
266
|
+
unless EY::Serverside::Future.success?(futures)
|
267
|
+
failures = futures.select {|f| f.error? }.map {|f| f.inspect}.join("\n")
|
268
|
+
raise EY::Serverside::RemoteFailure.new(failures)
|
269
|
+
end
|
259
270
|
end
|
260
271
|
|
261
272
|
def init_and_propagate(*args)
|
@@ -268,6 +279,7 @@ module EY
|
|
268
279
|
def init(options, action)
|
269
280
|
config = EY::Serverside::Deploy::Configuration.new(options)
|
270
281
|
shell = EY::Serverside::Shell.new(:verbose => config.verbose, :log_path => File.join(ENV['HOME'], "#{config.app}-#{action}.log"))
|
282
|
+
shell.debug "Initializing engineyard-serverside #{EY::Serverside::VERSION}."
|
271
283
|
[config, shell]
|
272
284
|
end
|
273
285
|
|
@@ -219,6 +219,10 @@ module EY
|
|
219
219
|
@release_path ||= File.join(release_dir, Time.now.utc.strftime("%Y%m%d%H%M%S"))
|
220
220
|
end
|
221
221
|
|
222
|
+
def precompile_assets_inferred?
|
223
|
+
!precompile_assets? && !skip_precompile_assets?
|
224
|
+
end
|
225
|
+
|
222
226
|
def precompile_assets?
|
223
227
|
configuration['precompile_assets'] == true
|
224
228
|
end
|
@@ -295,7 +295,7 @@ chmod 0700 #{path}
|
|
295
295
|
run("mkdir -p #{c.release_path} #{c.failed_release_dir} && rsync -aq #{c.exclusions} #{c.repository_cache}/ #{c.release_path}")
|
296
296
|
|
297
297
|
shell.status "Ensuring proper ownership."
|
298
|
-
sudo("chown -R #{c.user}:#{c.group} #{c.
|
298
|
+
sudo("chown -R #{c.user}:#{c.group} #{c.release_path} #{c.failed_release_dir}")
|
299
299
|
end
|
300
300
|
|
301
301
|
def create_revision_file
|
@@ -388,7 +388,7 @@ WRAP
|
|
388
388
|
# task
|
389
389
|
def symlink(release_to_link=c.release_path)
|
390
390
|
shell.status "Symlinking code."
|
391
|
-
run "rm -f #{c.current_path} && ln -nfs #{release_to_link} #{c.current_path} &&
|
391
|
+
run "rm -f #{c.current_path} && ln -nfs #{release_to_link} #{c.current_path} && find #{c.current_path} -not -user #{c.user} -or -not -group #{c.group} -exec chown #{c.user}:#{c.group} {} +"
|
392
392
|
@symlink_changed = true
|
393
393
|
rescue Exception
|
394
394
|
sudo "rm -f #{c.current_path} && ln -nfs #{c.previous_release(release_to_link)} #{c.current_path} && chown -R #{c.user}:#{c.group} #{c.current_path}"
|
@@ -8,7 +8,7 @@ module EY
|
|
8
8
|
keep_existing_assets
|
9
9
|
cmd = "cd #{c.release_path} && PATH=#{c.binstubs_path}:$PATH #{c.framework_envs} rake assets:precompile"
|
10
10
|
|
11
|
-
|
11
|
+
if config.precompile_assets_inferred?
|
12
12
|
# If specifically requested, then we want to fail if compilation fails.
|
13
13
|
# If we are implicitly precompiling, we want to fail non-destructively
|
14
14
|
# because we don't know if the rake task exists or if the user
|
@@ -35,21 +35,25 @@ module EY
|
|
35
35
|
end
|
36
36
|
|
37
37
|
app_rb_path = File.join(c.release_path, 'config', 'application.rb')
|
38
|
-
|
38
|
+
unless File.readable?(app_rb_path) # Not a Rails app in the first place.
|
39
|
+
shell.status "Skipping asset precompilation. (not a Rails application)"
|
40
|
+
return false
|
41
|
+
end
|
39
42
|
|
40
|
-
if
|
43
|
+
if FileTest.exist?(File.join(c.release_path, 'app', 'assets'))
|
41
44
|
shell.status "Attempting Rails asset precompilation. (found directory: 'app/assets')"
|
42
45
|
else
|
46
|
+
shell.status "Skipping asset precompilation. (directory not found: 'app/assets')"
|
43
47
|
return false
|
44
48
|
end
|
45
49
|
|
46
50
|
if app_builds_own_assets?
|
47
|
-
shell.status "Skipping asset compilation. (found directory: 'public/assets')"
|
48
|
-
return
|
51
|
+
shell.status "Skipping asset compilation. Already compiled. (found directory: 'public/assets')"
|
52
|
+
return false
|
49
53
|
end
|
50
54
|
if app_disables_assets?(app_rb_path)
|
51
55
|
shell.status "Skipping asset compilation. (application.rb has disabled asset compilation)"
|
52
|
-
return
|
56
|
+
return false
|
53
57
|
end
|
54
58
|
# This check is very expensive, and has been deemed not worth the time.
|
55
59
|
# Leaving this here in case someone comes up with a faster way.
|
data/spec/support/integration.rb
CHANGED
@@ -115,12 +115,16 @@ class EY::Serverside::Strategies::IntegrationSpec
|
|
115
115
|
def install_git_base
|
116
116
|
repository_cache.mkpath
|
117
117
|
git_base = FIXTURES_DIR.join('gitrepo.tar.gz')
|
118
|
-
|
118
|
+
shell.substatus "Test helpers copying base repo into #{repository_cache}"
|
119
|
+
shell.logged_system "tar xzf #{git_base} --strip-components 1 -C #{repository_cache}"
|
119
120
|
end
|
120
121
|
|
121
122
|
def copy_fixture_repo_files
|
122
123
|
if source_repo.exist?
|
123
|
-
|
124
|
+
shell.substatus "Test helpers copying repo fixture from #{source_repo}/ to #{repository_cache}"
|
125
|
+
# This uses a ruby method instead of shelling out because I was having
|
126
|
+
# trouble getting cp -R to behave consistently between distros.
|
127
|
+
FileUtils.cp_r Dir.glob("#{source_repo}/*"), repository_cache
|
124
128
|
else
|
125
129
|
raise "Mock repo #{source_repo.inspect} does not exist. Path should be absolute. e.g. FIXTURES_DIR.join('repos','example')"
|
126
130
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: engineyard-serverside
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 74746199
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- pre
|
11
|
-
-
|
12
|
-
version: 2.0.0.
|
11
|
+
- 3
|
12
|
+
version: 2.0.0.pre3
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- EY Cloud Team
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2012-
|
20
|
+
date: 2012-06-06 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rspec
|