spring-commands-parallel-tests 1.0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 750865989589012d7917c5e5c39cb624a8d1444e964fdc6f69f1510c6546dbdb
4
+ data.tar.gz: ec1df42db19c6272469a4b059ea76265ac38194c9c4cd472deb5a47071545ef8
5
+ SHA512:
6
+ metadata.gz: 71414a77535f2abb7278ae4eb4b9e44b27153828bb1ea058bf6a5352cf146c809683a3af133d2d1908ddd31049cc0925514394ef3ac01a04ecce7fd794c32daf
7
+ data.tar.gz: 8b6cd669d918057c7470e215483b370a421cb73b4afa8065a8e4c7d044df8134ed8c1de301e8b02007739240af6d3bc967e11518811032570c056487820db86b
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/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jon Leighton
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,41 @@
1
+ # spring-commands-parallel-tests
2
+
3
+ This gem adds the following commands from [parallel_tests](https://github.com/grosser/parallel_tests) to [Spring](https://github.com/rails/spring):
4
+
5
+ * `parallel_test`
6
+ * `parallel_rspec`
7
+ * `parallel_cucumber`
8
+ * `parallel_spinach`
9
+
10
+ By including `spring-commands-parallel-tests` in your `Gemfile`, the gem will automatically [patch Spring to reload the database configuration](https://github.com/grosser/parallel_tests/wiki/Spring). This allows you to use `<%= ENV['TEST_ENV_NUMBER'] %>` in `database.yml`. It also force-enables Spring, since `parallel_tests` [disables Spring by default](https://github.com/grosser/parallel_tests/blob/master/lib/parallel_tests/cli.rb#L13). (However, you can still disable Spring by setting `DISABLE_SPRING=1`.)
11
+
12
+ See these GitHub issues and PRs for more information about using Spring with `parallel_tests`:
13
+
14
+ * [parallel_tests#309](https://github.com/grosser/parallel_tests/issues/309)
15
+ * [parallel_tests#468](https://github.com/grosser/parallel_tests/issues/468)
16
+ * [parallel_tests#469](https://github.com/grosser/parallel_tests/issues/469)
17
+
18
+ ## Usage
19
+
20
+ Add to your Gemfile:
21
+
22
+ ``` ruby
23
+ gem 'spring-commands-parallel-tests', group: :development
24
+ ```
25
+
26
+ If you're using spring binstubs, you can run the following commands to generate the respective binstubs:
27
+
28
+ * `bundle exec spring binstub parallel_test`
29
+ * `bundle exec spring binstub parallel_rspec`
30
+ * `bundle exec spring binstub parallel_cucumber`
31
+ * `bundle exec spring binstub parallel_spinach`
32
+
33
+ Then run `spring stop` to pick up the changes.
34
+
35
+ ## Credits
36
+
37
+ This gem is a fork of the [spring-commands-rspec](https://github.com/jonleighton/spring-commands-rspec) gem by [@jonleighton](https://github.com/jonleighton).
38
+
39
+ ## License
40
+
41
+ MIT
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ if defined?(Spring.register_command)
2
+ require "spring/commands/parallel_tests"
3
+ end
@@ -0,0 +1,73 @@
1
+ require 'spring/application'
2
+
3
+ # The parallel_tests gem disables Spring by default by calling: ENV['DISABLE_SPRING'] ||= '1'
4
+ # https://github.com/grosser/parallel_tests/blob/master/lib/parallel_tests/cli.rb#L13
5
+ # Our code runs first, so we can set the default value to '0'.
6
+ ENV['DISABLE_SPRING'] ||= '0'
7
+
8
+ module Spring
9
+ # Patch Spring to work with parallel_tests
10
+ # From: https://github.com/grosser/parallel_tests/wiki/Spring
11
+ class Application
12
+ alias connect_database_orig connect_database
13
+
14
+ def connect_database
15
+ disconnect_database
16
+ reconfigure_database
17
+ connect_database_orig
18
+ end
19
+
20
+ def reconfigure_database
21
+ if active_record_configured?
22
+ ActiveRecord::Base.configurations =
23
+ Rails.application.config.database_configuration
24
+ end
25
+ end
26
+ end
27
+
28
+ module Commands
29
+ class ParallelTests
30
+ def env(*)
31
+ "test"
32
+ end
33
+
34
+ def exec_name
35
+ "parallel_rspec"
36
+ end
37
+
38
+ def gem_name
39
+ "parallel_tests"
40
+ end
41
+
42
+ def call
43
+ ::RSpec.configuration.start_time = Time.now if defined?(::RSpec.configuration.start_time)
44
+ load Gem.bin_path(gem_name, exec_name)
45
+ end
46
+ end
47
+
48
+ class ParallelRSpec < ParallelTests
49
+ def exec_name
50
+ "parallel_rspec"
51
+ end
52
+ end
53
+
54
+ class ParallelCucumber < ParallelTests
55
+ def exec_name
56
+ "parallel_cucumber"
57
+ end
58
+ end
59
+
60
+ class ParallelSpinach < ParallelTests
61
+ def exec_name
62
+ "parallel_spinach"
63
+ end
64
+ end
65
+
66
+ Spring.register_command "parallel_test", ParallelTest.new
67
+ Spring.register_command "parallel_rspec", ParallelRSpec.new
68
+ Spring.register_command "parallel_cucumber", ParallelCucumber.new
69
+ Spring.register_command "parallel_spinach", ParallelSpinach.new
70
+
71
+ Spring::Commands::Rake.environment_matchers[/^spec($|:)/] = "test"
72
+ end
73
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "spring-commands-parallel-tests"
7
+ spec.version = "1.0.0"
8
+ spec.authors = ["Jon Leighton", "Nathan Broadbent"]
9
+ spec.email = ["j@jonathanleighton.com", "nathan@docspring.com"]
10
+ spec.description = %q{parallel_tests commands for spring}
11
+ spec.summary = %q{parallel_tests commands for spring}
12
+ spec.homepage = "https://github.com/DocSpring/spring-commands-parallel-tests"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "spring", ">= 0.9.1"
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spring-commands-parallel-tests
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jon Leighton
8
+ - Nathan Broadbent
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2019-12-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: spring
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 0.9.1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: 0.9.1
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.3'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.3'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description: parallel_tests commands for spring
57
+ email:
58
+ - j@jonathanleighton.com
59
+ - nathan@docspring.com
60
+ executables: []
61
+ extensions: []
62
+ extra_rdoc_files: []
63
+ files:
64
+ - ".gitignore"
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/spring-commands-parallel-tests.rb
69
+ - lib/spring/commands/parallel_tests.rb
70
+ - spring-commands-parallel-tests.gemspec
71
+ homepage: https://github.com/DocSpring/spring-commands-parallel-tests
72
+ licenses:
73
+ - MIT
74
+ metadata: {}
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubygems_version: 3.0.3
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: parallel_tests commands for spring
94
+ test_files: []