rspec-parallel-go-go-go 0.1.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/.devcontainer/devcontainer.json +27 -0
- data/.rspec +3 -0
- data/.rubocop.yml +29 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +63 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/Rakefile +12 -0
- data/docker-compose.yml +10 -0
- data/lib/rspec/parallel/go_go_go/formatter.rb +57 -0
- data/lib/rspec/parallel/go_go_go/progress_counter.rb +32 -0
- data/lib/rspec/parallel/go_go_go/progress_framer.rb +71 -0
- data/lib/rspec/parallel/go_go_go/version.rb +9 -0
- data/lib/rspec/parallel/go_go_go.rb +4 -0
- data/rspec-parallel-go-go-go.gemspec +40 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 164bfb6c1e3b2c9778eed578bbe09d1dec5fa44f8dba0be35181605b75203cbf
|
4
|
+
data.tar.gz: eb12562baea3d1cf88bd425d6e797e29a856f4d35cb19c2b38e067b338016750
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 38a10916d759b3404b1b630a20ba5720e457d4838a81cfc87e4ee5d0910f096792adca7fa0f1ffb68584acbbd20565407f0958d7f778113e2721c678a0016339
|
7
|
+
data.tar.gz: 265b37bb08b7070f9b940a86e8bf7874140c0b02a7de1c5870f604d2d83a365894b2b5c2550f8394bd7db2824717e438e14411daf20971c594c54ac28ff915c2
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"name": "dev",
|
3
|
+
"dockerComposeFile": "../docker-compose.yml",
|
4
|
+
"service": "app",
|
5
|
+
"workspaceFolder": "/app",
|
6
|
+
"customizations": {
|
7
|
+
"vscode": {
|
8
|
+
"extensions": [
|
9
|
+
"rebornix.ruby"
|
10
|
+
]
|
11
|
+
}
|
12
|
+
},
|
13
|
+
"settings": {
|
14
|
+
"ruby.useBundler": true, //run non-lint commands with bundle exec
|
15
|
+
"ruby.useLanguageServer": true, // use the internal language server (see below)
|
16
|
+
"ruby.lint": {
|
17
|
+
"rubocop": {
|
18
|
+
"useBundler": true // enable rubocop via bundler
|
19
|
+
},
|
20
|
+
"reek": {
|
21
|
+
"useBundler": true // enable reek via bundler
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"ruby.format": "rubocop",
|
25
|
+
"ruby.intellisense": "rubyLocate" // use rubocop for formatting
|
26
|
+
}
|
27
|
+
}
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
NewCops: enable
|
5
|
+
SuggestExtensions: false
|
6
|
+
|
7
|
+
Style/StringLiterals:
|
8
|
+
Enabled: true
|
9
|
+
EnforcedStyle: double_quotes
|
10
|
+
|
11
|
+
Style/StringLiteralsInInterpolation:
|
12
|
+
Enabled: true
|
13
|
+
EnforcedStyle: double_quotes
|
14
|
+
|
15
|
+
Layout/LineLength:
|
16
|
+
Max: 120
|
17
|
+
|
18
|
+
Style/Documentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
RSpec/FilePath:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/TrailingCommaInArrayLiteral:
|
25
|
+
EnforcedStyleForMultiline: comma
|
26
|
+
|
27
|
+
Style/TrailingCommaInHashLiteral:
|
28
|
+
EnforcedStyleForMultiline: comma
|
29
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies rspec-go-go-go-in-parallel.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
|
10
|
+
gem "rspec", "~> 3.0"
|
11
|
+
|
12
|
+
gem "rubocop", "~> 1.21"
|
13
|
+
|
14
|
+
gem "rubocop-rspec", "~> 2.13"
|
15
|
+
|
16
|
+
gem "parallel_tests", "~> 4.0.0"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rspec-parallel-go-go-go (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.2)
|
10
|
+
diff-lcs (1.5.0)
|
11
|
+
json (2.6.3)
|
12
|
+
parallel (1.22.1)
|
13
|
+
parallel_tests (4.0.0)
|
14
|
+
parallel
|
15
|
+
parser (3.2.0.0)
|
16
|
+
ast (~> 2.4.1)
|
17
|
+
rainbow (3.1.1)
|
18
|
+
rake (13.0.6)
|
19
|
+
regexp_parser (2.6.1)
|
20
|
+
rexml (3.2.5)
|
21
|
+
rspec (3.12.0)
|
22
|
+
rspec-core (~> 3.12.0)
|
23
|
+
rspec-expectations (~> 3.12.0)
|
24
|
+
rspec-mocks (~> 3.12.0)
|
25
|
+
rspec-core (3.12.0)
|
26
|
+
rspec-support (~> 3.12.0)
|
27
|
+
rspec-expectations (3.12.2)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.12.0)
|
30
|
+
rspec-mocks (3.12.2)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.12.0)
|
33
|
+
rspec-support (3.12.0)
|
34
|
+
rubocop (1.43.0)
|
35
|
+
json (~> 2.3)
|
36
|
+
parallel (~> 1.10)
|
37
|
+
parser (>= 3.2.0.0)
|
38
|
+
rainbow (>= 2.2.2, < 4.0)
|
39
|
+
regexp_parser (>= 1.8, < 3.0)
|
40
|
+
rexml (>= 3.2.5, < 4.0)
|
41
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
42
|
+
ruby-progressbar (~> 1.7)
|
43
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
44
|
+
rubocop-ast (1.24.1)
|
45
|
+
parser (>= 3.1.1.0)
|
46
|
+
rubocop-rspec (2.16.0)
|
47
|
+
rubocop (~> 1.33)
|
48
|
+
ruby-progressbar (1.11.0)
|
49
|
+
unicode-display_width (2.4.2)
|
50
|
+
|
51
|
+
PLATFORMS
|
52
|
+
aarch64-linux
|
53
|
+
|
54
|
+
DEPENDENCIES
|
55
|
+
parallel_tests (~> 4.0.0)
|
56
|
+
rake (~> 13.0)
|
57
|
+
rspec (~> 3.0)
|
58
|
+
rspec-parallel-go-go-go!
|
59
|
+
rubocop (~> 1.21)
|
60
|
+
rubocop-rspec (~> 2.13)
|
61
|
+
|
62
|
+
BUNDLED WITH
|
63
|
+
2.4.3
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 fukurose
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# RSpecParallelGoGoGo
|
2
|
+
|
3
|
+
Run parallel_rspec with progress bar.
|
4
|
+
This gem uses parallel_tests.
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rspec-parallel-go-go-go'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rspec-parallel-go-go-go
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
|
26
|
+
write .rspec_parallel
|
27
|
+
|
28
|
+
```
|
29
|
+
--format RSpec::Parallel::GoGoGo::Formatter
|
30
|
+
```
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/fukurose/rspec-parallel-go-go-go.
|
35
|
+
|
36
|
+
After checking out the repository, you need to install dependencies:
|
37
|
+
```
|
38
|
+
gem install bundler -v 2.3.7
|
39
|
+
bundle install
|
40
|
+
```
|
41
|
+
|
42
|
+
To install this gem on your local machine, run `bundle exec rake install`.
|
43
|
+
Please check your contributions with RuboCop by running `bundle exec rubocop`.
|
44
|
+
|
45
|
+
## License
|
46
|
+
|
47
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/docker-compose.yml
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rspec/parallel/go_go_go/progress_counter"
|
4
|
+
require "rspec/parallel/go_go_go/progress_framer"
|
5
|
+
|
6
|
+
require "rspec/core"
|
7
|
+
require "rspec/core/formatters/base_text_formatter"
|
8
|
+
|
9
|
+
require "parallel_tests"
|
10
|
+
|
11
|
+
module RSpec
|
12
|
+
module Parallel
|
13
|
+
module GoGoGo
|
14
|
+
class Formatter < RSpec::Core::Formatters::BaseTextFormatter
|
15
|
+
RSpec::Core::Formatters.register self, :start, :example_passed, :example_failed, :dump_failures, :dump_summary
|
16
|
+
|
17
|
+
def start(notification)
|
18
|
+
super
|
19
|
+
test_number = ENV.fetch("TEST_ENV_NUMBER", "1")
|
20
|
+
@current_process_number = test_number.empty? ? 1 : test_number.to_i
|
21
|
+
@total_processes = ENV.fetch("PARALLEL_TEST_GROUPS", "1").to_i
|
22
|
+
|
23
|
+
@counter = ProgressCounter.new(notification.count)
|
24
|
+
@output << ProgressFramer.init_display(@total_processes)
|
25
|
+
@output << "\e[#{@total_processes}A"
|
26
|
+
end
|
27
|
+
|
28
|
+
def example_passed(*)
|
29
|
+
@counter.passed
|
30
|
+
@output << ProgressFramer.display(@counter, @current_process_number)
|
31
|
+
end
|
32
|
+
|
33
|
+
def example_failed(*)
|
34
|
+
@counter.failed
|
35
|
+
@output << ProgressFramer.display(@counter, @current_process_number)
|
36
|
+
end
|
37
|
+
|
38
|
+
def dump_failures(*); end
|
39
|
+
|
40
|
+
def dump_summary(*); end
|
41
|
+
|
42
|
+
def dump_pending(*); end
|
43
|
+
|
44
|
+
def close(*)
|
45
|
+
return if @output.closed?
|
46
|
+
|
47
|
+
if ParallelTests.first_process?
|
48
|
+
ParallelTests.wait_for_other_processes_to_finish
|
49
|
+
@output << "\e[#{@total_processes}E"
|
50
|
+
end
|
51
|
+
|
52
|
+
@output.flush
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Parallel
|
5
|
+
module GoGoGo
|
6
|
+
class ProgressCounter
|
7
|
+
def initialize(total)
|
8
|
+
@total = total
|
9
|
+
@passes = 0
|
10
|
+
@failures = 0
|
11
|
+
end
|
12
|
+
attr_reader :total, :passes, :failures
|
13
|
+
|
14
|
+
def passed
|
15
|
+
@passes += 1
|
16
|
+
end
|
17
|
+
|
18
|
+
def failed
|
19
|
+
@failures += 1
|
20
|
+
end
|
21
|
+
|
22
|
+
def checks
|
23
|
+
@passes + @failures
|
24
|
+
end
|
25
|
+
|
26
|
+
def rate
|
27
|
+
(checks.to_f / total).round(2)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RSpec
|
4
|
+
module Parallel
|
5
|
+
module GoGoGo
|
6
|
+
module ProgressFramer
|
7
|
+
module_function
|
8
|
+
|
9
|
+
def cal_width(counter)
|
10
|
+
@cal_width ||= begin
|
11
|
+
width = terminal_width # terminal width
|
12
|
+
width -= result(counter).length
|
13
|
+
width -= rate(counter).length
|
14
|
+
width -= 5 # blank * 3 and "|" * 2
|
15
|
+
width
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def terminal_width
|
20
|
+
@terminal_width ||= `tput cols`.to_i
|
21
|
+
end
|
22
|
+
|
23
|
+
def init_display(total_processes)
|
24
|
+
"\n" * total_processes
|
25
|
+
end
|
26
|
+
|
27
|
+
def display(counter, move_number)
|
28
|
+
"\r\e[#{move_number}E" + "#{result(counter)} #{bar(counter)} #{rate(counter)}" + "\e[#{move_number}F"
|
29
|
+
end
|
30
|
+
|
31
|
+
def bar(counter)
|
32
|
+
width = cal_width(counter)
|
33
|
+
progress_bar = if counter.rate >= 1
|
34
|
+
completed_progress_bar(width)
|
35
|
+
elsif counter.rate <= 0
|
36
|
+
no_progress_bar(width)
|
37
|
+
else
|
38
|
+
in_progress_bar(counter, width)
|
39
|
+
end
|
40
|
+
RSpec::Core::Formatters::ConsoleCodes.wrap("|#{progress_bar}|", :magenta)
|
41
|
+
end
|
42
|
+
|
43
|
+
def result(counter)
|
44
|
+
max = counter.total.to_s.length
|
45
|
+
format("%#{max}s examples, %#{max}s failures", counter.checks, counter.failures)
|
46
|
+
end
|
47
|
+
|
48
|
+
def rate(counter)
|
49
|
+
percent = (counter.rate * 100.0).to_int
|
50
|
+
"#{format("%3s", percent)}%"
|
51
|
+
end
|
52
|
+
|
53
|
+
# bar: ----------
|
54
|
+
def no_progress_bar(width)
|
55
|
+
"-" * width
|
56
|
+
end
|
57
|
+
|
58
|
+
# bar: GoGoGo-----
|
59
|
+
def in_progress_bar(counter, width)
|
60
|
+
bar_len = counter.rate * width.to_f / 2
|
61
|
+
("Go" * bar_len).ljust(width, "-")
|
62
|
+
end
|
63
|
+
|
64
|
+
# bar: ==========
|
65
|
+
def completed_progress_bar(width)
|
66
|
+
"=" * width
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("lib", __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "rspec/parallel/go_go_go/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "rspec-parallel-go-go-go"
|
9
|
+
spec.version = RSpec::Parallel::GoGoGo::VERSION
|
10
|
+
spec.authors = ["fukurose"]
|
11
|
+
spec.email = ["tfukurose@gmail.com"]
|
12
|
+
|
13
|
+
spec.summary = "run parallel rspec with progress bar"
|
14
|
+
spec.description = "This gem is a kind of rspec format. You can run rspec with progress bar."
|
15
|
+
spec.homepage = "https://github.com/fukurose/rspec-parallel-go-go-go"
|
16
|
+
spec.license = "MIT"
|
17
|
+
spec.required_ruby_version = ">= 2.6.0"
|
18
|
+
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
21
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
22
|
+
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(__dir__) do
|
26
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
28
|
+
end
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
# Uncomment to register a new dependency of your gem
|
35
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
36
|
+
|
37
|
+
# For more information and examples about making a new gem, check out our
|
38
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
39
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rspec-parallel-go-go-go
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- fukurose
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-01-12 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This gem is a kind of rspec format. You can run rspec with progress bar.
|
14
|
+
email:
|
15
|
+
- tfukurose@gmail.com
|
16
|
+
executables: []
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- ".devcontainer/devcontainer.json"
|
21
|
+
- ".rspec"
|
22
|
+
- ".rubocop.yml"
|
23
|
+
- Gemfile
|
24
|
+
- Gemfile.lock
|
25
|
+
- LICENSE.txt
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
28
|
+
- docker-compose.yml
|
29
|
+
- lib/rspec/parallel/go_go_go.rb
|
30
|
+
- lib/rspec/parallel/go_go_go/formatter.rb
|
31
|
+
- lib/rspec/parallel/go_go_go/progress_counter.rb
|
32
|
+
- lib/rspec/parallel/go_go_go/progress_framer.rb
|
33
|
+
- lib/rspec/parallel/go_go_go/version.rb
|
34
|
+
- rspec-parallel-go-go-go.gemspec
|
35
|
+
homepage: https://github.com/fukurose/rspec-parallel-go-go-go
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata:
|
39
|
+
homepage_uri: https://github.com/fukurose/rspec-parallel-go-go-go
|
40
|
+
source_code_uri: https://github.com/fukurose/rspec-parallel-go-go-go
|
41
|
+
changelog_uri: https://github.com/fukurose/rspec-parallel-go-go-go
|
42
|
+
rubygems_mfa_required: 'true'
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 2.6.0
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubygems_version: 3.4.1
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: run parallel rspec with progress bar
|
62
|
+
test_files: []
|