tdd_deploy 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. data/lib/tasks/tdd_deploy.rake +12 -4
  2. data/lib/tdd_deploy/configurator.rb +3 -2
  3. data/lib/tdd_deploy/environ.rb +6 -0
  4. data/lib/tdd_deploy/server-templates/test_results.html.erb +159 -0
  5. data/lib/tdd_deploy/server.rb +16 -12
  6. data/lib/tdd_deploy/site-erb/balance_hosts/config/one_thin_server.conf.erb +14 -0
  7. data/lib/tdd_deploy/site-erb/balance_hosts/config/thin.conf.erb +14 -0
  8. data/lib/tdd_deploy/site-erb/balance_hosts/site/monitrc.erb +11 -0
  9. data/lib/tdd_deploy/site-erb/balance_hosts/site/nginx.conf.erb +29 -0
  10. data/lib/tdd_deploy/site-erb/balance_hosts/site/one_thin_server.erb +6 -0
  11. data/lib/tdd_deploy/site-erb/db_hosts/config/one_thin_server.conf.erb +14 -0
  12. data/lib/tdd_deploy/site-erb/db_hosts/config/thin.conf.erb +14 -0
  13. data/lib/tdd_deploy/site-erb/db_hosts/site/monitrc.erb +11 -0
  14. data/lib/tdd_deploy/site-erb/db_hosts/site/nginx.conf.erb +29 -0
  15. data/lib/tdd_deploy/site-erb/db_hosts/site/one_thin_server.erb +6 -0
  16. data/lib/tdd_deploy/site-erb/web_hosts/config/one_thin_server.conf.erb +14 -0
  17. data/lib/tdd_deploy/site-erb/web_hosts/config/thin.conf.erb +14 -0
  18. data/lib/tdd_deploy/site-erb/web_hosts/site/monitrc.erb +11 -0
  19. data/lib/tdd_deploy/site-erb/web_hosts/site/nginx.conf.erb +29 -0
  20. data/lib/tdd_deploy/site-erb/web_hosts/site/one_thin_server.erb +6 -0
  21. data/lib/tdd_deploy/version.rb +1 -1
  22. data/tests/test_environ.rb +10 -1
  23. data/tests/test_server.rb +4 -1
  24. metadata +27 -14
  25. data/bin/tdd_deploy_site_installer +0 -7
  26. data/lib/tasks/tdd_deploy_site_install.rake +0 -17
@@ -3,21 +3,29 @@ LIB_PATH = File.expand_path('../..', __FILE__)
3
3
  LOCAL_TDD_DIR = File.join('lib', 'tdd_deploy')
4
4
 
5
5
  namespace :tdd_deploy do
6
- desc "uninstall removes gem supplied version of tests in lib/tdd_deploy/host_tests & site_tests. Doesn't touch lib/tdd_deploy/local_tests"
7
- task :uninstall do
6
+ desc "deletes tests in lib/tdd_deploy/host_tests & site_tests"
7
+ task :flush_gem_tests do
8
8
  ['host_tests', 'site_tests'].each do |target_dir|
9
9
  target_path = File.join(LOCAL_TDD_DIR, target_dir)
10
10
  FileUtils.rm_r target_path if File.exists? target_path
11
11
  end
12
12
  end
13
13
 
14
- desc "install tdd_deploy copies tests for hosts and sites from #{LIB_PATH} to lib/tdd_deploy/"
14
+ desc "deletes tdd_deploy_configs/ & all it's files"
15
+ task :rm_configs do
16
+ tdd_deploy_configs = './tdd_deploy_configs'
17
+ Dir.rm_r tdd_deploy_configs if File.exists? tdd_deploy_configs
18
+ end
19
+
20
+ desc "copies tests & config templates to lib/tdd_deploy/"
15
21
  task :install do
16
22
  LOCAL_TDD_DIR = File.join('lib', 'tdd_deploy')
