tdd_deploy 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,19 @@
1
1
  module TddDeploy
2
- module Assertions
3
- GREEN = '#080'
4
- RED = '#800'
5
- GROUP_ELT_TAG = 'ul'
6
- HEADER_ELT_TAG = 'h2'
7
- RESULT_ELT_TAG = 'li'
8
2
  # TddDeploy re-implements popular assertions so that they can be used
9
3
  # in multi-host testing.
10
4
  #
11
- # These assertions differ from usual TDD assertions in that they do not stop
12
- # tests after failing. Rather they continue and accumulate failure counts and messages
5
+ # These assertions differ from usual TDD assertions in two ways:
6
+ # * all assertions are 'keyed' - all the test results are grouped by
7
+ # keys.
8
+ # * that they do not stop tests after failing. Rather they continue and
9
+ # accumulate failure counts and messages
13
10
  # which can be displayed using *announce_formatted_test_results()*.
14
11
  #
15
12
  # all assertions return boolean *true* or *false*
13
+ module Assertions
14
+ GROUP_ELT_TAG = 'ul'
15
+ HEADER_ELT_TAG = 'h2'
16
+ RESULT_ELT_TAG = 'li'
16
17
 
17
18
  # == Stats
18
19
  #
@@ -30,7 +31,7 @@ module TddDeploy
30
31
  # Assertions all return true or false. The last parameter is always the assertions
31
32
  # message and is optional.
32
33
  #
33
- # assert(prediccate, msg) returns true if prediccate is true, else adds *msg*
34
+ # assert(key, prediccate, msg) returns true if prediccate is true, else adds *msg*
34
35
  # to failure messages and returns false
35
36
  def assert key, predicate, msg
36
37
  assert_primative key, predicate, msg
@@ -53,6 +54,7 @@ module TddDeploy
53
54
  assert_primative key, !value.nil?, msg
54
55
  end
55
56
 
57
+ # calls the block and passes only if 'block' raises 'exception'
56
58
  def assert_raises key, exception = Exception, msg, &block
57
59
  begin
58
60
  block.call
@@ -63,6 +65,7 @@ module TddDeploy
63
65
  fail key, msg
64
66
  end
65
67
 
68
+ # refute assertions are simple negations of the corresponding assert
66
69
  def refute key, predicate, msg
67
70
  assert_primative key, !predicate, msg
68
71
  end
@@ -70,11 +73,17 @@ module TddDeploy
70
73
  def refute_equal key, expect, value, msg
71
74
  assert_primative key, expect != value, msg
72
75
  end
76
+
77
+ def refute_nil key, predicate, msg
78
+ assert_primative key, !predicate, msg
79
+ end
73
80
 
81
+ # pass is used to insert a passing message for cases where an assertion is unnecessary
74
82
  def pass key, msg
75
83
  assert_primative key, true, msg
76
84
  end
77
85
 
86
+ # fail, like 'pass', is used to insert a failure message where an assertion is unnecessary
78
87
  def fail key, msg
79
88
  assert_primative key, false, msg
80
89
  end
@@ -92,6 +101,7 @@ module TddDeploy
92
101
  str
93
102
  end
94
103
 
104
+ private
95
105
  def formatted_test_results_for_key key
96
106
  str = "<#{GROUP_ELT_TAG} class=\"test-result-group\" id=\"test-result-group-#{key}\">\n<#{HEADER_ELT_TAG} class=\"test-result-header\" id=\"test-result-header-#{key}\">Results for '#{key}'</#{HEADER_ELT_TAG}>\n"
97
107
  if failure_count(key) == 0
@@ -105,12 +115,14 @@ module TddDeploy
105
115
  str + "</#{GROUP_ELT_TAG}>\n"
106
116
  end
107
117
 
118
+ public
119
+
108
120
  # test_results returns the test_results hash
109
121
  def test_results
110
122
  Stats.test_results
111
123
  end
112
124
 
113
- # reset_tests
125
+ # reset_tests clears all test results
114
126
  def reset_tests
115
127
  Stats.test_results = {}
116
128
  end
@@ -124,6 +136,7 @@ module TddDeploy
124
136
  Stats.test_results = tmp
