spring-commands-parallel-rspec 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 +7 -0
- data/.gitignore +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +43 -0
- data/Rakefile +1 -0
- data/lib/spring-commands-parallel-rspec.rb +3 -0
- data/lib/spring/commands/parallel_rspec.rb +46 -0
- data/spring-commands-parallel-rspec.gemspec +24 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4e9442300166caa5af370f6412d5d23c8d009837b477b0fb77dd8c906c91b38d
|
4
|
+
data.tar.gz: de86620deaa31722b6055b8d5ed10da3897095ad663546b937948d461dbf92ea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c4e0b0e189469f9d466b538572929121cd044c73979da6ee84bda68d3cd929155419c331e0aad463127151a2c18d92d763d4f176e8d7f529fe056d8d8b30680d
|
7
|
+
data.tar.gz: b5a6a459f7dc83cba1eafd0b04d62f3e67eac5b9d49926b9a26ba26350ef719d713ba59628f5bf3a21352212598661835e0214d99ece701cb72ee9724501ecdb
|
data/.gitignore
ADDED
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,43 @@
|
|
1
|
+
# spring-commands-parallel-rspec
|
2
|
+
|
3
|
+
This gem implements the `parallel_rspec` command for
|
4
|
+
[Spring](https://github.com/rails/spring).
|
5
|
+
|
6
|
+
This is a fork of the [spring-commands-rspec](https://github.com/jonleighton/spring-commands-rspec) gem to suppor the `parallel_rspec` command from the [parallel_tests](https://github.com/grosser/parallel_tests) gem.
|
7
|
+
|
8
|
+
This gem also [patches Spring to reload the database configuration and reconnect the database](https://github.com/grosser/parallel_tests/wiki/Spring), which allows you to use `<%= ENV['TEST_ENV_NUMBER'] %>` in `database.yml`:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
require 'spring/application'
|
12
|
+
|
13
|
+
class Spring::Application
|
14
|
+
alias connect_database_orig connect_database
|
15
|
+
|
16
|
+
def connect_database
|
17
|
+
disconnect_database
|
18
|
+
reconfigure_database
|
19
|
+
connect_database_orig
|
20
|
+
end
|
21
|
+
|
22
|
+
def reconfigure_database
|
23
|
+
if active_record_configured?
|
24
|
+
ActiveRecord::Base.configurations =
|
25
|
+
Rails.application.config.database_configuration
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
```
|
30
|
+
|
31
|
+
> [See the discussion on this GitHub issue](https://github.com/grosser/parallel_tests/issues/309).
|
32
|
+
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
Add to your Gemfile:
|
37
|
+
|
38
|
+
``` ruby
|
39
|
+
gem 'spring-commands-parallel-rspec', group: :development
|
40
|
+
```
|
41
|
+
|
42
|
+
If you're using spring binstubs, run `bundle exec spring binstub parallel_rspec` to generate `bin/parallel_rspec`.
|
43
|
+
Then run `spring stop` to pick up the changes.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spring/application'
|
2
|
+
|
3
|
+
module Spring
|
4
|
+
# Patch Spring to work with parallel_tests
|
5
|
+
# From: https://github.com/grosser/parallel_tests/wiki/Spring
|
6
|
+
class Application
|
7
|
+
alias connect_database_orig connect_database
|
8
|
+
|
9
|
+
def connect_database
|
10
|
+
disconnect_database
|
11
|
+
reconfigure_database
|
12
|
+
connect_database_orig
|
13
|
+
end
|
14
|
+
|
15
|
+
def reconfigure_database
|
16
|
+
if active_record_configured?
|
17
|
+
ActiveRecord::Base.configurations =
|
18
|
+
Rails.application.config.database_configuration
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
module Commands
|
24
|
+
class ParallelRSpec
|
25
|
+
def env(*)
|
26
|
+
"test"
|
27
|
+
end
|
28
|
+
|
29
|
+
def exec_name
|
30
|
+
"parallel_rspec"
|
31
|
+
end
|
32
|
+
|
33
|
+
def gem_name
|
34
|
+
"parallel_tests"
|
35
|
+
end
|
36
|
+
|
37
|
+
def call
|
38
|
+
::RSpec.configuration.start_time = Time.now if defined?(::RSpec.configuration.start_time)
|
39
|
+
load Gem.bin_path(gem_name, exec_name)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
Spring.register_command "parallel_rspec", ParallelRSpec.new
|
44
|
+
Spring::Commands::Rake.environment_matchers[/^spec($|:)/] = "test"
|
45
|
+
end
|
46
|
+
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-rspec"
|
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_rspec command for spring}
|
11
|
+
spec.summary = %q{parallel_rspec command for spring}
|
12
|
+
spec.homepage = "https://github.com/DocSpring/spring-commands-parallel-rspec"
|
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-rspec
|
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_rspec command 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-rspec.rb
|
69
|
+
- lib/spring/commands/parallel_rspec.rb
|
70
|
+
- spring-commands-parallel-rspec.gemspec
|
71
|
+
homepage: https://github.com/DocSpring/spring-commands-parallel-rspec
|
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_rspec command for spring
|
94
|
+
test_files: []
|