17
23
  [ 'lib', LOCAL_TDD_DIR, File.join(LOCAL_TDD_DIR, 'local_tests')].each do |path|
18
24
  Dir.mkdir(path) unless File.exists? path
19
25
  end
20
- [ File.join(LIB_PATH, 'tdd_deploy', 'host_tests'), File.join(LIB_PATH, 'tdd_deploy', 'site_tests')].each do |src|
26
+ [ File.join(LIB_PATH, 'tdd_deploy', 'host_tests'),
27
+ File.join(LIB_PATH, 'tdd_deploy', 'site_tests'),
28
+ File.join(LIB_PATH, 'tdd_deploy', 'site-erb')].each do |src|
21
29
  FileUtils.cp_r src, LOCAL_TDD_DIR
22
30
  end
23
31
  end
@@ -35,7 +35,8 @@ module TddDeploy
35
35
  end
36
36
 
37
37
  # instantiate all templates and write output to tdd_deploy_configs
38
- erb_dir = File.expand_path('../site-erb', __FILE__)
38
+ erb_dir = File.join('lib', 'tdd_deploy', 'site-erb')
39
+ # erb_dir = File.expand_path('../site-erb', __FILE__)
39
40
  Dir.new(erb_dir).each do |host_dir_fname|
40
41
  next if host_dir_fname[0] == '.'
41
42
 
@@ -61,7 +62,7 @@ module TddDeploy
61
62
 
62
63
  out_fname = File.basename(fname, '.erb')
63
64
 
64
- Dir.mkdir(subdir_path) unless File.exists? subdir
65
+ Dir.mkdir(subdir_path) unless File.exists? subdir_path
65
66
  out_path = File.join(tdd_deploy_configs, host_dir_fname, subdir, out_fname)
66
67
 
67
68
  f = File.new(out_path, "w")
@@ -79,6 +79,7 @@ module TddDeploy
79
79
 
80
80
  'site' => :string,
81
81
  'site_url' => :string,
82
+ 'site_aliases' => :string,
82
83
  'site_path' => :string,
83
84
  'site_user' => :string,
84
85
 
@@ -99,6 +100,7 @@ module TddDeploy
99
100
 
100
101
  'site' => "site",
101
102
  'site_url' => 'www.site.com', # don't include the scheme
103
+ 'site_aliases' => '',
102
104
  'site_path' => '/home/site_user/site.d/current', # default for Capistrano
103
105
  'site_user' => "site_user",
104
106
 
@@ -181,6 +183,10 @@ module TddDeploy
181
183
  ensure
182
184
  f.close
183
185
  end
186
+ # add any missing env keys
187
+ (self.env_types.keys - self.env_hash.keys).each do |key|
188
+ self.env_hash[key] = self.env_defaults[key]
189
+ end
184
190
  return self.env_hash
185
191
  else
186
192
  raise RuntimeError.new("Unable to open #{path} for reading")
