parallel_tests 0.4.6 → 0.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +5 -3
- data/VERSION +1 -1
- data/lib/parallel_tests/tasks.rb +68 -0
- data/lib/tasks/parallel_tests.rake +1 -68
- data/parallel_tests.gemspec +2 -1
- metadata +3 -2
data/Readme.md
CHANGED
@@ -8,7 +8,7 @@ Setup for Rails
|
|
8
8
|
As gem
|
9
9
|
sudo gem install parallel_tests
|
10
10
|
# add to Gemfile
|
11
|
-
gem "parallel_tests"
|
11
|
+
gem "parallel_tests", :group=>:development
|
12
12
|
|
13
13
|
OR as plugin
|
14
14
|
sudo gem install parallel
|
@@ -18,8 +18,10 @@ OR as plugin
|
|
18
18
|
|
19
19
|
As gem
|
20
20
|
sudo gem install parallel_tests
|
21
|
-
# add to config/
|
21
|
+
# add to config/environments/development.rb
|
22
22
|
config.gem "parallel_tests"
|
23
|
+
# add to Rakefile
|
24
|
+
begin; require 'parallel_tests/tasks'; rescue LoadError; end
|
23
25
|
|
24
26
|
OR as plugin
|
25
27
|
|
@@ -126,7 +128,7 @@ Authors
|
|
126
128
|
====
|
127
129
|
inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-parallelize-your-rspec-suite)
|
128
130
|
|
129
|
-
###Contributors
|
131
|
+
### [Contributors](http://github.com/grosser/parallel_tests/contributors)
|
130
132
|
- [Charles Finkel](http://charlesfinkel.com/)
|
131
133
|
- [Indrek Juhkam](http://urgas.eu)
|
132
134
|
- [Jason Morrison](http://jayunit.net)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.7
|
@@ -0,0 +1,68 @@
|
|
1
|
+
namespace :parallel do
|
2
|
+
def run_in_parallel(cmd, options)
|
3
|
+
count = (options[:count] ? options[:count].to_i : nil)
|
4
|
+
executable = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')
|
5
|
+
command = "#{executable} --exec '#{cmd}' -n #{count}"
|
6
|
+
abort unless system(command)
|
7
|
+
end
|
8
|
+
|
9
|
+
desc "create test databases by running db:create for each test db --> parallel:create[num_cpus]"
|
10
|
+
task :create, :count do |t,args|
|
11
|
+
run_in_parallel('rake db:create RAILS_ENV=test', args)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "update test databases by running db:test:prepare for each test db --> parallel:prepare[num_cpus]"
|
15
|
+
task :prepare, :count do |t,args|
|
16
|
+
run_in_parallel('rake db:test:prepare', args)
|
17
|
+
end
|
18
|
+
|
19
|
+
# when dumping/resetting takes too long
|
20
|
+
desc "update test databases by running db:mgrate for each test db --> parallel:migrate[num_cpus]"
|
21
|
+
task :migrate, :count do |t,args|
|
22
|
+
run_in_parallel('rake db:migrate RAILS_ENV=test', args)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Do not want a development db on integration server.
|
26
|
+
# and always dump a complete schema ?
|
27
|
+
desc "load dumped schema for each test db --> parallel:load_schema[num_cpus]"
|
28
|
+
task :load_schema, :count do |t,args|
|
29
|
+
run_in_parallel('rake db:schema:load RAILS_ENV=test', args)
|
30
|
+
end
|
31
|
+
|
32
|
+
['test', 'spec', 'features'].each do |type|
|
33
|
+
desc "run #{type} in parallel with parallel:#{type}[num_cpus]"
|
34
|
+
task type, :count, :path_prefix, :options do |t,args|
|
35
|
+
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
36
|
+
require "parallel_tests"
|
37
|
+
count, prefix, options = ParallelTests.parse_rake_args(args)
|
38
|
+
executable = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')
|
39
|
+
command = "#{executable} --type #{type} -n #{count} -p '#{prefix}' -r '#{Rails.root}' -o '#{options}'"
|
40
|
+
abort unless system(command) # allow to chain tasks e.g. rake parallel:spec parallel:features
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
#backwards compatability
|
46
|
+
#spec:parallel:prepare
|
47
|
+
#spec:parallel
|
48
|
+
#test:parallel
|
49
|
+
namespace :spec do
|
50
|
+
namespace :parallel do
|
51
|
+
task :prepare, :count do |t,args|
|
52
|
+
$stderr.puts "WARNING -- Deprecated! use parallel:prepare"
|
53
|
+
Rake::Task['parallel:prepare'].invoke(args[:count])
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
task :parallel, :count, :path_prefix do |t,args|
|
58
|
+
$stderr.puts "WARNING -- Deprecated! use parallel:spec"
|
59
|
+
Rake::Task['parallel:spec'].invoke(args[:count], args[:path_prefix])
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
namespace :test do
|
64
|
+
task :parallel, :count, :path_prefix do |t,args|
|
65
|
+
$stderr.puts "WARNING -- Deprecated! use parallel:test"
|
66
|
+
Rake::Task['parallel:test'].invoke(args[:count], args[:path_prefix])
|
67
|
+
end
|
68
|
+
end
|
@@ -1,68 +1 @@
|
|
1
|
-
|
2
|
-
def run_in_parallel(cmd, options)
|
3
|
-
count = (options[:count] ? options[:count].to_i : nil)
|
4
|
-
executable = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')
|
5
|
-
command = "#{executable} --exec '#{cmd}' -n #{count}"
|
6
|
-
abort unless system(command)
|
7
|
-
end
|
8
|
-
|
9
|
-
desc "create test databases by running db:create for each test db --> parallel:create[num_cpus]"
|
10
|
-
task :create, :count do |t,args|
|
11
|
-
run_in_parallel('rake db:create RAILS_ENV=test', args)
|
12
|
-
end
|
13
|
-
|
14
|
-
desc "update test databases by running db:test:prepare for each test db --> parallel:prepare[num_cpus]"
|
15
|
-
task :prepare, :count do |t,args|
|
16
|
-
run_in_parallel('rake db:test:prepare', args)
|
17
|
-
end
|
18
|
-
|
19
|
-
# when dumping/resetting takes too long
|
20
|
-
desc "update test databases by running db:mgrate for each test db --> parallel:migrate[num_cpus]"
|
21
|
-
task :migrate, :count do |t,args|
|
22
|
-
run_in_parallel('rake db:migrate RAILS_ENV=test', args)
|
23
|
-
end
|
24
|
-
|
25
|
-
# Do not want a development db on integration server.
|
26
|
-
# and always dump a complete schema ?
|
27
|
-
desc "load dumped schema for each test db --> parallel:load_schema[num_cpus]"
|
28
|
-
task :load_schema, :count do |t,args|
|
29
|
-
run_in_parallel('rake db:schema:load RAILS_ENV=test', args)
|
30
|
-
end
|
31
|
-
|
32
|
-
['test', 'spec', 'features'].each do |type|
|
33
|
-
desc "run #{type} in parallel with parallel:#{type}[num_cpus]"
|
34
|
-
task type, :count, :path_prefix, :options do |t,args|
|
35
|
-
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
36
|
-
require "parallel_tests"
|
37
|
-
count, prefix, options = ParallelTests.parse_rake_args(args)
|
38
|
-
executable = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')
|
39
|
-
command = "#{executable} --type #{type} -n #{count} -p '#{prefix}' -r '#{Rails.root}' -o '#{options}'"
|
40
|
-
abort unless system(command) # allow to chain tasks e.g. rake parallel:spec parallel:features
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
#backwards compatability
|
46
|
-
#spec:parallel:prepare
|
47
|
-
#spec:parallel
|
48
|
-
#test:parallel
|
49
|
-
namespace :spec do
|
50
|
-
namespace :parallel do
|
51
|
-
task :prepare, :count do |t,args|
|
52
|
-
$stderr.puts "WARNING -- Deprecated! use parallel:prepare"
|
53
|
-
Rake::Task['parallel:prepare'].invoke(args[:count])
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
task :parallel, :count, :path_prefix do |t,args|
|
58
|
-
$stderr.puts "WARNING -- Deprecated! use parallel:spec"
|
59
|
-
Rake::Task['parallel:spec'].invoke(args[:count], args[:path_prefix])
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
namespace :test do
|
64
|
-
task :parallel, :count, :path_prefix do |t,args|
|
65
|
-
$stderr.puts "WARNING -- Deprecated! use parallel:test"
|
66
|
-
Rake::Task['parallel:test'].invoke(args[:count], args[:path_prefix])
|
67
|
-
end
|
68
|
-
end
|
1
|
+
require File.join(File.dirname(__FILE__), "/../parallel_tests/tasks")
|
data/parallel_tests.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{parallel_tests}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
"lib/parallel_tests.rb",
|
27
27
|
"lib/parallel_tests/grouper.rb",
|
28
28
|
"lib/parallel_tests/railtie.rb",
|
29
|
+
"lib/parallel_tests/tasks.rb",
|
29
30
|
"lib/tasks/parallel_tests.rake",
|
30
31
|
"parallel_tests.gemspec",
|
31
32
|
"spec/integration_spec.rb",
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 7
|
9
|
+
version: 0.4.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Grosser
|
@@ -53,6 +53,7 @@ files:
|
|
53
53
|
- lib/parallel_tests.rb
|
54
54
|
- lib/parallel_tests/grouper.rb
|
55
55
|
- lib/parallel_tests/railtie.rb
|
56
|
+
- lib/parallel_tests/tasks.rb
|
56
57
|
- lib/tasks/parallel_tests.rake
|
57
58
|
- parallel_tests.gemspec
|
58
59
|
- spec/integration_spec.rb
|