125
137
  end
126
138
 
139
+ # total_failures: total number of failures accross all keys
127
140
  def total_failures
128
141
  count = 0
129
142
  Stats.test_results.values.each do |messages|
@@ -132,24 +145,32 @@ module TddDeploy
132
145
  count
133
146
  end
134
147
 
148
+ # total_tests: total number of tests accross all keys
135
149
  def total_tests
136
150
  Stats.test_results.values.reduce(0) { |memo, obj| memo += obj.length }
137
151
  end
138
152
 
153
+ # number of failures recorded under 'key'
139
154
  def failure_count(key)
140
155
  return nil unless Stats.test_results[key]
141
156
  failure_messages(key).length
142
157
  end
143
158
 
159
+ # number of tests recorded under 'key'
144
160
  def test_count(key)
145
161
  return nil unless Stats.test_results[key]
146
162
  Stats.test_results[key].length
147
163
  end
148
164
 
165
+ # all tests messages saved under 'key', returns an array of 2-element arrays.
166
+ # first element is 'true' or 'false' - indicates passed or failed
167
+ # second element is the success message
149
168
  def test_messages(key)
150
169
  Stats.test_results[key]
151
170
  end
152
171
 
172
+ # returns all failure messages in same format as 'test_messages(key)'.
173
+ # this is simply: Stats.test_results[key].select { |tmp| !tmp[0] }
153
174
  def failure_messages(key)
154
175
  Stats.test_results[key].select { |tmp| !tmp[0] }
155
176
  end
@@ -1,44 +1,32 @@
1
1
  require 'tdd_deploy/assertions'
2
2
  require 'tdd_deploy/environ'
3
3
  require 'tdd_deploy/run_methods'
4
+ require 'tdd_deploy/copy_methods'
4
5
  require 'tdd_deploy/deploy_test_methods'
5
- # = TddDeploy
6
- #
7
- # TddDeploy provides methods for testing the provisioning of remote hosts
8
- # and Rails instances running as virtual hosts
9
- #
10
- # Tests are simple to write.
11
- #
12
- # Step 1: require 'tdd_deploy' and then subclass TddDeploy::Base
13
- # Step 2: write tests using the methods: *run_on_all_hosts* and *run_on_all_hosts_as*
14
- # Step 3: run tests and fix installation until all tests pass
15
- #
16
- # These tests do not guarantee that anything will work. They only test to see if the files
17
- # are installed and that communication works to all hosts the site runs on.
18
- #
19
- # == TddDeploy::Base
20
- #
21
- # TddDeploy::Base is a class which includes all the TddDeploy modules
22
- # and initializes the environment.
23
- #
24
- # it is meant to be subclassed for individual host and site tests.
25
- #
26
- # class HostFacilityTest < TddDeploy::Base
27
- # def test_for_file
28
- # deploy_test_on_hosts_as user_id, match_string_or_regx, err_msg { command }
29
- # end
30
- # etc
31
- # end
32
- #
33
- # NOTE: Derived classes which provide an **initialize** method should call super
34
- # to ensure that the environment is set. See TddDeploy::Base to see what the
35
- # parent initializer does.
36
6
 
37
7
  module TddDeploy
8
+ # == TddDeploy::Base
9
+ #
10
+ # TddDeploy::Base is a class which includes all the TddDeploy modules
11
+ # and initializes the environment.
12
+ #
13
+ # it is meant to be subclassed for individual host and site tests.
14
+ #
15
+ # class HostFacilityTest < TddDeploy::Base
16
+ # def test_for_file
17
+ # deploy_test_on_hosts_as user_id, match_string_or_regx, err_msg { command }
18
+ # end
19
+ # etc
20
+ # end
21
+ #
22
+ # NOTE: Derived classes which provide an **initialize** method should call super
23
+ # to ensure that the environment is set. See TddDeploy::Base to see what the
24
+ # parent initializer does.
38
25
  class Base
39
26
  include TddDeploy::Assertions
40
27
  include TddDeploy::Environ
41
28
  include TddDeploy::RunMethods
29
+ include TddDeploy::CopyMethods
42
30
  include TddDeploy::DeployTestMethods
43
31
 
