sauron 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README +13 -0
- data/Rakefile +39 -0
- data/VERSION +1 -0
- data/generators/sauron/USAGE +0 -0
- data/generators/sauron/sauron_generator.rb +21 -0
- data/generators/sauron/templates/config/hydra.yml +3 -0
- data/generators/sauron/templates/lib/sauron/watchr.rb +91 -0
- data/generators/sauron/templates/sauron_watchr.rb +16 -0
- data/generators/sauron/templates/test_helper.rb +1 -0
- data/sauron.gemspec +60 -0
- data/tasks/sauron_tasks.rake +10 -0
- data/test/sauron_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- metadata +111 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Jaime Bellmyer
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the sauron plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.libs << 'test'
|
12
|
+
t.pattern = 'test/**/*_test.rb'
|
13
|
+
t.verbose = true
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate documentation for the sauron plugin.'
|
17
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
+
rdoc.rdoc_dir = 'rdoc'
|
19
|
+
rdoc.title = 'Sauron'
|
20
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
+
rdoc.rdoc_files.include('README')
|
22
|
+
end
|
23
|
+
|
24
|
+
begin
|
25
|
+
require 'jeweler'
|
26
|
+
Jeweler::Tasks.new do |gem|
|
27
|
+
gem.name = "sauron"
|
28
|
+
gem.summary = %Q{Multi-threaded, automated testing toolkit}
|
29
|
+
gem.description = %Q{Speed up your automated tests with multiple databases and workers.}
|
30
|
+
gem.email = "jaime@kconrails.com"
|
31
|
+
gem.homepage = "http://github.com/bellmyer/sauron"
|
32
|
+
gem.authors = ['Jaime Bellmyer']
|
33
|
+
gem.add_development_dependency "bellmyer-hydra", ">= 0.20.9"
|
34
|
+
gem.add_development_dependency "watchr", ">= 0.6"
|
35
|
+
end
|
36
|
+
Jeweler::GemcutterTasks.new
|
37
|
+
rescue LoadError
|
38
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
39
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
File without changes
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class SauronGenerator < Rails::Generator::Base
|
2
|
+
def manifest
|
3
|
+
options[:runners] ||= 4
|
4
|
+
|
5
|
+
record do |m|
|
6
|
+
m.file 'sauron_watchr.rb', 'sauron_watchr.rb'
|
7
|
+
m.file 'test_helper.rb', 'test_helper.rb'
|
8
|
+
|
9
|
+
m.template 'config/hydra.yml', 'config/hydra.yml'
|
10
|
+
|
11
|
+
m.directory 'lib/sauron'
|
12
|
+
m.file 'lib/sauron/watchr.rb', 'lib/sauron/watchr.rb'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
def add_options!(opt)
|
19
|
+
opt.on('--runners='){|v| options[:runners] = v}
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
def set_hydra
|
4
|
+
$hydra = !!(`rake -T` =~ /rake hydra:sauron\s+/)
|
5
|
+
end
|
6
|
+
|
7
|
+
def run_routing_tests
|
8
|
+
message "running routing tests"
|
9
|
+
run_multiple_tests routing_tests
|
10
|
+
end
|
11
|
+
|
12
|
+
def run_single_test file
|
13
|
+
message "running #{file}"
|
14
|
+
system "time ruby -I.:lib:test -rubygems -e \"require '#{file}'\""
|
15
|
+
end
|
16
|
+
|
17
|
+
def run_multiple_tests *files
|
18
|
+
joined_files = files.join(',')
|
19
|
+
|
20
|
+
message "running #{files.first.size} tests: #{joined_files}"
|
21
|
+
|
22
|
+
if $hydra
|
23
|
+
system "time rake hydra:sauron RAILS_ENV=test FILE_LIST=#{joined_files}"
|
24
|
+
else
|
25
|
+
system "time ruby -I.:lib:test -rubygems -e \"%w[#{files.join(' ')}].each {|f| require f}\""
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_all_tests
|
30
|
+
message "running all tests"
|
31
|
+
run_multiple_tests all_tests
|
32
|
+
end
|
33
|
+
|
34
|
+
def unit_tests
|
35
|
+
Dir.glob('test/unit/*_test.rb')
|
36
|
+
end
|
37
|
+
|
38
|
+
def helper_tests
|
39
|
+
Dir.glob('test/unit/helpers/*_test.rb')
|
40
|
+
end
|
41
|
+
|
42
|
+
def functional_tests
|
43
|
+
Dir.glob('test/functional/*_test.rb')
|
44
|
+
end
|
45
|
+
|
46
|
+
def routing_tests
|
47
|
+
Dir.glob('test/unit/rout{es,ing}_test.rb')
|
48
|
+
end
|
49
|
+
|
50
|
+
def all_tests
|
51
|
+
Dir.glob('test/**/*_test.rb')
|
52
|
+
end
|
53
|
+
|
54
|
+
def message body
|
55
|
+
system 'clear'
|
56
|
+
puts body
|
57
|
+
end
|
58
|
+
|
59
|
+
def setup_databases
|
60
|
+
# Find the number of runners #
|
61
|
+
runners = 0
|
62
|
+
hydra_yaml = YAML.load_file('config/hydra.yml')
|
63
|
+
hydra_yaml['workers'].each do |worker|
|
64
|
+
runners = worker['runners'] if worker['runners'] > runners && worker['type'] == 'local'
|
65
|
+
end
|
66
|
+
|
67
|
+
print "setting up #{runners} databases"
|
68
|
+
STDOUT.flush
|
69
|
+
|
70
|
+
# setup each database #
|
71
|
+
runners.times do |i|
|
72
|
+
print '.'
|
73
|
+
STDOUT.flush
|
74
|
+
|
75
|
+
i = '' if i == 0
|
76
|
+
`rake db:reset RAILS_ENV=test TEST_ENV_NUMBER=#{i}`
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def startup
|
81
|
+
set_hydra
|
82
|
+
setup_databases
|
83
|
+
run_all_tests
|
84
|
+
end
|
85
|
+
|
86
|
+
Signal.trap('QUIT') do
|
87
|
+
run_all_tests
|
88
|
+
end
|
89
|
+
|
90
|
+
# Startup #
|
91
|
+
startup
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'lib/sauron/watchr'
|
2
|
+
|
3
|
+
# Unit tests #
|
4
|
+
watch('test/unit/.*_test\.rb'){|f| run_single_test f[0]}
|
5
|
+
watch('app/models/(.*)\.rb'){|f| run_single_test "test/unit/#{f[1]}_test.rb"}
|
6
|
+
|
7
|
+
# Functional tests #
|
8
|
+
watch('test/functional/.*_test\.rb'){|f| run_single_test f[0]}
|
9
|
+
watch('app/controllers/(.*)\.rb'){|f| run_single_test "test/functional/#{f[1]}_test.rb"}
|
10
|
+
watch('app/views/(.*)/.*\.html.erb'){|f| run_single_test "test/functional/#{f[1]}_controller_test.rb"}
|
11
|
+
|
12
|
+
# Routing tests #
|
13
|
+
watch('config/routes.rb'){|f| run_routing_tests }
|
14
|
+
|
15
|
+
# Multiple tests #
|
16
|
+
watch('test/test_helper.rb'){|f| run_all_tests }
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'test/test_helper'
|
data/sauron.gemspec
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{sauron}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Jaime Bellmyer"]
|
12
|
+
s.date = %q{2010-07-18}
|
13
|
+
s.description = %q{Speed up your automated tests with multiple databases and workers.}
|
14
|
+
s.email = %q{jaime@kconrails.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"generators/sauron/USAGE",
|
24
|
+
"generators/sauron/sauron_generator.rb",
|
25
|
+
"generators/sauron/templates/config/hydra.yml",
|
26
|
+
"generators/sauron/templates/lib/sauron/watchr.rb",
|
27
|
+
"generators/sauron/templates/sauron_watchr.rb",
|
28
|
+
"generators/sauron/templates/test_helper.rb",
|
29
|
+
"sauron.gemspec",
|
30
|
+
"tasks/sauron_tasks.rake",
|
31
|
+
"test/sauron_test.rb",
|
32
|
+
"test/test_helper.rb"
|
33
|
+
]
|
34
|
+
s.homepage = %q{http://github.com/bellmyer/sauron}
|
35
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
s.rubygems_version = %q{1.3.7}
|
38
|
+
s.summary = %q{Multi-threaded, automated testing toolkit}
|
39
|
+
s.test_files = [
|
40
|
+
"test/sauron_test.rb",
|
41
|
+
"test/test_helper.rb"
|
42
|
+
]
|
43
|
+
|
44
|
+
if s.respond_to? :specification_version then
|
45
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
46
|
+
s.specification_version = 3
|
47
|
+
|
48
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
+
s.add_development_dependency(%q<bellmyer-hydra>, [">= 0.20.9"])
|
50
|
+
s.add_development_dependency(%q<watchr>, [">= 0.6"])
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<bellmyer-hydra>, [">= 0.20.9"])
|
53
|
+
s.add_dependency(%q<watchr>, [">= 0.6"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<bellmyer-hydra>, [">= 0.20.9"])
|
57
|
+
s.add_dependency(%q<watchr>, [">= 0.6"])
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
data/test/sauron_test.rb
ADDED
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sauron
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Jaime Bellmyer
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-07-18 00:00:00 -05:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: bellmyer-hydra
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 93
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 20
|
33
|
+
- 9
|
34
|
+
version: 0.20.9
|
35
|
+
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: watchr
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
- 6
|
49
|
+
version: "0.6"
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
description: Speed up your automated tests with multiple databases and workers.
|
53
|
+
email: jaime@kconrails.com
|
54
|
+
executables: []
|
55
|
+
|
56
|
+
extensions: []
|
57
|
+
|
58
|
+
extra_rdoc_files:
|
59
|
+
- README
|
60
|
+
files:
|
61
|
+
- MIT-LICENSE
|
62
|
+
- README
|
63
|
+
- Rakefile
|
64
|
+
- VERSION
|
65
|
+
- generators/sauron/USAGE
|
66
|
+
- generators/sauron/sauron_generator.rb
|
67
|
+
- generators/sauron/templates/config/hydra.yml
|
68
|
+
- generators/sauron/templates/lib/sauron/watchr.rb
|
69
|
+
- generators/sauron/templates/sauron_watchr.rb
|
70
|
+
- generators/sauron/templates/test_helper.rb
|
71
|
+
- sauron.gemspec
|
72
|
+
- tasks/sauron_tasks.rake
|
73
|
+
- test/sauron_test.rb
|
74
|
+
- test/test_helper.rb
|
75
|
+
has_rdoc: true
|
76
|
+
homepage: http://github.com/bellmyer/sauron
|
77
|
+
licenses: []
|
78
|
+
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options:
|
81
|
+
- --charset=UTF-8
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 3
|
99
|
+
segments:
|
100
|
+
- 0
|
101
|
+
version: "0"
|
102
|
+
requirements: []
|
103
|
+
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 1.3.7
|
106
|
+
signing_key:
|
107
|
+
specification_version: 3
|
108
|
+
summary: Multi-threaded, automated testing toolkit
|
109
|
+
test_files:
|
110
|
+
- test/sauron_test.rb
|
111
|
+
- test/test_helper.rb
|