tdd_deploy 0.0.3 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/tdd_deploy_site_installer +7 -0
- data/lib/tasks/tdd_deploy_site_install.rake +17 -0
- data/lib/tdd_deploy/assertions.rb +114 -77
- data/lib/tdd_deploy/base.rb +1 -1
- data/lib/tdd_deploy/configurator.rb +78 -0
- data/lib/tdd_deploy/copy_methods.rb +54 -0
- data/lib/tdd_deploy/deploy_test_methods.rb +20 -22
- data/lib/tdd_deploy/environ.rb +12 -6
- data/lib/tdd_deploy/host_tests/host_connection.rb +3 -4
- data/lib/tdd_deploy/host_tests/remote_ip_tables.rb +21 -13
- data/lib/tdd_deploy/host_tests/remote_monit.rb +2 -6
- data/lib/tdd_deploy/host_tests/remote_nginx.rb +2 -6
- data/lib/tdd_deploy/host_tests/remote_postfix.rb +3 -7
- data/lib/tdd_deploy/host_tests/remote_postgresql.rb +2 -6
- data/lib/tdd_deploy/run_methods.rb +25 -18
- data/lib/tdd_deploy/server.rb +92 -12
- data/lib/tdd_deploy/site_tests/site_database.rb +1 -1
- data/lib/tdd_deploy/site_tests/site_layout.rb +24 -20
- data/lib/tdd_deploy/site_tests/site_user.rb +1 -1
- data/lib/tdd_deploy/version.rb +1 -1
- data/tests/test_assertions.rb +59 -14
- data/tests/test_configurator.rb +34 -0
- data/tests/test_copy_methods.rb +106 -0
- data/tests/{test_test_deploy_methods.rb → test_deploy_test_methods.rb} +23 -11
- data/tests/test_environ.rb +12 -7
- data/tests/test_remote_ip_tables.rb +11 -4
- data/tests/test_run_methods.rb +32 -15
- data/tests/test_server.rb +6 -9
- data/tests/test_site_database.rb +21 -0
- data/tests/test_site_layout.rb +20 -5
- data/tests/test_tdd_deploy_context.rb +16 -0
- data/tests/test_tdd_deploy_server.rb +3 -3
- metadata +20 -13
- data/tests/test_colored_tests.rb +0 -47
data/lib/tdd_deploy/environ.rb
CHANGED
@@ -78,6 +78,8 @@ module TddDeploy
|
|
78
78
|
'local_admin_email' => :string,
|
79
79
|
|
80
80
|
'site' => :string,
|
81
|
+
'site_url' => :string,
|
82
|
+
'site_path' => :string,
|
81
83
|
'site_user' => :string,
|
82
84
|
|
83
85
|
# 'hosts' => :list,
|
@@ -96,12 +98,14 @@ module TddDeploy
|
|
96
98
|
'local_admin_email' => "local_admin@bogus.tld",
|
97
99
|
|
98
100
|
'site' => "site",
|
101
|
+
'site_url' => 'www.site.com', # don't include the scheme
|
102
|
+
'site_path' => '/home/site_user/site.d/current', # default for Capistrano
|
99
103
|
'site_user' => "site_user",
|
100
104
|
|
101
105
|
# 'hosts' => "bar,foo",
|
102
|
-
'balance_hosts' => '',
|
103
|
-
'db_hosts' => '
|
104
|
-
'web_hosts' => '
|
106
|
+
'balance_hosts' => 'arch',
|
107
|
+
'db_hosts' => 'arch',
|
108
|
+
'web_hosts' => 'arch',
|
105
109
|
}
|
106
110
|
|
107
111
|
def env_types
|
@@ -124,9 +128,10 @@ module TddDeploy
|
|
124
128
|
when :list then DataCache.env_hash[k] = self.str_to_list(v)
|
125
129
|
else
|
126
130
|
if k == 'hosts'
|
127
|
-
if DataCache.env_hash['web_hosts'] == DataCache.env_hash['db_hosts']
|
131
|
+
if DataCache.env_hash['web_hosts'] == DataCache.env_hash['db_hosts'] && DataCache.env_hash['web_hosts'] == DataCache.env_hash['balance_hosts']
|
128
132
|
DataCache.env_hash['web_hosts'] =
|
129
|
-
DataCache.env_hash['db_hosts'] =
|
133
|
+
DataCache.env_hash['db_hosts'] =
|
134
|
+
DataCache.env_hash['balance_hosts'] = self.str_to_list(v)
|
130
135
|
else
|
131
136
|
raise RuntimeError.new("#{self}#reset_env(): Cannot assign value to 'hosts' if web_hosts &/or db_hosts already set.\n web_hosts: #{DataCache.env_hash['web_hosts']}\n db_hosts: #{DataCache.env_hash['db_hosts']}")
|
132
137
|
# raise RuntimeError.new("Cannot change hosts key if web_hosts != db_hosts")
|
@@ -231,7 +236,8 @@ module TddDeploy
|
|
231
236
|
def hosts=(list)
|
232
237
|
if (self.web_hosts.nil? && self.db_hosts.nil?) || self.web_hosts == self.db_hosts
|
233
238
|
self.web_hosts =
|
234
|
-
self.db_hosts =
|
239
|
+
self.db_hosts =
|
240
|
+
self.balance_hosts = self.str_to_list(list)
|
235
241
|
else
|
236
242
|
raise RuntimeError.new("Cannot assign value to 'hosts' if web_hosts &/or db_hosts already set.\n web_hosts: #{self.web_hosts}\n db_hosts: #{self.db_hosts}")
|
237
243
|
end
|
@@ -4,24 +4,23 @@ module TddDeploy
|
|
4
4
|
class HostConnection < TddDeploy::Base
|
5
5
|
# ping - pings all hosts
|
6
6
|
def ping
|
7
|
-
require 'net/ping'
|
8
7
|
result = true
|
9
8
|
self.hosts.each do |host|
|
10
|
-
result &= assert
|
9
|
+
result &= assert host, ping_host(host), "Host #{host} should respond to ping"
|
11
10
|
end
|
12
11
|
result
|
13
12
|
end
|
14
13
|
|
15
14
|
# ssh_login - attempts to log in as *host_admin* on all hosts from current user
|
16
15
|
def ssh_login
|
17
|
-
|
16
|
+
deploy_test_on_hosts_as self.host_admin, self.hosts, "/home/#{self.host_admin}\n", "should be able to connect via ssh" do
|
18
17
|
'pwd'
|
19
18
|
end
|
20
19
|
end
|
21
20
|
|
22
21
|
# ssh_login_as_root - attempts to log in as *root* on all hosts from current user
|
23
22
|
def ssh_login_as_root
|
24
|
-
|
23
|
+
deploy_test_on_hosts_as 'root', self.hosts, '/root', "Should be able to connect as root via ssh" do
|
25
24
|
'pwd'
|
26
25
|
end
|
27
26
|
end
|
@@ -12,23 +12,31 @@ module TddDeploy
|
|
12
12
|
self.hosts.each do |host|
|
13
13
|
# Linode seems to refuse to block 21 - FTP control
|
14
14
|
# [20, 21, 23, 25, 53, 5432, 2812].each do |port|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
if self.ping_host(host)
|
16
|
+
[20, 23, 25, 53, 5432, 2812].each do |port|
|
17
|
+
tcp_socket = TCPSocket.new(host, port) rescue 'failed'
|
18
|
+
assert_equal host, 'failed', tcp_socket, "Host: #{host}: Should not be able to connect via tcp to port #{port}"
|
19
|
+
end
|
20
|
+
else
|
21
|
+
fail host, "Host: #{host}: iptables cannot be tested - host does not respond to ping"
|
18
22
|
end
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
26
|
+
# Unfortunately, this doesn't work with UDP. I'd need a resonder on the server
|
27
|
+
# to see if the ports were blocked & I don't have one.
|
22
28
|
# udp_some_blocked_ports - checks UDP ports
|
23
|
-
def udp_some_blocked_ports
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
29
|
+
# def udp_some_blocked_ports
|
30
|
+
# self.hosts.each do |host|
|
31
|
+
# # Linode seems to refuse to block 21 - FTP control
|
32
|
+
# # [20, 21, 23, 25, 53, 5432, 2812].each do |port|
|
33
|
+
# [20, 23, 25, 53, 5432, 2812].each do |port|
|
34
|
+
# # udp_socket = UDPSocket.new(host, port) rescue 'failed'
|
35
|
+
# udp_socket = UDPSocket.new
|
36
|
+
# udp_socket.bind(host, port) rescue 'failed to bind'
|
37
|
+
# assert_equal host, 'failed', udp_socket, "Host: #{host}: Should not be able to connect via udp to port #{port}"
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
# end
|
33
41
|
end
|
34
42
|
end
|
@@ -3,15 +3,11 @@ require 'tdd_deploy/base'
|
|
3
3
|
module TddDeploy
|
4
4
|
class RemoteMonit < TddDeploy::Base
|
5
5
|
def test_monit_installed
|
6
|
-
|
7
|
-
'ls /usr/bin/monit'
|
8
|
-
end
|
6
|
+
deploy_test_file_exists_on_hosts_as self.host_admin, self.hosts, '/usr/bin/monit', 'monit should be installed'
|
9
7
|
end
|
10
8
|
|
11
9
|
def test_monit_running
|
12
|
-
|
13
|
-
'ps -p `cat /var/run/monit.pid`'
|
14
|
-
end
|
10
|
+
deploy_test_process_running_on_hosts_as 'root', self.hosts, '/var/run/monit.pid', "monit should be running"
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
@@ -3,15 +3,11 @@ require 'tdd_deploy/base'
|
|
3
3
|
module TddDeploy
|
4
4
|
class RemoteNginx < TddDeploy::Base
|
5
5
|
def test_nginx_installed
|
6
|
-
|
7
|
-
'ls /usr/sbin/nginx'
|
8
|
-
end
|
6
|
+
deploy_test_file_exists_on_hosts_as self.host_admin, self.web_hosts + self.balance_hosts, '/usr/sbin/nginx', "nginx should be installed"
|
9
7
|
end
|
10
8
|
|
11
9
|
def test_nginx_running
|
12
|
-
|
13
|
-
'ps -p `cat /var/run/nginx.pid`'
|
14
|
-
end
|
10
|
+
deploy_test_process_running_on_hosts_as self.host_admin, self.web_hosts + self.balance_hosts, '/var/run/nginx.pid', "nginx shold be running"
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
@@ -3,19 +3,15 @@ require 'tdd_deploy/base'
|
|
3
3
|
module TddDeploy
|
4
4
|
class RemotePostfix < TddDeploy::Base
|
5
5
|
def test_postfix_installed
|
6
|
-
|
7
|
-
'ls /usr/sbin/postfix'
|
8
|
-
end
|
6
|
+
deploy_test_file_exists_on_hosts_as 'root', self.hosts, '/usr/sbin/postfix', "postfix should be installed"
|
9
7
|
end
|
10
8
|
|
11
9
|
def test_postfix_running
|
12
|
-
|
13
|
-
'ps -p `cat /var/spool/postfix/pid/master.pid`'
|
14
|
-
end
|
10
|
+
deploy_test_process_running_on_hosts_as 'root', self.hosts, '/var/spool/postfix/pid/master.pid', "postfix should be running"
|
15
11
|
end
|
16
12
|
|
17
13
|
def test_postfix_accepts_mail
|
18
|
-
|
14
|
+
deploy_test_on_hosts_as self.host_admin, self.hosts, "mail works\n", 'postfix accepts mail' do |host, login, userid|
|
19
15
|
"echo \"test mail\" | mail -s 'test mail' -r #{userid}@#{host} #{self.local_admin_email} && echo 'mail works'"
|
20
16
|
end
|
21
17
|
end
|
@@ -3,15 +3,11 @@ require 'tdd_deploy/base'
|
|
3
3
|
module TddDeploy
|
4
4
|
class RemotePostgresql < TddDeploy::Base
|
5
5
|
def test_postgresql_installed
|
6
|
-
|
7
|
-
"ls /usr/bin/postgres"
|
8
|
-
end
|
6
|
+
deploy_test_file_exists_on_hosts_as 'root', self.db_hosts, "/usr/bin/postgres", 'postgres should be installed'
|
9
7
|
end
|
10
8
|
|
11
9
|
def test_postgresql_running
|
12
|
-
|
13
|
-
"psql --command='\\l' postgres postgres"
|
14
|
-
end
|
10
|
+
deploy_test_process_running_on_hosts_as 'root', self.db_hosts, '/var/lib/postgres/data/postmaster.pid', 'postgresql server should be running'
|
15
11
|
end
|
16
12
|
end
|
17
13
|
end
|
@@ -1,44 +1,46 @@
|
|
1
1
|
module TddDeploy
|
2
2
|
module RunMethods
|
3
3
|
require 'net/ssh'
|
4
|
+
require 'net/ping'
|
4
5
|
|
5
6
|
# runs the output of the block on all hosts defined in self.hosts as user self.host_admin.
|
6
7
|
# Returns a hash of two element arrays containing output [stdout, stderr] returned from the command.
|
7
8
|
# Hash keys are host names as strings.
|
8
|
-
def run_on_all_hosts(&block)
|
9
|
-
run_on_all_hosts_as self.host_admin, &block
|
9
|
+
def run_on_all_hosts(cmd = nil, &block)
|
10
|
+
run_on_all_hosts_as self.host_admin, cmd, &block
|
10
11
|
end
|
11
12
|
|
12
13
|
# Runs the output of the block on all hosts defined in self.hosts as user 'userid'.
|
13
14
|
# Returns a hash of two element arrays containing output [stdout, stderr] returned from the command.
|
14
15
|
# Hash keys are host names as strings.
|
15
|
-
def run_on_all_hosts_as(userid, &block)
|
16
|
-
|
17
|
-
self.hosts.each do |host|
|
18
|
-
results[host] = run_in_ssh_session_as(userid, host, &block)
|
19
|
-
end
|
20
|
-
results
|
16
|
+
def run_on_all_hosts_as(userid, cmd = nil, &block)
|
17
|
+
run_on_hosts_as userid, self.hosts, cmd, &block
|
21
18
|
end
|
22
|
-
|
23
|
-
#
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
|
20
|
+
# runs supplied command on list of hosts as specified user
|
21
|
+
def run_on_hosts_as userid, host_list, cmd = nil, &block
|
22
|
+
host_list = [host_list] if host_list.is_a? String
|
23
|
+
result = {}
|
24
|
+
host_list.uniq.each do |host|
|
25
|
+
result[host] = run_in_ssh_session_on_host_as userid, host, cmd, &block
|
26
|
+
end
|
27
|
+
result
|
27
28
|
end
|
28
29
|
|
29
30
|
# Runs the command secified in &block on 'host' as user 'userid'.
|
30
31
|
# Returns an array [stdout, stderr] returned from the command.
|
31
|
-
def
|
32
|
+
def run_in_ssh_session_on_host_as(userid, host, cmd = nil, &block)
|
32
33
|
login = "#{userid}@#{host}"
|
33
34
|
match = Regexp.new(match) if match.is_a? String
|
34
|
-
raise ArgumentError
|
35
|
+
raise ArgumentError.new('match expression cannot be empty') if match =~ ''
|
35
36
|
|
36
37
|
rsp = nil
|
37
38
|
err_rsp = nil
|
38
|
-
cmd = block.call
|
39
|
+
cmd = block.call if block_given?
|
40
|
+
raise ArgumentError.new('cmd cannot be empty') if cmd.empty?
|
39
41
|
|
40
42
|
begin
|
41
|
-
ssh_session = Net::SSH.start(host, userid, :timeout => self.ssh_timeout)
|
43
|
+
ssh_session = Net::SSH.start(host, userid, :timeout => self.ssh_timeout, :languages => 'en')
|
42
44
|
raise "Unable to establish connecton to #{host} as #{userid}" if ssh_session.nil?
|
43
45
|
|
44
46
|
ssh_session.open_channel do |channel|
|
@@ -52,8 +54,9 @@ module TddDeploy
|
|
52
54
|
err_rsp ||= ''
|
53
55
|
err_rsp += data.to_s
|
54
56
|
end
|
55
|
-
|
56
57
|
end
|
58
|
+
|
59
|
+
channel.wait
|
57
60
|
end
|
58
61
|
|
59
62
|
# must do this or the channel only runs once
|
@@ -66,6 +69,7 @@ module TddDeploy
|
|
66
69
|
end
|
67
70
|
[rsp, err_rsp, cmd]
|
68
71
|
end
|
72
|
+
|
69
73
|
|
70
74
|
# run locally runs a comman locally and returns the output of stdout, stderr, and the command
|
71
75
|
# run in a 3 element array
|
@@ -122,5 +126,8 @@ module TddDeploy
|
|
122
126
|
[stdout, stderr, cmd]
|
123
127
|
end
|
124
128
|
|
129
|
+
def ping_host host
|
130
|
+
Net::Ping::External.new(host).ping?
|
131
|
+
end
|
125
132
|
end
|
126
133
|
end
|
data/lib/tdd_deploy/server.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
$:.unshift File.expand_path('../lib', __FILE__)
|
3
3
|
|
4
|
+
require 'uri'
|
4
5
|
require 'tdd_deploy'
|
5
6
|
|
6
7
|
module TddDeploy
|
@@ -9,11 +10,13 @@ module TddDeploy
|
|
9
10
|
HOST_TESTS_DIR = File.join(Dir.pwd, 'lib', 'tdd_deploy', 'host_tests')
|
10
11
|
SITE_TESTS_DIR = File.join(Dir.pwd, 'lib', 'tdd_deploy', 'site_tests')
|
11
12
|
LOCAL_TESTS_DIR = File.join(Dir.pwd, 'lib', 'tdd_deploy', 'local_tests')
|
13
|
+
TEMPLATE_PATH = File.join(LIB_DIR, 'tdd_deploy', 'server-templates', 'test_results.html.erb')
|
12
14
|
|
13
|
-
attr_accessor :test_classes
|
15
|
+
attr_accessor :test_classes, :query_hash, :failed_tests
|
14
16
|
|
15
17
|
def initialize *args
|
16
18
|
@already_defined = TddDeploy.constants
|
19
|
+
load_all_tests
|
17
20
|
super
|
18
21
|
end
|
19
22
|
|
@@ -31,28 +34,105 @@ module TddDeploy
|
|
31
34
|
end
|
32
35
|
end
|
33
36
|
end
|
37
|
+
|
34
38
|
self.test_classes = TddDeploy::Base.children - [self.class]
|
39
|
+
|
40
|
+
@test_to_class_map = {}
|
41
|
+
self.test_classes.each do |klass|
|
42
|
+
klass.instance_methods(false).each do |func|
|
43
|
+
@test_to_class_map[func.to_s] = klass
|
44
|
+
end
|
45
|
+
end
|
35
46
|
end
|
36
47
|
|
37
|
-
def run_all_tests
|
38
|
-
|
39
|
-
|
48
|
+
def run_all_tests(test_group = nil)
|
49
|
+
read_env
|
40
50
|
reset_tests
|
41
51
|
|
52
|
+
test_classes = if test_group && defined?(@test_classes_hash)
|
53
|
+
failed_test_keys = test_group.split(',')
|
54
|
+
@test_classes_hash.select { |k, v| failed_test_keys.include? k }.values
|
55
|
+
else
|
56
|
+
self.test_classes
|
57
|
+
end
|
58
|
+
|
42
59
|
ret = true
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
60
|
+
@failed_tests = []
|
61
|
+
test_classes.each do |klass|
|
62
|
+
ret &= run_all_tests_in_class(klass)
|
63
|
+
end
|
64
|
+
ret
|
65
|
+
end
|
66
|
+
|
67
|
+
def run_selected_tests(test_list)
|
68
|
+
read_env
|
69
|
+
ret = true
|
70
|
+
test_list = test_list.split(/[\s,]+/) if test_list.is_a? String
|
71
|
+
test_list.each do |test|
|
72
|
+
ret &= run_a_test test
|
73
|
+
end
|
74
|
+
ret
|
75
|
+
end
|
76
|
+
|
77
|
+
def run_all_tests_in_class klass
|
78
|
+
read_env
|
79
|
+
obj = klass.new
|
80
|
+
ret = true
|
81
|
+
# puts "#{klass}.instance_methods: #{klass.instance_methods(false)}"
|
82
|
+
klass.instance_methods(false).each do |func|
|
83
|
+
test_result = obj.send func.to_sym
|
84
|
+
@failed_tests.push(func) unless test_result
|
85
|
+
ret &= test_result
|
49
86
|
end
|
50
87
|
ret
|
51
88
|
end
|
52
89
|
|
90
|
+
def run_a_test test
|
91
|
+
read_env
|
92
|
+
obj = @test_to_class_map[test].new
|
93
|
+
test_result = obj.send test.to_sym
|
94
|
+
@failed_tests.push(test) unless test_result
|
95
|
+
test_result
|
96
|
+
end
|
97
|
+
|
98
|
+
def parse_query_string(query_string)
|
99
|
+
return '' unless query_string.is_a? String
|
100
|
+
Hash[query_string.split('&').map { |tmp| key,value = tmp.split('='); value ? [key, URI.decode(value)] : [key, 'true']}]
|
101
|
+
end
|
102
|
+
|
103
|
+
def render_results
|
104
|
+
f = File.new(TEMPLATE_PATH)
|
105
|
+
template = ERB.new f.read, nil, '<>'
|
106
|
+
f.close
|
107
|
+
|
108
|
+
template.result(binding)
|
109
|
+
end
|
110
|
+
|
111
|
+
def new_query_string
|
112
|
+
str = "failed-tests=" + URI.escape(@failed_tests.join(',')) unless @failed_tests.nil? || @failed_tests.empty?
|
113
|
+
end
|
114
|
+
|
53
115
|
def call(env)
|
54
|
-
|
55
|
-
|
116
|
+
self.query_hash = parse_query_string(env['QUERY_STRING'])
|
117
|
+
|
118
|
+
if query_hash['run_configurator']
|
119
|
+
require 'tdd_deploy/configurator'
|
120
|
+
configurator = TddDeploy::Configurator.new
|
121
|
+
configurator.make_configuration_files
|
122
|
+
end
|
123
|
+
|
124
|
+
if query_hash['failed-tests']
|
125
|
+
remove_failed_tests
|
126
|
+
run_selected_tests(query_hash['failed-tests'])
|
127
|
+
else
|
128
|
+
run_all_tests
|
129
|
+
end
|
130
|
+
|
131
|
+
query_string = new_query_string
|
132
|
+
body = [
|
133
|
+
render_results,
|
134
|
+
"#{env.inspect}"
|
135
|
+
]
|
56
136
|
return [200, {'Content-Length' => body.join('').length.to_s, 'Content-Type' => 'text/html'}, body]
|
57
137
|
end
|
58
138
|
end
|
@@ -7,7 +7,7 @@ module TddDeploy
|
|
7
7
|
class SiteDatabase < TddDeploy::Base
|
8
8
|
|
9
9
|
def test_site_db_defined
|
10
|
-
|
10
|
+
deploy_test_on_hosts_as self.site_user, self.db_hosts, "#{self.site}\s*\|\s*#{self.site}", "database for #{self.site} should exist" do
|
11
11
|
"psql --command='\\l' postgres postgres"
|
12
12
|
end
|
13
13
|
end
|
@@ -8,39 +8,43 @@ module TddDeploy
|
|
8
8
|
#
|
9
9
|
# The sub directories tested for are:
|
10
10
|
#
|
11
|
-
# *site
|
12
|
-
# *site
|
13
|
-
#
|
11
|
+
# *site*.d - a directory named for the name of the site.
|
12
|
+
# *site*.d/releases - a standard directory used by Capistrano
|
13
|
+
# site/nginx.conf - an nginx configuratino fragment which tells nginx to
|
14
14
|
# proxy the site's *thin* servers
|
15
|
-
#
|
15
|
+
# site/monitrc - a monit configuration fragment which tells monit how to monitor
|
16
16
|
# the site's *thin* servers.
|
17
17
|
class SiteLayout < TddDeploy::Base
|
18
18
|
def test_site_subdir
|
19
|
-
|
20
|
-
"directory /home/#{self.site_user}/#{self.site} should exist" do
|
21
|
-
'ls -F'
|
22
|
-
end
|
19
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.web_hosts, "#{self.site_path}"
|
23
20
|
end
|
24
21
|
|
25
22
|
def test_releases_subdir
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
23
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.web_hosts, "#{self.site_path}/../releases"
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_site_dir_exists
|
27
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.web_hosts, "#{self.site_path}/site"
|
30
28
|
end
|
31
29
|
|
32
30
|
def test_monitrc
|
33
|
-
|
34
|
-
"file /home/#{self.site_user}/monitrc should exist" do
|
35
|
-
'ls'
|
36
|
-
end
|
31
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.web_hosts, "#{self.site_path}/site/monitrc"
|
37
32
|
end
|
38
33
|
|
39
34
|
def test_nginx_conf
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
35
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.web_hosts, "#{self.site_path}/site/nginx.conf"
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_thin_conf
|
39
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.web_hosts, "#{site_path}/config/thin.conf"
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_one_thin_server_conf
|
43
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.web_hosts, "#{site_path}/config/one_thin_server.conf"
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_one_thin_server
|
47
|
+
deploy_test_file_exists_on_hosts_as self.site_user, self.web_hosts, "#{site_path}/site/one_thin_server"
|
44
48
|
end
|
45
49
|
end
|
46
50
|
end
|