engineyard-serverside 1.6.0.pre4 → 1.6.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/engineyard-serverside/deploy.rb +11 -10
- data/lib/engineyard-serverside/shell.rb +4 -3
- data/lib/engineyard-serverside/shell/formatter.rb +8 -16
- data/lib/engineyard-serverside/version.rb +1 -1
- data/spec/custom_deploy_spec.rb +26 -8
- data/spec/fixtures/gitrepo/bar +0 -0
- data/spec/shell_spec.rb +19 -17
- metadata +6 -4
@@ -428,21 +428,22 @@ WRAP
|
|
428
428
|
|
429
429
|
def puts_deploy_failure
|
430
430
|
if @cleanup_failed
|
431
|
-
shell.
|
431
|
+
shell.notice "[Relax] Your site is running new code, but clean up of old deploys failed."
|
432
432
|
elsif @maintenance_up
|
433
|
-
|
434
|
-
|
435
|
-
|
433
|
+
message = "[Attention] Maintenance page still up, consider the following before removing:\n"
|
434
|
+
message << " * Deploy hooks ran. This might cause problems for reverting to old code.\n" if @callbacks_reached
|
435
|
+
message << " * Migrations ran. This might cause problems for reverting to old code.\n" if @migrations_reached
|
436
436
|
if @symlink_changed
|
437
|
-
|
437
|
+
message << " * Your new code is symlinked as current.\n"
|
438
438
|
else
|
439
|
-
|
439
|
+
message << " * Your old code is still symlinked as current.\n"
|
440
440
|
end
|
441
|
-
|
442
|
-
|
443
|
-
|
441
|
+
message << " * Application servers failed to restart.\n" if @restart_failed
|
442
|
+
message << "\n"
|
443
|
+
message << "Need help? File a ticket for support.\n"
|
444
|
+
shell.notice message
|
444
445
|
else
|
445
|
-
shell.
|
446
|
+
shell.notice "[Relax] Your site is still running old code and nothing destructive has occurred."
|
446
447
|
end
|
447
448
|
end
|
448
449
|
|
@@ -62,9 +62,10 @@ module EY
|
|
62
62
|
unknown msg.gsub(/^/,' ')
|
63
63
|
end
|
64
64
|
|
65
|
-
def fatal(msg) logger.fatal msg
|
66
|
-
def error(msg) logger.error msg
|
67
|
-
def warning(msg) logger.warn msg end
|
65
|
+
def fatal(msg) logger.fatal "FATAL: #{msg}" end
|
66
|
+
def error(msg) logger.error "ERROR: #{msg}" end
|
67
|
+
def warning(msg) logger.warn "WARNING: #{msg}" end
|
68
|
+
def notice(msg) logger.warn msg end
|
68
69
|
def info(msg) logger.info msg end
|
69
70
|
def debug(msg) logger.debug msg end
|
70
71
|
def unknown(msg) logger.unknown msg end
|
@@ -16,7 +16,9 @@ module EY
|
|
16
16
|
|
17
17
|
def build_message(severity, stamp, message)
|
18
18
|
if %w[WARN ERROR FATAL].include?(severity)
|
19
|
-
prepend("#{stamp}!> ", "#{
|
19
|
+
prepend("#{stamp}!> ", "#{message}")
|
20
|
+
elsif severity == "WARN"
|
21
|
+
prepend("#{stamp}!> ", "#{message}")
|
20
22
|
elsif severity == "INFO"
|
21
23
|
prepend(stamp, message)
|
22
24
|
else
|
@@ -36,14 +38,14 @@ module EY
|
|
36
38
|
end
|
37
39
|
when "INFO"
|
38
40
|
# Need to differentiate info messages more when we're running in verbose mode
|
39
|
-
@stdout << (@verbose ? "\n#{thor_shell.set_color(msg, :white, true)}" : msg)
|
41
|
+
@stdout << (@verbose && msg.index('~>') ? "\n#{thor_shell.set_color(msg, :white, true)}" : msg)
|
40
42
|
@stdout.flush
|
41
43
|
when "WARN"
|
42
|
-
@
|
43
|
-
@
|
44
|
+
@stderr << "\n" << thor_shell.set_color(msg, :yellow, true)
|
45
|
+
@stderr.flush
|
44
46
|
when "ERROR"
|
45
|
-
@
|
46
|
-
@
|
47
|
+
@stderr << "\n" << thor_shell.set_color(msg, :red, true)
|
48
|
+
@stderr.flush
|
47
49
|
else
|
48
50
|
@stderr << msg
|
49
51
|
@stderr.flush
|
@@ -61,16 +63,6 @@ module EY
|
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
64
|
-
def severity_name(severity)
|
65
|
-
if %w[INFO DEBUG ANY].include?(severity)
|
66
|
-
""
|
67
|
-
elsif severity =='WARN'
|
68
|
-
"WARNING: "
|
69
|
-
else
|
70
|
-
"#{severity}: "
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
66
|
def thor_shell
|
75
67
|
thor_shell ||= Thor::Shell::Color.new
|
76
68
|
end
|
data/spec/custom_deploy_spec.rb
CHANGED
@@ -54,11 +54,29 @@ describe "the EY::Serverside::Deploy API" do
|
|
54
54
|
describe "ey.yml loading" do
|
55
55
|
before(:each) do
|
56
56
|
@tempdir = `mktemp -d -t ey_yml_spec.XXXXX`.strip
|
57
|
-
@config = EY::Serverside::Deploy::Configuration.new(
|
58
|
-
|
57
|
+
@config = EY::Serverside::Deploy::Configuration.new({
|
58
|
+
'repository_cache' => @tempdir,
|
59
|
+
'environment_name' => 'env_name',
|
60
|
+
'account_name' => 'acc',
|
61
|
+
'migrate' => nil,
|
62
|
+
'config' => {'branch' => 'branch_from_config'}.to_json
|
63
|
+
})
|
64
|
+
|
65
|
+
@deploy = FullTestDeploy.new(@config, test_shell)
|
66
|
+
|
67
|
+
@yaml_data = {
|
68
|
+
'environments' => {
|
69
|
+
'env_name' => {
|
70
|
+
'copy_exclude' => ['.git'],
|
71
|
+
'migrate' => true,
|
72
|
+
'migration_command' => 'uh oh',
|
73
|
+
'branch' => 'branch_from_ey_yaml'
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
59
77
|
end
|
60
78
|
|
61
|
-
def write_ey_yml(relative_path, data
|
79
|
+
def write_ey_yml(relative_path, data)
|
62
80
|
FileUtils.mkdir_p(File.join(
|
63
81
|
@tempdir,
|
64
82
|
File.dirname(relative_path)))
|
@@ -69,25 +87,25 @@ describe "the EY::Serverside::Deploy API" do
|
|
69
87
|
end
|
70
88
|
|
71
89
|
it "requires 'ey.yml' and adds any defined methods to the deploy" do
|
72
|
-
write_ey_yml 'ey.yml'
|
90
|
+
write_ey_yml 'ey.yml', @yaml_data
|
73
91
|
@deploy.load_ey_yml
|
74
92
|
@deploy.config.copy_exclude.should == ['.git']
|
75
93
|
end
|
76
94
|
|
77
95
|
it "falls back to 'config/ey.yml'" do
|
78
|
-
write_ey_yml 'config/ey.yml'
|
96
|
+
write_ey_yml 'config/ey.yml', @yaml_data
|
79
97
|
@deploy.load_ey_yml
|
80
98
|
@deploy.config.copy_exclude.should == ['.git']
|
81
99
|
end
|
82
100
|
|
83
101
|
it "loads at lower priority than command line options" do
|
84
|
-
write_ey_yml 'ey.yml'
|
102
|
+
write_ey_yml 'ey.yml', @yaml_data
|
85
103
|
@deploy.load_ey_yml
|
86
|
-
@deploy.config.
|
104
|
+
@deploy.config.migrate?.should == false
|
87
105
|
end
|
88
106
|
|
89
107
|
it "loads at lower priority than json config option" do
|
90
|
-
write_ey_yml 'ey.yml'
|
108
|
+
write_ey_yml 'ey.yml', @yaml_data
|
91
109
|
@deploy.load_ey_yml
|
92
110
|
@deploy.config.branch.should == 'branch_from_config'
|
93
111
|
end
|
File without changes
|
data/spec/shell_spec.rb
CHANGED
@@ -12,16 +12,16 @@ describe EY::Serverside::Shell do
|
|
12
12
|
@shell = EY::Serverside::Shell.new(:verbose => true, :stdout => @output, :stderr => @output, :log_path => Pathname.new(Dir.tmpdir).join("engineyard-serverside-#{Time.now.to_i}-${$$}.log"), :start_time => time1)
|
13
13
|
|
14
14
|
Timecop.freeze(time1) do
|
15
|
-
@shell.debug('
|
16
|
-
@shell.
|
15
|
+
@shell.debug('debug')
|
16
|
+
@shell.notice('notice')
|
17
17
|
end
|
18
18
|
Timecop.freeze(time2) do
|
19
19
|
@shell.status('STATUS')
|
20
|
-
@shell.debug("
|
21
|
-
@shell.warning("
|
20
|
+
@shell.debug("multi\nline\ndebug")
|
21
|
+
@shell.warning("multi\nline\nwarning")
|
22
22
|
end
|
23
23
|
Timecop.freeze(time3) do
|
24
|
-
@shell.substatus("
|
24
|
+
@shell.substatus("multi\nline\nsubstatus")
|
25
25
|
end
|
26
26
|
|
27
27
|
tstp_1 = "+ 00s "
|
@@ -30,19 +30,21 @@ describe EY::Serverside::Shell do
|
|
30
30
|
notstp = " "
|
31
31
|
@output.rewind
|
32
32
|
@output.read.should == <<-OUTPUT
|
33
|
-
#{notstp}
|
34
|
-
#{tstp_1} !> WARNING: test2
|
33
|
+
#{notstp} debug
|
35
34
|
|
36
|
-
\e[1m#{
|
37
|
-
\e[0m
|
38
|
-
#{
|
39
|
-
#{notstp}
|
40
|
-
#{
|
41
|
-
#{
|
42
|
-
|
43
|
-
#{
|
44
|
-
#{
|
45
|
-
#{
|
35
|
+
\e[1m\e[33m#{tstp_1} !> notice
|
36
|
+
\e[0m
|
37
|
+
\e[1m\e[37m#{tstp_2} ~> STATUS
|
38
|
+
\e[0m#{notstp} multi
|
39
|
+
#{notstp} line
|
40
|
+
#{notstp} debug
|
41
|
+
|
42
|
+
\e[1m\e[33m#{tstp_2} !> WARNING: multi
|
43
|
+
#{tstp_2} !> line
|
44
|
+
#{tstp_2} !> warning
|
45
|
+
\e[0m#{notstp} ~ multi
|
46
|
+
#{notstp} ~ line
|
47
|
+
#{notstp} ~ substatus
|
46
48
|
OUTPUT
|
47
49
|
end
|
48
50
|
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: -2759328146
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 6
|
9
9
|
- 0
|
10
10
|
- pre
|
11
|
-
-
|
12
|
-
version: 1.6.0.
|
11
|
+
- 5
|
12
|
+
version: 1.6.0.pre5
|
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-02-
|
20
|
+
date: 2012-02-29 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: rspec
|
@@ -330,6 +330,7 @@ files:
|
|
330
330
|
- spec/deploy_hook_spec.rb
|
331
331
|
- spec/deprecation_spec.rb
|
332
332
|
- spec/fixtures/gemfiles/1.0.21-rails-31-with-sqlite
|
333
|
+
- spec/fixtures/gitrepo/bar
|
333
334
|
- spec/fixtures/gitrepo/foo
|
334
335
|
- spec/fixtures/gitrepo.tar.gz
|
335
336
|
- spec/fixtures/invalid_hook.rb
|
@@ -401,6 +402,7 @@ test_files:
|
|
401
402
|
- spec/deploy_hook_spec.rb
|
402
403
|
- spec/deprecation_spec.rb
|
403
404
|
- spec/fixtures/gemfiles/1.0.21-rails-31-with-sqlite
|
405
|
+
- spec/fixtures/gitrepo/bar
|
404
406
|
- spec/fixtures/gitrepo/foo
|
405
407
|
- spec/fixtures/gitrepo.tar.gz
|
406
408
|
- spec/fixtures/invalid_hook.rb
|