44
32
  # args are ignored, unless the args.last is a Hash. If it is passed to *set_env*.
@@ -7,14 +7,29 @@ require 'tdd_deploy/base'
7
7
  module TddDeploy
8
8
  # == TddDeployConfigurator
9
9
  #
10
- # TddDeployConfigurator is used to create site/host specific configuration files for
10
+ # NOTE: you generally do NOT use the TddDeploy::Configurator class directly. You will
11
+ # seed your configuration files using the supplied 'rake' task; edit, modify, delete,
12
+ # spindle, fold and mutilate as you please; and then, click the 'Run configurator'
13
+ # link in the server page.
14
+ #
15
+ # TddDeploy::Configurator is used to create site/host specific configuration files for
11
16
  # sites. The files are defined by templates in subdirectories of the 'site-erb' directory.
17
+ #
18
+ # templates are installed in your app's 'lib/tdd_deploy/site-erb' directory. There are
19
+ # three subdirectories - one for each server class: balance_hosts, db_hosts, and web_hosts.
20
+ #
21
+ # Templates actually reside in subdirectories which correspond to installation directories
22
+ # on the deployment hosts. Thus, templates for the 'config' directory for the 'balance_hosts'
23
+ # are in 'lib/tdd_deploy/site-erb/balance_hosts/config'
24
+ #
25
+ # I put other config files and executables in the directory 'site'. At present these are
26
+ # include files for 'nginx' and 'monit'.
27
+ #
12
28
  # At present there are templates in 'site-erb/config' and 'site-erb/site'. Rendered files
13
- # are written to corresponding subdirectories of the app. For example, 'site-erb/config/foo.erb'
14
- # will produce the file 'app/config/foo'
29
+ # are written to corresponding subdirectories of 'tdd_deploy_configs'
30
+ # in your application.
15
31
  #
16
- # files dropped into 'app/site/' are assumed to be executable, so their permissions are
17
- # set to 0755
32
+ # It's your problem to deal with file permission issues.
18
33
  class Configurator < TddDeploy::Base
19
34
  # install - reads all the templates in gem-home/site-erb, renders them using the
20
35
  # current environment context, and writes the renderings to the appropriate
@@ -2,8 +2,7 @@ require 'net/ssh'
2
2
  require 'net/sftp'
3
3
 
4
4
  module TddDeploy
5
- module RunMethods
6
-
5
+ module CopyMethods
7
6
  def copy_string_to_remote_file_on_hosts_as userid, host_list, str, dst
8
7
  result = true
9
8
  host_list = [host_list] if host_list.is_a? String
@@ -2,6 +2,19 @@ require 'tdd_deploy/assertions'
2
2
  require 'tdd_deploy/run_methods'
3
3
 
4
4
  module TddDeploy
5
+ # == TddDeploy::DeployTestMethods
6
+ #
7
+ # this module supplies the basic methods used to validate host installation structure.
8
+ #
9
+ # all methods expect the first two arguments to be 'userid' and 'host' or 'host-list'.
10
+ # the 'userid' is a userid which exists on the specified host.
11
+ # 'host' is a single host
12
+ # 'host-list' can be a single host (as a string) or an array of host names
13
+ # 'success_message' is what you will see in the report. I like positive messages, hence the name
14
+ #
15
+ # the most frequently used are 'deploy_test_process_running_on_hosts_as' and 'deploy_test_file_exists_on_hosts_as'.
16
+ #
17
+ # 'deploy_test_on_hosts_as' and 'deploy_test_in_ssh_session_as' are more primative and flexible.
5
18
  module DeployTestMethods
6
19
  include TddDeploy::Assertions
7
20
  include TddDeploy::RunMethods
@@ -15,10 +15,13 @@ module TddDeploy
15
15
  #
16
16
  # Environment variables:
17
17
  #
18
+ # All environment variables can be read or set via accessors - which are created
19
+ # dynamically. They do _not_ show up in the Yard doc.
20
+ #
18
21
  # === Integer variables
19
22
  # * 'ssh_timeout' - timeout in seconds used to terminate remote commands fired off by ssh
20
23
  # * 'site_base_port' - Base port for site servers. For example, if a pack of mongrels or thin
