zeus-parallel_tests 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1a9ddfc02ea9f897dbb022adf3a43dcb754d3382
4
+ data.tar.gz: 667d9c3efa43f7e9e247aafba77209afb737039a
5
+ SHA512:
6
+ metadata.gz: fd52aee09d6bf030dc18e4441c2c5e379d9560499f578e18ef82d09f6716298e40ed68193f6c7f56d8715b1260b26881a5d171e29f8a140cf01f6d960cb5751c
7
+ data.tar.gz: 1d04a157c8eb309219b90eba4bb3bedc9aa023d11830374375cad92da9f228530fb006c070dbdb3dd18d62a26dcfd41d9c36790ce5c91604dbd0acb56dfa2e72
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ zeus-parallel_tests
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in zeus-parallel_tests.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Artur Roszczyk
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Zeus::ParallelTests
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'zeus-parallel_tests'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install zeus-parallel_tests
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+
5
+ unless ARGV == ["init"]
6
+ puts "Usage:"
7
+ puts " zeus-parallel_specs init\t\tInitializes custom plan and script/spec"
8
+ exit 1
9
+ end
10
+
11
+ def copy(file, target_dir, mode = 0644)
12
+ templates_dir = File.expand_path("../../lib/zeus/parallel_tests/templates/", __FILE__)
13
+ source_file = File.join(templates_dir, file)
14
+ dest_file = File.join(File.expand_path(target_dir), file)
15
+ puts "Creating #{dest_file}"
16
+ if File.exists?(dest_file)
17
+ print "File exists, overwrite? [y/n} "
18
+ unless $stdin.gets.chomp == "y"
19
+ puts "skipped"
20
+ end
21
+ end
22
+ FileUtils.cp(source_file, dest_file)
23
+ FileUtils.chmod(mode, dest_file)
24
+ end
25
+
26
+ copy "custom_plan.rb", "./"
27
+ copy "zeus.json", "./"
28
+ copy "spec", "script/", 0755
@@ -0,0 +1,9 @@
1
+ require "zeus/parallel_tests/version"
2
+ require 'zeus/rails'
3
+
4
+ require_relative 'parallel_tests/rails'
5
+
6
+ module Zeus
7
+ module ParallelTests
8
+ end
9
+ end
@@ -0,0 +1,45 @@
1
+ module Zeus
2
+ module ParallelTests
3
+ class Rails < ::Zeus::Rails
4
+ def parallel_rspec
5
+ argv = ARGV.dup
6
+ test_env_number = argv.shift
7
+ # Parallels spec reuse main test db instead of db with "1" appended
8
+ test_env_number = nil if test_env_number == "1"
9
+
10
+ return unless defined?(ActiveRecord::Base)
11
+ begin
12
+ ActiveRecord::Base.clear_all_connections!
13
+
14
+ config = ActiveRecord::Base.connection_config
15
+ config[:database] = "#{config[:database]}#{test_env_number}"
16
+
17
+ ActiveRecord::Base.establish_connection(config)
18
+ if ActiveRecord::Base.respond_to?(:shared_connection)
19
+ ActiveRecord::Base.shared_connection = ActiveRecord::Base.retrieve_connection
20
+ end
21
+ rescue ActiveRecord::AdapterNotSpecified
22
+ end
23
+
24
+ ENV['TEST_ENV_NUMBER'] = test_env_number
25
+ ENV['PARALLEL_TEST_GROUPS'] = argv.shift
26
+
27
+ rspec_args_file = argv.shift
28
+ test_files = File.readlines(rspec_args_file).map(&:chomp)
29
+
30
+ test(test_files.unshift("--colour").unshift("--tty"))
31
+ end
32
+
33
+ def test(argv = ARGV)
34
+ if spec_file?(argv) && defined?(RSpec)
35
+ # disable autorun in case the user left it in spec_helper.rb
36
+ RSpec::Core::Runner.disable_autorun!
37
+ exit RSpec::Core::Runner.run(argv)
38
+ else
39
+ Zeus::M.run(argv)
40
+ end
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,7 @@
1
+ require 'zeus/parallel_tests'
2
+
3
+ class CustomPlan < Zeus::ParallelTests::Rails
4
+ # Your custom methods go here
5
+ end
6
+
7
+ Zeus.plan = CustomPlan.new
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ require 'tempfile'
3
+
4
+ test_env_number = ENV['TEST_ENV_NUMBER'] || 1
5
+ test_env_number = 1 if test_env_number == ""
6
+
7
+ rspec_args_file = Tempfile.new("rspec_args")
8
+ ARGV.each do |arg|
9
+ rspec_args_file.puts arg
10
+ end
11
+
12
+ rspec_args_file.close
13
+
14
+ system %{zeus parallel_rspec #{test_env_number} #{ENV['PARALLEL_TEST_GROUPS']} #{rspec_args_file.path}}
15
+ status = $?
16
+
17
+ rspec_args_file.unlink
18
+
19
+ exit status.to_i
@@ -0,0 +1,26 @@
1
+ {
2
+ "command": "ruby -rubygems -r./custom_plan -eZeus.go",
3
+
4
+ "plan": {
5
+ "boot": {
6
+ "default_bundle": {
7
+ "development_environment": {
8
+ "prerake": {"rake": []},
9
+ "runner": ["r"],
10
+ "console": ["c"],
11
+ "server": ["s"],
12
+ "generate": ["g"],
13
+ "destroy": ["d"],
14
+ "dbconsole": []
15
+ },
16
+ "test_environment": {
17
+ "cucumber_environment": {"cucumber": []},
18
+ "test_helper": {
19
+ "test": ["rspec", "testrb"],
20
+ "parallel_rspec": []
21
+ }
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,5 @@
1
+ module Zeus
2
+ module ParallelTests
3
+ VERSION = "0.1.1"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'zeus/parallel_tests/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "zeus-parallel_tests"
8
+ spec.version = Zeus::ParallelTests::VERSION
9
+ spec.authors = ["Artur Roszczyk"]
10
+ spec.email = ["artur.roszczyk@gmail.com"]
11
+ spec.description = %q{Integration for zeus and parallel_tests}
12
+ spec.summary = %q{}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "zeus", "~> 0.13.3"
22
+ spec.add_dependency "parallel_tests", "0.10.3"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: zeus-parallel_tests
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Artur Roszczyk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: zeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.13.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.13.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: parallel_tests
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 0.10.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.10.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '1.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '1.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Integration for zeus and parallel_tests
70
+ email:
71
+ - artur.roszczyk@gmail.com
72
+ executables:
73
+ - zeus-parallel_specs
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - .ruby-gemset
79
+ - .ruby-version
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/zeus-parallel_specs
85
+ - lib/zeus/parallel_tests.rb
86
+ - lib/zeus/parallel_tests/rails.rb
87
+ - lib/zeus/parallel_tests/templates/custom_plan.rb
88
+ - lib/zeus/parallel_tests/templates/spec
89
+ - lib/zeus/parallel_tests/templates/zeus.json
90
+ - lib/zeus/parallel_tests/version.rb
91
+ - zeus-parallel_tests.gemspec
92
+ homepage: ''
93
+ licenses:
94
+ - MIT
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.0.3
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: ''
116
+ test_files: []