sauron 0.1.17 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,77 @@
1
+ = Sauron
2
+
3
+ The all-seeing testing toolkit with many workers. Think multi-threaded, multi-database autotest. It continually watches your application for code changes like autotest, then runs them multi-threaded, each thread having its own database, to take maximum advantage of your computer's multiple cores/processors. Fast!
4
+
5
+ == Why a new testing toolkit?
6
+
7
+ For a long time, my holy grail of testing has been multi-threaded autotest. Autotest is awesome, watching my application in real time and only running tests for code that has changed. But it doesn't take advantage of the growing number of cores and processors that computers have today.
8
+
9
+ Parallel_specs solves the multi-threaded, multi-database problem, but it has to be run manually, and runs all your tests at once. It also doesn't split up the test suite very efficiently, resulting in one thread finishing significantly sooner than the other.
10
+
11
+ == How does it work?
12
+
13
+ Sauron uses the watchr gem to watch your rails files for changes, and runs only the tests related to those changes. Sauron comes with a basic, but user-changeable, watchr script. This part is much like autotest.
14
+
15
+ When Sauron detects that tests need to be run, it runs single tests with a direct ruby command. If there are multiple files, however, it kicks off a customized version of the hydra gem, creating multiple workers to run pieces of the test suite efficiently.
16
+
17
+ == How do I use it?
18
+
19
+ WARNING: This is still a *very* new gem (only in existence since July 17th, 2010). Use very carefully.
20
+
21
+ === Include the gems
22
+
23
+ The first step is to include the necessary gems in your config/environments/test.rb file:
24
+
25
+ config.gem 'sauron'
26
+ config.gem 'bellmyer-hydra', :lib => 'hydra'
27
+
28
+ The first is the Sauron gem, and the second is a fork of the Hydra gem that I modified to support multiple databases.
29
+
30
+ === Edit your database configuration
31
+
32
+ Edit your config/database.yml so that your test database name includes the worker number environment variable. Here's an example:
33
+
34
+ test:
35
+ adapter: mysql
36
+ database: app_test<%= ENV['HYDRA_WORKER_ID'] %>
37
+
38
+ Or for sqlite3:
39
+
40
+ test:
41
+ adapter: sqlite3
42
+ database: app_test<%= ENV['HYDRA_WORKER_ID'] %>.sqlite3
43
+
44
+ === Run the Sauron generator
45
+
46
+ ruby script/generate sauron
47
+
48
+ By default, it will create a setup with 4 workers (threads/databases used during tests) and assume you are using testunit. You can change both of these with commandline arguments:
49
+
50
+ ruby script/generate sauron --workers=10 --rspec
51
+
52
+ If you ever change your mind, just edit the config/sauron.yml file.
53
+
54
+ === Run Sauron
55
+
56
+ While developing your rails app, run:
57
+
58
+ ruby script/sauron
59
+
60
+ which will launch Sauron and watch your app. Ta-da! Multi-threaded, multi-database, automatic testing goodness!
61
+
62
+ == For advanced users
63
+
64
+ The generator creates a watchr script called sauron_watchr.rb in the root directory of your app. I think it has a good basic setup, but customize it all you want.
65
+
66
+ == For really advanced users
67
+
68
+ Help me make this tool better. Fork it, fix it, send a pull request. My low public profile and crippling need acceptance ensure you'll get a prompt, friendly response.
69
+
70
+ == Caveats
71
+
72
+ This is very new. I can't see how it would damage anything, but I guess that's what everyone says before they damage something. Also, I've traditionally used shoulda over rspec, so there may be glitches in what files Sauron watches/runs in rspec mode. If you see something wrong, let me know.
73
+
74
+ This was put together quickly. If you don't feel like the underlying code is beautiful, this was largely hacked together during Ruby Midwest weekend, during hours that should have been used for sleeping.
75
+
76
+
77
+ Copyright (c) 2010 Jaime Bellmyer, released under the MIT license
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.17
1
+ 0.1.18
@@ -1,6 +1,6 @@
1
1
  class SauronGenerator < Rails::Generator::Base
2
2
  def manifest
3
- options[:runners] ||= 4
3
+ options[:workers] ||= 4
4
4
 
5
5
  options[:rspec] ||= false
6
6
  options[:testunit] ||= false
@@ -26,7 +26,7 @@ class SauronGenerator < Rails::Generator::Base
26
26
  protected
27
27
 
28
28
  def add_options!(opt)
29
- opt.on('--runners='){|v| options[:runners] = v}
29
+ opt.on('--workers='){|v| options[:workers] = v}
30
30
  opt.on('--rspec'){|v| options[:rspec] = v}
31
31
  opt.on('--testunit'){|v| options[:testunit] = v}
32
32
  end
@@ -1,2 +1,2 @@
1
- :workers: <%= options[:runners] %>
1
+ :workers: <%= options[:workers] %>
2
2
  :framework: <%= options[:framework] %>
data/sauron.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sauron}
8
- s.version = "0.1.17"
8
+ s.version = "0.1.18"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jaime Bellmyer"]
@@ -13,11 +13,11 @@ Gem::Specification.new do |s|
13
13
  s.description = %q{Speed up your automated tests with multiple databases and workers.}
14
14
  s.email = %q{jaime@kconrails.com}
15
15
  s.extra_rdoc_files = [
16
- "README"
16
+ "README.rdoc"
17
17
  ]
18
18
  s.files = [
19
19
  "MIT-LICENSE",
20
- "README",
20
+ "README.rdoc",
21
21
  "Rakefile",
22
22
  "VERSION",
23
23
  "generators/sauron/USAGE",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sauron
3
3
  version: !ruby/object:Gem::Version
4
- hash: 57
4
+ hash: 63
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 17
10
- version: 0.1.17
9
+ - 18
10
+ version: 0.1.18
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jaime Bellmyer
@@ -56,10 +56,10 @@ executables: []
56
56
  extensions: []
57
57
 
58
58
  extra_rdoc_files:
59
- - README
59
+ - README.rdoc
60
60
  files:
61
61
  - MIT-LICENSE
62
- - README
62
+ - README.rdoc
63
63
  - Rakefile
64
64
  - VERSION
65
65
  - generators/sauron/USAGE
data/README DELETED
@@ -1,13 +0,0 @@
1
- Sauron
2
- ======
3
-
4
- Introduction goes here.
5
-
6
-
7
- Example
8
- =======
9
-
10
- Example goes here.
11
-
12
-
13
- Copyright (c) 2010 [name of plugin creator], released under the MIT license