21
- # servers provide the rails end of the web site, they listen on 'site_base_port', +1, etd
24
+ #servers provide the rails end of the web site, they listen on 'site_base_port', +1, etd
22
25
  # * 'site_num_servers' - number of mongrels or thins to spin up
23
26
  #
24
27
  # === String variables
@@ -26,15 +29,22 @@ module TddDeploy
26
29
  # * 'local_admin' - user name of on local hosts which can ssh into remote hosts via public key authentication
27
30
  # * 'local_admin_email' - email of local admin who should receive monitoring emails
28
31
  # * 'site' - name of site This should satisfy /[a-z][a-z0-9_]*.
32
+ # * 'site_path' - the absolute path to DocumentRoot for the site
33
+ # * 'site_url' - the url for the site (w/o scheme - as in 'www.foo.com')
34
+ # * 'site_aliases' - aliases for the site. The delimiters will depend on your web server
29
35
  # * 'site_user' - name of site user. TddDeploy assumes that each site will have a unique user on the remote host.
30
36
  # this makes it easy to tell nginx and monit where to find configuration files for each site [both
31
37
  # know how to included globbed paths]
32
38
  #
33
39
  # === List Variables
34
- # * 'hosts' - list of all hosts - defaults to balance_hosts + db_hosts + web_hosts
35
40
  # * 'balance_hosts' - load balancing servers [may be empty, in which case 'hosts' is used]
36
41
  # * 'db_hosts' - hosts which run the database server [may be empty, in which case 'hosts' is used]
37
42
  # * 'web_hosts' - hosts which run the web server [may be empty, in which case 'hosts' is used]
43
+ #
44
+ # === Pseudo Variable
45
+ # * 'hosts' - list of all hosts - always returns balance_hosts + db_hosts + web_hosts.
46
+ #may be assigned to if all three host lists are identical, otherwise raises an exception.
47
+ # 'tdd_deploy_context' hides it from view unless it can be assigned
38
48
 
39
49
  module Environ
40
50
 
@@ -110,10 +120,12 @@ module TddDeploy
110
120
  'web_hosts' => 'arch',
111
121
  }
112
122
 
123
+ # Hash mapping environment variable to type
113
124
  def env_types
114
125
  DataCache.env_types
115
126
  end
116
127
 
128
+ # Hash of default values - which are hokey
117
129
  def env_defaults
118
130
  DataCache.env_defaults
119
131
  end
@@ -145,6 +157,7 @@ module TddDeploy
145
157
  end
146
158
  end
147
159
 
160
+ # clears the environment hash. Really - it's useless until re-initialized
148
161
  def clear_env
149
162
  DataCache.env_hash = {}
150
163
  end
@@ -202,6 +215,7 @@ module TddDeploy
202
215
  nil
203
216
  end
204
217
 
218
+ # bursts comma/space separated string into a sorted, unique array
205
219
  def str_to_list str
206
220
  case
207
221
  when str.is_a?(String) then str.split(/[\s,]+/).uniq.sort
@@ -211,11 +225,13 @@ module TddDeploy
211
225
  end
212
226
  end
213
227
 
228
+ # packs an array into a comma separated string
214
229
  def list_to_str key
215
230
  tmp = self.env_hash[key]
216
231
  tmp.is_a?(Array) ? tmp.join(',') : tmp.to_s
217
232
  end
218
233
 
234
+ public
219
235
  # saves the current environment in the current working directory in the file
220
236
  # 'site_host_setup.env' [aka TddDeploy::Environ::ENV_FNAME]
221
237
  def save_env
@@ -1,6 +1,9 @@
1
1
  require 'tdd_deploy/base'
2
2
 
3
3
  module TddDeploy
4
+ # == TddDeploy::HostConnection
5
+ #
6
+ # tests that hosts are pingable and that the current user can log in as both 'host_admin' and 'root'
4
7
  class HostConnection < TddDeploy::Base
5
8
  # ping - pings all hosts
6
9
  def ping
@@ -1,7 +1,7 @@
1
1
  require 'tdd_deploy/base'
2
2
 
3
3
  module TddDeploy
4
- # = TddDeploy::RemoteIpTables
4
+ # == TddDeploy::RemoteIpTables
5
5
  #