@@ -0,0 +1,159 @@
1
+ <% def reset_even_odd
2
+ @even_odd = 'even'
3
+ end
4
+ def even_odd
5
+ @even_odd ||= 'even'
6
+ @even_odd = @even_odd == 'even' ? 'odd' : 'even'
7
+ end
8
+ %>
9
+ <!DOCTYPE html>
10
+
11
+ <html lang="en">
12
+ <head>
13
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
14
+ <title>TddDeploy for <%= site %></title>
15
+ <meta name="generator" content="TextMate http://macromates.com/">
16
+ <meta name="author" content="Mike">
17
+ <style type="text/css" media="screen">
18
+ body {
19
+ font-family: sans-serif;
20
+ }
21
+ h1 { font-size: 1.4em;}
22
+ h2 { font-size: 1.2em;}
23
+
24
+ #test-summary {
25
+ padding: 10px;
26
+ border: 3px solid black;
27
+ margin: 1em;
28
+ }
29
+ #test-summary-passed { color:#080; }
30
+ #test-summary-failed { color: #800;}
31
+
32
+ #configurator {
33
+ padding: 10px;
34
+ border: 3px solid gray;
35
+ margin: 1em;
36
+ }
37
+
38
+ .env-summary {
39
+ padding: 10px;
40
+ border: 3px solid black;
41
+ background:#ddd;
42
+ margin: 1em;
43
+ }
44
+ .env-summary table { width: 100%;}
45
+ .env-summary th { text-align: left;}
46
+ .env-key { width: 20em;}
47
+ .env-val {}
48
+ .test-result-group {
49
+ padding: 10px;
50
+ margin: 10px;
51
+ /* border: solid 1px black;*/
52
+ background: white;
53
+ }
54
+ .test-result {
55
+ padding: 1em;
56
+ margin: 1em;
57
+ }
58
+ .test-result-success { background: #dfd;border: 3px #080 solid; }
59
+ .test-result-failure { background: #fee; border: 3px #800 solid;}
60
+ .test-result-summary-success { color: #080; }
61
+ .test-result-summary-failure { color: #800; }
62
+ .test-result-detail li { list-style: none;
63
+ }
64
+ .test-result-detail-success {
65
+ color: #080;
66
+ }
67
+ .test-result-detail-failure {
68
+ color: #800;
69
+ }
70
+ .odd { background: #eee;}
71
+ .even { background: #ccc;}
72
+ </style>
73
+ <!-- Date: 2011-08-20 -->
74
+ </head>
75
+ <body>
76
+ <div id="test-summary">
77
+ <h1>TddDeloy Test Results: site: <%= site %> / hosts: <%= hosts %></h1>
78
+
79
+ <% if (failures = total_failures) == 0 %>
80
+ <p id="test-summary-passed">All Tests Passed</p>
81
+ <% else %>
82
+ <p id="test-summary-failed"><%= failures %> of <%= total_tests %> Tests Failed</p>
83
+ <% end %>
84
+ <p><a href="/">Re-Run All Tests</a></p>
85
+ <p><a href="/?failed-tests=<%= failed_tests.join(',') %>">Re-Run Failed Tests</a></p>
86
+ </div> <!-- test summary -->
87
+
88
+
89
+ <div class="env-summary">
90
+ <h2>Host / Site environment</h2>
91
+ <table>
92
+ <% reset_even_odd %>
93
+ <% env_hash.keys.sort.each do |k| %>
94
+ <tr class="<%= even_odd %>"><th class="env-key"><%= k %></th> <td class="env-value"><%= env_hash[k] %></td></tr>
95
+ <% end %>
96
+ </table>
97
+ </div>
98
+
99
+ <div id="configurator">
100
+ <h2>Configurator Directory</h2>
101
+ <p><a href="/?run_configurator">Run configurator</a></p>
102
+ <% reset_even_odd %>
103
+ <% tdd_deploy_configs = 'tdd_deploy_configs' %>
104
+ <% if File.exists? tdd_deploy_configs %>
105
+ <table>
106
+ <tr class="<%= even_odd %>"><td><%= tdd_deploy_configs %></td></tr>
107
+ <% ['balance_hosts', 'db_hosts', 'web_hosts'].each do |host_dir| %>
108
+ <% host_path = File.join(tdd_deploy_configs, host_dir) %>
109
+ <% unless File.exists? host_path %>
110
+ <tr class="<%= even_odd %>"><td></td><td><%= host_dir %> does not exist</td></tr>
111
+ <% next %>
112
+ <% end %>
113
+ <tr class="<%= even_odd %>"><td></td><td><%= host_dir %>/</td></tr>
114
+
115
+ <% ['config', 'site'].each do |subdir| %>
116
+ <% subdir_path = File.join(host_path, subdir) %>
117
+ <% unless File.exists? subdir_path %>
118
+ <tr class="<%= even_odd %>"><td></td><td></td><td><%= subdir %> does not exist</td></tr>
119
+ <% next %>
120
+ <% end %>
121
+ <tr class="<%= even_odd %>"><td></td><td></td><td><%= subdir %>/</td></tr>
122
+
123
+ <% Dir.new(subdir_path).each do |fname| %>
124
+ <% next if fname[0] == '.' %>
125
+ <tr class="<%= even_odd %>"><td></td><td></td><td></td><td><%= fname %></td></tr>
126
+ <% end %>
127
+ <% end %>
128
+ <% end %>
129
+ </table>
130
+ <% else %>
131
+ <p>No Site Configuration files exist</p>
132
+ <% end %>
133
+ </div> <!-- configurator -->
134
+
135
+ <% test_result_index = 0 %>
136
+ <% test_results.each do |key, messages| %>
137
+ <% if failure_count(key) == 0 %>
138
+ <div class="test-result test-result-success">
139
+ <h2 id="test-result-<%= key %>"><span class="test-result-group">Results for '<%= key %>'</span></h2>
140
+ <p class="test-result-summary-success">All Tests Passed</p>
141
+ <% else %>
142
+ <div class="test-result test-result-failure">
143
+ <h2 id="test-result-<%= key %>"><span class="test-result-group">Results for '<%= key %>'</span></h2>
144
+ <p class="test-result-summary-failure"><%= failure_count(key) %> of <%= test_count(key) %> Failed</p>
145
+ <% end %>
146
+ <ul class="test-result-detail">
147
+ <% reset_even_odd %>
148
+ <% messages.each do |msg| %>
149
+ <% result, success_msg = msg %>
150
+ <% test_result_index += 1 %>
151
+ <li id="test-result-detail-<%= test_result_index %>" class="<%= even_odd %> <%= result ? 'test-result-detail-success' : 'test-result-detail-failure' %>">
152
+ <%= success_msg %>
153
+ </li>
154
+ <% end %>
155
+ </ul>
156
+ </div> <!-- test-result for <%= key %> -->
157
+ <% end %>
158
+ </body>
159
+ </html>
@@ -17,21 +17,25 @@ module TddDeploy
17
17
  def initialize *args
18
18
  @already_defined = TddDeploy.constants
19
19
  load_all_tests
20
+ if args.last.is_a? Hash
21
+ self.set_env args.last
22
+ self.save_env
23
+ end
20
24
  super
21
25
  end
22
26
 
23
27
  def load_all_tests
24
- if TddDeploy::Base.children == [self.class]
25
- [TddDeploy::Server::HOST_TESTS_DIR, TddDeploy::Server::SITE_TESTS_DIR,
26
- TddDeploy::Server::LOCAL_TESTS_DIR].each do |dir|
27
- if File.exists?(dir)
28
- puts "gathering tests from #{dir}"
29
- Dir.new(dir).each do |fname|
30
- require File.join(dir, fname) unless fname[0] == '.'
31
- end
32
- else
33
- puts "skipping #{dir} - no such directory"
28
+ [TddDeploy::Server::HOST_TESTS_DIR, TddDeploy::Server::SITE_TESTS_DIR,
29
+ TddDeploy::Server::LOCAL_TESTS_DIR].each do |dir|
30
+ if File.exists?(dir)
31
+ puts "gathering tests from #{dir}"
32
+ Dir.new(dir).each do |fname|
33
+ next if fname[0] == '.'
34
+
35
+ load File.join(dir, fname)
34
36
  end
37
+ else
38
+ puts "skipping #{dir} - no such directory"
35
39
  end
36
40
  end
37
41
 
@@ -107,7 +111,7 @@ module TddDeploy
107
111
 
108
112
  template.result(binding)
109
113
  end
110
-
114
+
111
115
  def new_query_string
112
116
  str = "failed-tests=" + URI.escape(@failed_tests.join(',')) unless @failed_tests.nil? || @failed_tests.empty?
113
117
  end
@@ -131,7 +135,7 @@ module TddDeploy
131
135
  query_string = new_query_string
132
136
  body = [
133
137
  render_results,
134
- "#{env.inspect}"
138
+ # "#{env.inspect}"
135
139
  ]
136
140
  return [200, {'Content-Length' => body.join('').length.to_s, 'Content-Type' => 'text/html'}, body]
137
141
  end
@@ -0,0 +1,14 @@
1
+ ---
2
+ chdir: <%= site_path %>
3
+ environment: production
4
+ address: 127.0.0.1
5
+ timeout: 30
6
+ log: log/thin.log
7
+ pid: <%= site_path %>/tmp/pids/thin.pid
8
+ max_conns: 1024
9
+ max_persistent_conns: 512
10
+ require: []
11
+
12
+ wait: 30
13
+ server: 1
14
+ daemonize: true
@@ -0,0 +1,14 @@
1
+ chdir: <%= site_path %>
2
+ environment: production
3
+ address: 127.0.0.1
4
+ port: <%= site_base_port %>
5
+ timeout: 30
6
+ log: log/thin.log
7
+ pid: <%= site_path %>/tmp/pids/thin.pid
8
+ max_conns: 1024
9
+ max_persistent_conns: 512
10
+ require: []
11
+
12
+ wait: 30
13
+ servers: <%= site_num_servers %>
14
+ daemonize: true
@@ -0,0 +1,11 @@
1
+ <% ((site_base_port)...(site_base_port+site_num_servers)).each do |port| %>
2
+ check process <%= site %>_server_<%= port %> with pidfile <%= "#{site_path}/tmp/pids/thin.#{port}.pid" %>
3
+ start process = "<%= "#{site_path}/site/thin_one_server start #{port}" %>" with timeout 60 seconds
4
+ stop process = "<%= "#{site_path}/site/thin_one_server stop #{port}" %>"
5
+ if failed host localhost port <%= port %> protocol http
6
+ and request "/"
7
+ then restart
8
+ if 3 restarts within 5 cycles then timeout
9
+ group server
10
+
11
+ <% end %>
@@ -0,0 +1,29 @@
1
+ host {
2
+
3
+ }
4
+ upstream <%= site %> {
5
+ <% ((site_base_port)...(site_base_port+site_num_servers)).each do |port| %>
6
+ server 127.0.0.1:<%= port %>;
7
+ <% end %>
8
+ }
9
+ server {
10
+ listen 80;
11
+ server_name <%= site_url %>;
12
+ root <%= site_path %>/current;
13
+ location / {
14
+ proxy_set_header X-Real-IP $remote_addr;
15
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
16
+ proxy_set_header Host $http_host;
17
+ proxy_redirect false;
18
+ try_files $uri $uri/index.html $uri.html @thin;
19
+ location / {
20
+ include proxy.conf;
21
+ proxy_pass http://<%= site %>;
22
+ }
23
+ }
24
+
25
+ error_page 500 502 503 504 /500.html;
26
+ location = /500.html {
27
+ root html;
28
+ }
29
+ }
@@ -0,0 +1,6 @@
1
+ #! /bin/sh
2
+
3
+ PORT=$1
4
+
5
+ cd <%= site_path %>
6
+ bundle exec thin --config ./config/thin_one_server.config --port $PORT start
@@ -0,0 +1,14 @@
1
+ ---
2
+ chdir: <%= site_path %>
3
+ environment: production
4
+ address: 127.0.0.1
5
+ timeout: 30
6
+ log: log/thin.log
7
+ pid: <%= site_path %>/tmp/pids/thin.pid
8
+ max_conns: 1024
9
+ max_persistent_conns: 512
10
+ require: []
11
+
12
+ wait: 30
13
+ server: 1
14
+ daemonize: true
@@ -0,0 +1,14 @@
1
+ chdir: <%= site_path %>
2
+ environment: production
3
+ address: 127.0.0.1
4
+ port: <%= site_base_port %>
5
+ timeout: 30
6
+ log: log/thin.log
7
+ pid: <%= site_path %>/tmp/pids/thin.pid
8
+ max_conns: 1024
9
+ max_persistent_conns: 512
10
+ require: []
11
+
12
+ wait: 30
13
+ servers: <%= site_num_servers %>
14
+ daemonize: true
@@ -0,0 +1,11 @@
1
+ <% ((site_base_port)...(site_base_port+site_num_servers)).each do |port| %>
2
+ check process <%= site %>_server_<%= port %> with pidfile <%= "#{site_path}/tmp/pids/thin.#{port}.pid" %>
3
+ start process = "<%= "#{site_path}/site/thin_one_server start #{port}" %>" with timeout 60 seconds
4
+ stop process = "<%= "#{site_path}/site/thin_one_server stop #{port}" %>"
5
+ if failed host localhost port <%= port %> protocol http
6
+ and request "/"
7
+ then restart
8
+ if 3 restarts within 5 cycles then timeout
9
+ group server
10
+
11
+ <% end %>
@@ -0,0 +1,29 @@
1
+ host {
2
+
3
+ }
4
+ upstream <%= site %> {
5
+ <% ((site_base_port)...(site_base_port+site_num_servers)).each do |port| %>
6
+ server 127.0.0.1:<%= port %>;
7
+ <% end %>
8
+ }
9
+ server {
10
+ listen 80;
11
+ server_name <%= site_url %>;
12
+ root <%= site_path %>/current;
13
+ location / {
14
+ proxy_set_header X-Real-IP $remote_addr;
15
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
16
+ proxy_set_header Host $http_host;
17
+ proxy_redirect false;
18
+ try_files $uri $uri/index.html $uri.html @thin;
19
+ location / {
20
+ include proxy.conf;
21
+ proxy_pass http://<%= site %>;
22
+ }
23
+ }
24
+
25
+ error_page 500 502 503 504 /500.html;
26
+ location = /500.html {
27
+ root html;
28
+ }
29
+ }
@@ -0,0 +1,6 @@
1
+ #! /bin/sh
2
+
3
+ PORT=$1
4
+
5
+ cd <%= site_path %>
6
+ bundle exec thin --config ./config/thin_one_server.config --port $PORT start
@@ -0,0 +1,14 @@
1
+ ---
2
+ chdir: <%= site_path %>
3
+ environment: production
4
+ address: 127.0.0.1
5
+ timeout: 30
6
+ log: log/thin.log
7
+ pid: <%= site_path %>/tmp/pids/thin.pid
8
+ max_conns: 1024
9
+ max_persistent_conns: 512
10
+ require: []
11
+
12
+ wait: 30
13
+ server: 1
14
+ daemonize: true
@@ -0,0 +1,14 @@
1
+ chdir: <%= site_path %>
2
+ environment: production
3
+ address: 127.0.0.1
4
+ port: <%= site_base_port %>
5
+ timeout: 30
6
+ log: log/thin.log
7
+ pid: <%= site_path %>/tmp/pids/thin.pid
8
+ max_conns: 1024
9
+ max_persistent_conns: 512
10
+ require: []
11
+
12
+ wait: 30
13
+ servers: <%= site_num_servers %>
14
+ daemonize: true
@@ -0,0 +1,11 @@
1
+ <% ((site_base_port)...(site_base_port+site_num_servers)).each do |port| %>
2
+ check process <%= site %>_server_<%= port %> with pidfile <%= "#{site_path}/tmp/pids/thin.#{port}.pid" %>
3
+ start process = "<%= "#{site_path}/site/thin_one_server start #{port}" %>" with timeout 60 seconds
4
+ stop process = "<%= "#{site_path}/site/thin_one_server stop #{port}" %>"
5
+ if failed host localhost port <%= port %> protocol http
6
+ and request "/"
7
+ then restart
8
+ if 3 restarts within 5 cycles then timeout
9
+ group server
10
+
11
+ <% end %>
@@ -0,0 +1,29 @@
1
+ host {
2
+
3
+ }
4
+ upstream <%= site %> {
5
+ <% ((site_base_port)...(site_base_port+site_num_servers)).each do |port| %>
6
+ server 127.0.0.1:<%= port %>;
7
+ <% end %>
8
+ }
9
+ server {
10
+ listen 80;
11
+ server_name <%= site_url %>;
12
+ root <%= site_path %>/current;
13
+ location / {
14
+ proxy_set_header X-Real-IP $remote_addr;
15
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
16
+ proxy_set_header Host $http_host;
17
+ proxy_redirect false;
18
+ try_files $uri $uri/index.html $uri.html @thin;
19
+ location / {
20
+ include proxy.conf;
21
+ proxy_pass http://<%= site %>;
22
+ }
23
+ }
24
+
25
+ error_page 500 502 503 504 /500.html;
26
+ location = /500.html {
27
+ root html;
28
+ }
29
+ }
@@ -0,0 +1,6 @@
1
+ #! /bin/sh
2
+
3
+ PORT=$1
4
+
5
+ cd <%= site_path %>
6
+ bundle exec thin --config ./config/thin_one_server.config --port $PORT start
@@ -1,3 +1,3 @@
1
1
  module TddDeploy
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
@@ -29,11 +29,20 @@ class TestEnvironTestCase < Test::Unit::TestCase
29
29
  @foo.save_env
30
30
  end
31
31
 
32
- def test_exsistence_of_public_methods
32
+ def test_existence_of_public_methods
33
33
  [:reset_env, :read_env, :reset_env].each do |meth|
34
34
  assert @foo.respond_to?(meth), "@foo should respond to #{meth}"
35
35
  end
36
36
  end
37
+
38
+ def test_auto_complete_of_missing_keys
39
+ @foo.save_env
40
+ @foo.clear_env
41
+ system('TMP=/tmp/t-$$; trap "rm $TMP; exit" 0 1 2 3 15 ;cp site_host_setup.env $TMP ; sed -e 1d $TMP >site_host_setup.env')
42
+ @foo.read_env
43
+ assert_equal @foo.env_types.keys.sort, @foo.env_hash.keys.sort, "read_env should set all keys"
44
+ end
45
+
37
46
  def test_response_to_accessors
38
47
  [:env_hash].each do |meth|
39
48
  assert @foo.respond_to?("#{meth}".to_sym), "@foo should respond to #{meth}"
data/tests/test_server.rb CHANGED
@@ -11,13 +11,16 @@ class TestServerTestCase < Test::Unit::TestCase
11
11
 
12
12
  def setup
13
13
  require 'tdd_deploy/server'
14
- @tester = TddDeploy::Server.new(:web_hosts => 'arch', :db_hosts => 'arch',
14
+ @tester = TddDeploy::Server.new
15
+ @tester.set_env(:web_hosts => 'arch', :db_hosts => 'arch',
15
16
  :host_admin => 'mike', :local_admin => 'mike', :ssh_timeout => 2,
16
17
  :site => 'site', :site_user => 'site_user')
18
+ @tester.save_env
17
19
  end
18
20
 
19
21
  def teardown
20
22
  @tester = nil
23
+ system('rm site_host_setup.env')
21
24
  end
22
25
 
23
26
  def test_classes_array
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdd_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &2153541160 !ruby/object:Gem::Requirement
16
+ requirement: &2164703420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153541160
24
+ version_requirements: *2164703420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: net-ping
27
- requirement: &2153540580 !ruby/object:Gem::Requirement
27
+ requirement: &2164702780 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153540580
35
+ version_requirements: *2164702780
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: net-ssh
38
- requirement: &2153540040 !ruby/object:Gem::Requirement
38
+ requirement: &2164702200 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153540040
46
+ version_requirements: *2164702200
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: ZenTest
49
- requirement: &2153539420 !ruby/object:Gem::Requirement
49
+ requirement: &2164701580 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 4.5.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2153539420
57
+ version_requirements: *2164701580
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: autotest-growl
60
- requirement: &2153538880 !ruby/object:Gem::Requirement
60
+ requirement: &2164701040 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,14 +65,13 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153538880
68
+ version_requirements: *2164701040
69
69
  description: Test driven support for host provisioning & Capistrano deployment - for
70
70
  those who don't want to bother learning too much
71
71
  email: ! ' mike@clove.com '
72
72
  executables:
73
73
  - tdd_deploy_context
74
74
  - tdd_deploy_server
75
- - tdd_deploy_site_installer
76
75
  extensions: []
77
76
  extra_rdoc_files: []
78
77
  files:
@@ -81,7 +80,6 @@ files:
81
80
  - config.ru
82
81
  - bin/tdd_deploy_context
83
82
  - bin/tdd_deploy_server
84
- - bin/tdd_deploy_site_installer
85
83
  - lib/tdd_deploy/assertions.rb
86
84
  - lib/tdd_deploy/base.rb
87
85
  - lib/tdd_deploy/configurator.rb
@@ -124,7 +122,22 @@ files:
124
122
  - tests/test_tdd_deploy_context.rb
125
123
  - tests/test_tdd_deploy_server.rb
126
124
  - lib/tasks/tdd_deploy.rake
127
- - lib/tasks/tdd_deploy_site_install.rake
125
+ - lib/tdd_deploy/server-templates/test_results.html.erb
126
+ - lib/tdd_deploy/site-erb/balance_hosts/config/one_thin_server.conf.erb
127
+ - lib/tdd_deploy/site-erb/balance_hosts/config/thin.conf.erb
128
+ - lib/tdd_deploy/site-erb/balance_hosts/site/monitrc.erb
129
+ - lib/tdd_deploy/site-erb/balance_hosts/site/nginx.conf.erb
130
+ - lib/tdd_deploy/site-erb/balance_hosts/site/one_thin_server.erb
131
+ - lib/tdd_deploy/site-erb/db_hosts/config/one_thin_server.conf.erb
132
+ - lib/tdd_deploy/site-erb/db_hosts/config/thin.conf.erb
133
+ - lib/tdd_deploy/site-erb/db_hosts/site/monitrc.erb
134
+ - lib/tdd_deploy/site-erb/db_hosts/site/nginx.conf.erb
135
+ - lib/tdd_deploy/site-erb/db_hosts/site/one_thin_server.erb
136
+ - lib/tdd_deploy/site-erb/web_hosts/config/one_thin_server.conf.erb
137
+ - lib/tdd_deploy/site-erb/web_hosts/config/thin.conf.erb
138
+ - lib/tdd_deploy/site-erb/web_hosts/site/monitrc.erb
139
+ - lib/tdd_deploy/site-erb/web_hosts/site/nginx.conf.erb
140
+ - lib/tdd_deploy/site-erb/web_hosts/site/one_thin_server.erb
128
141
  homepage: https://github.com/mikehoward/tdd_deploy
129
142
  licenses:
130
143
  - GPL3
@@ -1,7 +0,0 @@
1
- #! /usr/bin/env ruby
2
-
3
- $:.unshift File.expand_path('../../lib', __FILE__)
4
-
5
- require 'tdd_deploy/site_installer'
6
-
7
- TddDeploy::SiteInstaller.new.install
@@ -1,17 +0,0 @@
1
- require 'rake'
2
-
3
- desc 'Clean'
4
- task :clean do
5
- ['monitrc', 'one_thin_server'].each do |fname|
6
- FileUtils.rm File.join('site', fname)
7
- end
8
- ['nginx.conf', 'thin.conf', 'thin_one_server.conf'].each do |fname|
9
- FileUtils.rm File.join('config', fname)
10
- end
11
- end
12
-
13
- desc 'Create Site Config & Site files'
14
- task :create_site_files do
15
- require 'tdd_deploy_site_installer'
16
-
17
- end