parallel_tests 0.4.5 → 0.4.6

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/Rakefile CHANGED
@@ -4,14 +4,13 @@ Spec::Rake::SpecTask.new {|t| t.spec_opts = ['--color --backtrace']}
4
4
 
5
5
  begin
6
6
  require 'jeweler'
7
- project_name = 'parallel_tests'
8
7
  Jeweler::Tasks.new do |gem|
9
- gem.name = project_name
10
- gem.summary = "Run tests / specs / features in parallel"
11
- gem.email = "grosser.michael@gmail.com"
12
- gem.homepage = "http://github.com/grosser/#{project_name}"
13
- gem.authors = ["Michael Grosser"]
14
- gem.add_dependency ['parallel']
8
+ gem.name = "parallel_tests"
9
+ gem.summary = "Run tests / specs / features in parallel"
10
+ gem.email = "grosser.michael@gmail.com"
11
+ gem.homepage = "http://github.com/grosser/#{gem.name}"
12
+ gem.authors = "Michael Grosser"
13
+ gem.add_dependency "parallel"
15
14
  end
16
15
 
17
16
  Jeweler::GemcutterTasks.new
@@ -3,17 +3,36 @@ Speedup Test::Unit + RSpec + Cucumber by running parallel on multiple CPUs.
3
3
  Setup for Rails
4
4
  ===============
5
5
 
6
+ ## Install
7
+ ### Rails 3
8
+ As gem
9
+ sudo gem install parallel_tests
10
+ # add to Gemfile
11
+ gem "parallel_tests"
12
+
13
+ OR as plugin
6
14
  sudo gem install parallel
7
- script/plugin install git://github.com/grosser/parallel_tests.git
15
+ rails plugin install git://github.com/grosser/parallel_tests.git
16
+
17
+ ### Rails 2
18
+
19
+ As gem
20
+ sudo gem install parallel_tests
21
+ # add to config/environment.rb
22
+ config.gem "parallel_tests"
8
23
 
24
+ OR as plugin
25
+
26
+ sudo gem install parallel
27
+ ./script/plugin install git://github.com/grosser/parallel_tests.git
28
+
29
+ ## Setup
9
30
  ### 1: Add to `config/database.yml`
10
31
  test:
11
32
  database: xxx_test<%= ENV['TEST_ENV_NUMBER'] %>
12
33
 
13
34
  ### 2: Create additional database(s)
14
- script/db_console
15
- create database xxx_test2;
16
- ...
35
+ rake parallel:create
17
36
 
18
37
  ### 3: Copy development schema (repeat after migrations)
19
38
  rake parallel:prepare
@@ -95,14 +114,13 @@ TIPS
95
114
  - [RSpec] if `script/spec` is missing parallel:spec uses just `spec` (which solves some issues with double-loaded environment.rb)