6
6
  # checks to see if iptables is working by attempting to connect to each host on a collection
7
7
  # of 'interesting' ports. the ports probed are: 20, 23, 25, 53, 5432, 2812
@@ -1,6 +1,9 @@
1
1
  require 'tdd_deploy/base'
2
2
 
3
3
  module TddDeploy
4
+ # == TddDeploy::RemoteMonit
5
+ #
6
+ # verifies monit executable is present and running on all hosts
4
7
  class RemoteMonit < TddDeploy::Base
5
8
  def test_monit_installed
6
9
  deploy_test_file_exists_on_hosts_as self.host_admin, self.hosts, '/usr/bin/monit', 'monit should be installed'
@@ -1,6 +1,9 @@
1
1
  require 'tdd_deploy/base'
2
2
 
3
3
  module TddDeploy
4
+ # == TddDeploy::RemoteNginx
5
+ #
6
+ # verifies Nginx executable is both present and running on web_hosts + balance_hosts
4
7
  class RemoteNginx < TddDeploy::Base
5
8
  def test_nginx_installed
6
9
  deploy_test_file_exists_on_hosts_as self.host_admin, self.web_hosts + self.balance_hosts, '/usr/sbin/nginx', "nginx should be installed"
@@ -1,6 +1,10 @@
1
1
  require 'tdd_deploy/base'
2
2
 
3
3
  module TddDeploy
4
+ # == TddDeploy::RemotePostfix
5
+ #
6
+ # verifies that postfix executable is installed, running and will accept mail to local_admin_mail
7
+ # on all hosts
4
8
  class RemotePostfix < TddDeploy::Base
5
9
  def test_postfix_installed
6
10
  deploy_test_file_exists_on_hosts_as 'root', self.hosts, '/usr/sbin/postfix', "postfix should be installed"
@@ -1,6 +1,9 @@
1
1
  require 'tdd_deploy/base'
2
2
 
3
3
  module TddDeploy
4
+ # == TddDeploy::RemotePostgresql
5
+ #
6
+ # verifies that the postgresql exectuable is both installed and running on db_hosts
4
7
  class RemotePostgresql < TddDeploy::Base
5
8
  def test_postgresql_installed
6
9
  deploy_test_file_exists_on_hosts_as 'root', self.db_hosts, "/usr/bin/postgres", 'postgres should be installed'
@@ -1,4 +1,7 @@
1
1
  module TddDeploy
2
+ # == TddDeploy::Engine
3
+ #
4
+ # brings in the rake tasks. Ignore it
2
5
  class Engine < Rails::Engine
3
6
  # engine_name "tdd_deploy"
4
7
  rake_tasks do
@@ -1,4 +1,16 @@
1
1
  module TddDeploy
2
+ # == TddDeploy::RunMethods
3
+ #
4
+ # supplies methods for running local and remote processes.
5
+ #
6
+ # remotely run processes require a userid and either a host or host-list.
7
+ # * 'userid' - is a remote userid which the local user can ssh into using public key
8
+ # * 'host' - a single host name
9
+ # * 'host_list' - single host name as string or Array of host names
10
+ # * 'cmd' - command as a string
11
+ # * 'block' - command as the result of a block. Use one or the other, but not both
12
+ #
13
+ # run_locally and ping_host are both run locally and don't need userid or host
2
14
  module RunMethods
3
15
  require 'net/ssh'
4
16
  require 'net/ping'
@@ -5,6 +5,10 @@ require 'uri'
5
5
  require 'tdd_deploy'
6
6
 
7
7
  module TddDeploy
8
+ # == TddDeploy::Server
9
+ #
10
+ # implements a simple 'rack' server. Methods are either used internally or called
11
+ # from the web page during page reloads.
8
12
  class Server < TddDeploy::Base
9
13
  LIB_DIR = File.expand_path('../..', __FILE__)
10
14
  HOST_TESTS_DIR = File.join(Dir.pwd, 'lib', 'tdd_deploy', 'host_tests')
@@ -14,6 +18,8 @@ module TddDeploy
14
18
 
15
19
  attr_accessor :test_classes, :query_hash, :failed_tests
16
20
 
21
+ # accepts env_hash arguments. It's just as easy to instantiate and then change
22
+ # the variables using self.set_env
17
23
  def initialize *args
18
24
  @already_defined = TddDeploy.constants
19
25
  load_all_tests
@@ -24,6 +30,34 @@ module TddDeploy
24
30
  super
25
31
  end
26
32
 
33
+ # rack interface. takes an env Hash and returns [code, headers, body]
34
+ def call(env)
35
+ self.query_hash = parse_query_string(env['QUERY_STRING'])
36
+
37
+ if query_hash['run_configurator']
38
+ require 'tdd_deploy/configurator'
39
+ configurator = TddDeploy::Configurator.new
40
+ configurator.make_configuration_files
41
+ end
42
+
43
+ if query_hash['failed-tests']
44
+ remove_failed_tests
45
+ run_selected_tests(query_hash['failed-tests'])
46
+ else
47
+ run_all_tests
48
+ end
49
+
50
+ query_string = new_query_string
51
+ body = [
52
+ render_results,
53
+ # "#{env.inspect}"
54
+ ]
55
+ return [200, {'Content-Length' => body.join('').length.to_s, 'Content-Type' => 'text/html'}, body]
56
+ end
57
+
58
+ # loads all files in 'lib/tdd_deploy/host_tests | site_tests | local_tests.
59
+ # both host_tests and site_tests are clobbered by the rake install task.
60
+ # local_tests is safe.
27
61
  def load_all_tests
28
62
  [TddDeploy::Server::HOST_TESTS_DIR, TddDeploy::Server::SITE_TESTS_DIR,
29
63
  TddDeploy::Server::LOCAL_TESTS_DIR].each do |dir|
@@ -49,25 +83,20 @@ module TddDeploy
49
83
  end
50
84
  end
51
85
 
52
- def run_all_tests(test_group = nil)
86
+ # Re-reads the environment and then runs all known tests.
87
+ def run_all_tests
53
88
  read_env
54
89
  reset_tests
55
90
 
56
- test_classes = if test_group && defined?(@test_classes_hash)
57
- failed_test_keys = test_group.split(',')
58
- @test_classes_hash.select { |k, v| failed_test_keys.include? k }.values
59
- else
60
- self.test_classes
61
- end
62
-
63
91
  ret = true
64
92
  @failed_tests = []
65
- test_classes.each do |klass|
93
+ self.test_classes.each do |klass|
66
94
  ret &= run_all_tests_in_class(klass)
67
95
  end
68
96
  ret
69
97
  end
70
98
 
99
+ # Re-reads the environment and then runs tests from 'test_list'
71
100
  def run_selected_tests(test_list)
72
101
  read_env
73
102
  ret = true
@@ -78,6 +107,9 @@ module TddDeploy
78
107
  ret
79
108
  end
80
109
 
110
+ private
111
+
112
+ # not presently used
81
113
  def run_all_tests_in_class klass
82
114
  read_env
83
115
  obj = klass.new
@@ -116,29 +148,6 @@ module TddDeploy
116
148
  str = "failed-tests=" + URI.escape(@failed_tests.join(',')) unless @failed_tests.nil? || @failed_tests.empty?
117
149
  end
118
150
 
119
- def call(env)
120
- self.query_hash = parse_query_string(env['QUERY_STRING'])
121
-
122
- if query_hash['run_configurator']
123
- require 'tdd_deploy/configurator'
124
- configurator = TddDeploy::Configurator.new
125
- configurator.make_configuration_files
126
- end
127
-
128
- if query_hash['failed-tests']
129
- remove_failed_tests
130
- run_selected_tests(query_hash['failed-tests'])
131
- else
132
- run_all_tests
133
- end
134
-
135
- query_string = new_query_string
136
- body = [
137
- render_results,
138
- # "#{env.inspect}"
139
- ]
140
- return [200, {'Content-Length' => body.join('').length.to_s, 'Content-Type' => 'text/html'}, body]
141
- end
142
151
  end
143
152
  end
144
153
 
@@ -3,17 +3,18 @@ require 'tdd_deploy/base'
3
3
  module TddDeploy