96
115
  - [RSpec] 'script/spec_server' or [spork](http://github.com/timcharper/spork/tree/master) do not work in parallel
97
116
  - [RSpec] `./script/generate rspec` if you are running rspec from gems (this plugin uses script/spec which may fail if rspec files are outdated)
98
- - [Bundler] if you have a `.bundle/environment.rb` then `bundle exec xxx` will be used to run tests
117
+ - [Bundler] if you have a `Gemfile` then `bundle exec` will be used to run tests
99
118
  - with zsh this would be `rake "parallel:prepare[3]"`
100
119
 
101
120
  TODO
102
121
  ====
103
- - build parallel:bootstrap [idea/basics](http://github.com/garnierjm/parallel_specs/commit/dd8005a2639923dc5adc6400551c4dd4de82bf9a)
104
122
  - make jRuby compatible [basics](http://yehudakatz.com/2009/07/01/new-rails-isolation-testing/)
105
- - make windows compatible (does anyone care ?)
123
+ - make windows compatible
106
124
 
107
125
  Authors
108
126
  ====
@@ -122,6 +140,7 @@ inspired by [pivotal labs](http://pivotallabs.com/users/miked/blog/articles/849-
122
140
  - [Tchandy](http://thiagopradi.net/)
123
141
  - [Terence Lee](http://hone.heroku.com/)
124
142
  - [Will Bryant](http://willbryant.net/)
143
+ - [Fred Wu](http://fredwu.me)
125
144
 
126
145
  [Michael Grosser](http://pragmatig.wordpress.com)
127
146
  grosser.michael@gmail.com
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.5
1
+ 0.4.6
@@ -37,7 +37,7 @@ num_processes = num_processes * (options[:multiply] || 1)
37
37
  if options[:execute]
38
38
  results = Parallel.map(0...num_processes, :in_processes => num_processes) do |i|
39
39
  ParallelTests.execute_command(options[:execute], i)
40
- end
40
+ end.flatten
41
41
  abort if results.any?{|r| r[:exit_status] != 0 }
42
42
  else
43
43
  lib, name, task = {
@@ -1,5 +1,6 @@
1
1
  require 'parallel'
2
2
  require 'parallel_tests/grouper'
3
+ require 'parallel_tests/railtie'
3
4
 
4
5
  class ParallelTests
5
6
  VERSION = File.read( File.join(File.dirname(__FILE__),'..','VERSION') ).strip
@@ -0,0 +1,10 @@
1
+ # add rake tasks if we are inside Rails
2
+ if defined?(Rails::Railtie)
3
+ class ParallelTests
4
+ class Railtie < ::Rails::Railtie
5
+ rake_tasks do
6
+ load File.expand_path("../../tasks/parallel_tests.rake", __FILE__)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -36,7 +36,7 @@ namespace :parallel do
36
36
  require "parallel_tests"
37
37
  count, prefix, options = ParallelTests.parse_rake_args(args)
38
38
  executable = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'parallel_test')
39
- command = "#{executable} --type #{type} -n #{count} -p '#{prefix}' -r '#{RAILS_ROOT}' -o '#{options}'"
39
+ command = "#{executable} --type #{type} -n #{count} -p '#{prefix}' -r '#{Rails.root}' -o '#{options}'"
40
40
  abort unless system(command) # allow to chain tasks e.g. rake parallel:spec parallel:features
41
41
  end
42
42
  end
@@ -5,20 +5,17 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{parallel_tests}
8
- s.version = "0.4.5"
8
+ s.version = "0.4.6"
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"]
12
- s.date = %q{2010-08-17}
12
+ s.date = %q{2010-09-24}
13
13
  s.email = %q{grosser.michael@gmail.com}
14
14
  s.executables = ["parallel_spec", "parallel_cucumber", "parallel_test"]
15
- s.extra_rdoc_files = [
16
- "README.markdown"
17
- ]
18
15
  s.files = [
19
16
  ".gitignore",
20
- "README.markdown",
21
17
  "Rakefile",
18
+ "Readme.md",
22
19
  "VERSION",
23
20
  "bin/parallel_cucumber",
24
21
  "bin/parallel_spec",
@@ -28,6 +25,7 @@ Gem::Specification.new do |s|
28
25
  "lib/parallel_specs/spec_runtime_logger.rb",
29
26
  "lib/parallel_tests.rb",
30
27
  "lib/parallel_tests/grouper.rb",
28
+ "lib/parallel_tests/railtie.rb",
31
29
  "lib/tasks/parallel_tests.rake",
32
30
  "parallel_tests.gemspec",
33
31
  "spec/integration_spec.rb",
@@ -106,6 +106,6 @@ describe 'CLI' do
106
106
  write "x1_spec.rb", ""
107
107
  write "x2_spec.rb", ""
108
108
  result = run_specs(:add => "--test-options ' --version'", :processes => 2)
109
- result.should =~ /\d+\.\d+\.\d+\..*\d+\.\d+\.\d+\./m # prints version twice
109
+ result.should =~ /rspec \d+\.\d+\.\d+.*rspec \d+\.\d+\.\d+/m # prints version twice
110
110
  end
111
111
  end
@@ -18,6 +18,8 @@ end
18
18
  # Uses /tmp/parallel_tests/application as the cwd so we can create and remove
19
19
  # files as we want to. After execution it changes cwd back to the original one.
20
20
  def use_temporary_directory_for
21
+ require 'fileutils'
22
+
21
23
  dir = File.join("/tmp", "parallel_tests")
22
24
  new_dir = File.join(dir, "application")
23
25
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 5
9
- version: 0.4.5
8
+ - 6
9
+ version: 0.4.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Grosser
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-17 00:00:00 +02:00
17
+ date: 2010-09-24 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -37,12 +37,12 @@ executables:
37
37
  - parallel_test
38
38
  extensions: []
39
39
 
40
- extra_rdoc_files:
41
- - README.markdown
40
+ extra_rdoc_files: []
41
+
42
42
  files:
43
43
  - .gitignore
44
- - README.markdown
45
44
  - Rakefile
45
+ - Readme.md
46
46
  - VERSION
47
47
  - bin/parallel_cucumber
48
48
  - bin/parallel_spec
@@ -52,6 +52,7 @@ files:
52
52
  - lib/parallel_specs/spec_runtime_logger.rb
53
53
  - lib/parallel_tests.rb
54
54
  - lib/parallel_tests/grouper.rb
55
+ - lib/parallel_tests/railtie.rb
55
56
  - lib/tasks/parallel_tests.rake
56
57
  - parallel_tests.gemspec
57
58
  - spec/integration_spec.rb