4
4
  # == TddDeploy::SiteLayout
5
5
  #
6
- # tests for the existence of several directories on all hosts as *site_user* in
7
- # the *site_user* home directory.
6
+ # tests for the existence of several directories on all hosts as *site_user* in
7
+ # the *site_user* home directory.
8
8
  #
9
- # The sub directories tested for are:
9
+ # The sub directories tested for are:
10
10
  #
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
- # proxy the site's *thin* servers
15
- # site/monitrc - a monit configuration fragment which tells monit how to monitor
16
- # the site's *thin* servers.
11
+ # * 'site_path' - DocumentRoot
12
+ # * 'site_path'/../releases - a standard directory used by Capistrano
13
+ # * 'site_path'/site/nginx.conf - an nginx configuratino fragment which tells nginx to proxy the site's *thin* servers
14
+ # * 'site_path'/site/monitrc - a monit configuration fragment which tells monit how to monitor the site's *thin* servers.
15
+ # * 'site_path'/config/thin.conf - config file for 'thin' server
16
+ # * 'site_path'/config/one_thin_server.conf - config file for monit to use to restart a single server instance
17
+ # * 'site_path'/site/one_thin_server - shell script to start a single server instance
17
18
  class SiteLayout < TddDeploy::Base
18
19
  def test_site_subdir
19
20
  deploy_test_file_exists_on_hosts_as self.site_user, self.web_hosts, "#{self.site_path}"
@@ -1,3 +1,3 @@
1
1
  module TddDeploy
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
data/lib/tdd_deploy.rb CHANGED
@@ -10,3 +10,27 @@ require 'tdd_deploy/version'
10
10
  if defined? Rails
11
11
  require 'tdd_deploy/railengine'
12
12
  end
13
+
14
+ # = TddDeploy
15
+ #
16
+ # TddDeploy provides methods for testing the provisioning of remote hosts
17
+ # and Rails instances running as virtual hosts
18
+ #
19
+ # Tests are simple to write.
20
+ #
21
+ # Step 1: require 'tdd_deploy' and then subclass TddDeploy::Base
22
+ # Step 2: write tests using the methods: *run_on_all_hosts* and *run_on_all_hosts_as*
23
+ # Step 3: run tests and fix installation until all tests pass
24
+ #
25
+ # These tests do not guarantee that anything will work. They only test to see if the files
26
+ # are installed and that communication works to all hosts the site runs on.
27
+ #
28
+ # see the tdd_deploy gem Readme file for more information.
29
+ #
30
+ # see HostSetup.md and SiteSetup.md for info on setting up Arch linux servers and Rails
31
+ # apps running on them. Both of these documents are out of sync with respect to the rest
32
+ # of tdd_deploy: make the 'obvious' translation between shell script variables and
33
+ # tdd_deploy environment keys.
34
+
35
+ module TddDeploy
36
+ end
@@ -7,6 +7,7 @@ require 'tdd_deploy/copy_methods'
7
7
  class RunMethodsTestCase < Test::Unit::TestCase
8
8
  include TddDeploy::Environ
9
9
  include TddDeploy::RunMethods
10
+ include TddDeploy::CopyMethods
10
11
 
11
12
  def setup
12
13
  self.reset_env
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.2
4
+ version: 0.1.3
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: &2164703420 !ruby/object:Gem::Requirement
16
+ requirement: &2153409860 !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: *2164703420
24
+ version_requirements: *2153409860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: net-ping
27
- requirement: &2164702780 !ruby/object:Gem::Requirement
27
+ requirement: &2153409060 !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: *2164702780
35
+ version_requirements: *2153409060
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: net-ssh
38
- requirement: &2164702200 !ruby/object:Gem::Requirement
38
+ requirement: &2153397720 !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: *2164702200
46
+ version_requirements: *2153397720
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: ZenTest
49
- requirement: &2164701580 !ruby/object:Gem::Requirement
49
+ requirement: &2153397080 !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: *2164701580
57
+ version_requirements: *2153397080
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: autotest-growl
60
- requirement: &2164701040 !ruby/object:Gem::Requirement
60
+ requirement: &2153396520 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2164701040
68
+ version_requirements: *2153396520
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 '