repeat_test 0.0.1

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: f65f6aad6356291edcfe6becad4db7d4446ab204a9878d900fa443cad7caf519
4
+ data.tar.gz: 59b8c3dd98a46a5d2c01e7cf9424b329e11a41484b350b1605f45336520dbec1
5
+ SHA512:
6
+ metadata.gz: a74e8967c5d47b1a5997eaf0e285e8892f2962c0ba8eb1aa70de09ec1e82c33faf60e400f1c4b471f22101be41ddaaf1d4e3973472c2e983e5b7bbe7e60b7e84
7
+ data.tar.gz: 40b973f7f9a2dad58784673c133eb994e4d8e41271147ab4454dc4445d3bd6f06362e850dd5b8af417ffe622e25f11a78395cd8c6b77e1a7f84a6e0c96d11f6a
@@ -0,0 +1,51 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ otp:
7
+ description: "One-time password for RubyGems.org"
8
+ required: true
9
+
10
+ concurrency:
11
+ group: ${{ github.workflow }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ release:
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ contents: write
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v3
22
+
23
+ - name: Set up Ruby
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: "3.1"
27
+ bundler-cache: true
28
+
29
+ - name: Configure Git
30
+ run: |
31
+ git config --global user.name "${GITHUB_ACTOR}"
32
+ git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
33
+
34
+ - name: Publish to gem registry
35
+ run: bundle exec rake release
36
+ env:
37
+ GEM_HOST_API_KEY: ${{ secrets.API_KEY }}
38
+ GEM_HOST_OTP_CODE: ${{ inputs.otp }}
39
+
40
+ - name: Push tag
41
+ run: git push --follow-tags
42
+
43
+ - name: Get tag
44
+ run: echo "::set-output name=name::$(git describe --abbrev=0)"
45
+ id: tag
46
+
47
+ - name: Create GitHub release
48
+ run: gh release create "${TAG_NAME}" --draft
49
+ env:
50
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
+ TAG_NAME: ${{ steps.tag.outputs.name }}
@@ -0,0 +1,16 @@
1
+ name: RSpec
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 3.1.0
14
+ bundler-cache: true
15
+ - name: Run RSpec
16
+ run: bundle exec rspec spec --profile 20 --format progress
@@ -0,0 +1,16 @@
1
+ name: RuboCop
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 3.1.0
14
+ bundler-cache: true
15
+ - name: Run RuboCop
16
+ run: bundle exec rubocop
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.0
data/Gemfile ADDED
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in repeat_test.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec-core", "~> 3.0"
11
+
12
+ group :development, :test do
13
+ gem "debug"
14
+ gem "rspec", "~> 3.0"
15
+ gem "rspec_junit_formatter", require: false
16
+ gem "rubocop", "~> 1.7"
17
+
18
+ path = File.expand_path(__dir__)
19
+ $LOAD_PATH.unshift(path) unless $LOAD_PATH.include?(path)
20
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,84 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ repeat_test (0.0.1)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ debug (1.9.2)
11
+ irb (~> 1.10)
12
+ reline (>= 0.3.8)
13
+ diff-lcs (1.5.1)
14
+ io-console (0.7.2)
15
+ irb (1.13.2)
16
+ rdoc (>= 4.0.0)
17
+ reline (>= 0.4.2)
18
+ json (2.7.2)
19
+ language_server-protocol (3.17.0.3)
20
+ parallel (1.25.1)
21
+ parser (3.3.3.0)
22
+ ast (~> 2.4.1)
23
+ racc
24
+ psych (5.1.2)
25
+ stringio
26
+ racc (1.8.0)
27
+ rainbow (3.1.1)
28
+ rake (13.2.1)
29
+ rdoc (6.7.0)
30
+ psych (>= 4.0.0)
31
+ regexp_parser (2.9.2)
32
+ reline (0.5.9)
33
+ io-console (~> 0.5)
34
+ rexml (3.3.0)
35
+ strscan
36
+ rspec (3.13.0)
37
+ rspec-core (~> 3.13.0)
38
+ rspec-expectations (~> 3.13.0)
39
+ rspec-mocks (~> 3.13.0)
40
+ rspec-core (3.13.0)
41
+ rspec-support (~> 3.13.0)
42
+ rspec-expectations (3.13.1)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.13.0)
45
+ rspec-mocks (3.13.1)
46
+ diff-lcs (>= 1.2.0, < 2.0)
47
+ rspec-support (~> 3.13.0)
48
+ rspec-support (3.13.1)
49
+ rspec_junit_formatter (0.6.0)
50
+ rspec-core (>= 2, < 4, != 2.12.0)
51
+ rubocop (1.64.1)
52
+ json (~> 2.3)
53
+ language_server-protocol (>= 3.17.0)
54
+ parallel (~> 1.10)
55
+ parser (>= 3.3.0.2)
56
+ rainbow (>= 2.2.2, < 4.0)
57
+ regexp_parser (>= 1.8, < 3.0)
58
+ rexml (>= 3.2.5, < 4.0)
59
+ rubocop-ast (>= 1.31.1, < 2.0)
60
+ ruby-progressbar (~> 1.7)
61
+ unicode-display_width (>= 2.4.0, < 3.0)
62
+ rubocop-ast (1.31.3)
63
+ parser (>= 3.3.1.0)
64
+ ruby-progressbar (1.13.0)
65
+ stringio (3.1.1)
66
+ strscan (3.1.0)
67
+ unicode-display_width (2.5.0)
68
+
69
+ PLATFORMS
70
+ arm64-darwin-22
71
+ arm64-darwin-23
72
+ x86_64-linux
73
+
74
+ DEPENDENCIES
75
+ debug
76
+ rake (~> 13.0)
77
+ repeat_test!
78
+ rspec (~> 3.0)
79
+ rspec-core (~> 3.0)
80
+ rspec_junit_formatter
81
+ rubocop (~> 1.7)
82
+
83
+ BUNDLED WITH
84
+ 2.3.3
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Masato Yamashita
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,41 @@
1
+ # RepeatTest
2
+ The `RepeatTest` is responsible for performing repeated tests.
3
+ It provides methods to execute a test multiple times and display the results.
4
+ This class can be used to measure the performance or stability of a system under repeated testing.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'rspec'
12
+ gem 'repeat_test'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install rspec repeat_test
22
+
23
+ ## Usage
24
+ ```
25
+ # Using the files specified by the -f option and run rspec command for n times specified by the -i option.
26
+ $ repeat_test -i 3 -f spec_file
27
+ ```
28
+
29
+ ## Development
30
+
31
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`.
34
+
35
+ ## Contributing
36
+
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/M-Yamashita01/repeat_test .
38
+
39
+ ## License
40
+
41
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "repeat_test"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/repeat_test ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "repeat_test"
5
+
6
+ RepeatTest::CLI.run(ARGV)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/repeat_test ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "repeat_test"
5
+
6
+ RepeatTest::CLI.run
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RepeatTest
4
+ # CLI class to run the command line interface
5
+ class CLI
6
+ def self.run(args)
7
+ new(args).run
8
+ end
9
+
10
+ def initialize(args)
11
+ @args = args
12
+ end
13
+
14
+ def run
15
+ configuration_options = ConfigurationOptions.new(@args)
16
+ options = configuration_options.options
17
+
18
+ files = options[:files].join(" ")
19
+ runner = RspecRunner.new(options:, files:)
20
+ options[:iterations].to_i.times do |i|
21
+ puts "Running RSpec iteration ##{i + 1}"
22
+
23
+ runner.run
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RepeatTest
4
+ # ConfigurationOptions class
5
+ class ConfigurationOptions
6
+ attr_accessor :options
7
+
8
+ def initialize(args)
9
+ @args = args
10
+ organize_options
11
+ end
12
+
13
+ private
14
+
15
+ def organize_options
16
+ @options ||= Parser.parse(@args)
17
+ rescue OptionParser::InvalidOption
18
+ abort "Please use --help for a listing of valid options"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "optparse"
4
+ require "optionparser"
5
+
6
+ module RepeatTest
7
+ # Parser class to parse the command line arguments
8
+ class Parser < RSpec::Core::Parser
9
+ # rubocop:disable Metrics/MethodLength
10
+ # rubocop:disable Metrics/AbcSize
11
+ def self.parse(args)
12
+ options = {}
13
+ begin
14
+ OptionParser.new do |opts|
15
+ opts.banner = "Usage: repeat_test [options] files or directories"
16
+
17
+ opts.on("-i", "--iterations [ITERATIONS]", Integer, "Number of iterations") do |iterations|
18
+ options[:iterations] = iterations
19
+ end
20
+
21
+ opts.on("-f", "--files [FILES]", Array, "Files or directories to run") do |files|
22
+ options[:files] = files
23
+ end
24
+ end.parse!(args)
25
+ rescue OptionParser::InvalidOption
26
+ # nothing
27
+ end
28
+
29
+ args.delete("-i")
30
+ args.delete(options[:iterations].to_s)
31
+ args.delete("-f")
32
+ args.delete(options[:files])
33
+
34
+ rspec_core_options = super(args)
35
+ options.merge(rspec_core_options)
36
+ end
37
+ # rubocop:enable Metrics/MethodLength
38
+ # rubocop:enable Metrics/AbcSize
39
+ end
40
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RepeatTest
4
+ # RspecRunner class to run RSpec
5
+ class RspecRunner
6
+ def initialize(options:, files:)
7
+ @options = options
8
+ @files = files
9
+ end
10
+
11
+ def run
12
+ system("bundle exec rspec #{files} #{options}")
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RepeatTest
4
+ VERSION = "0.0.1"
5
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "repeat_test/version"
4
+ require_relative "repeat_test/cli"
5
+ require_relative "repeat_test/configuration_options"
6
+ require_relative "repeat_test/parser"
7
+ require_relative "repeat_test/rspec_runner"
8
+
9
+ module RepeatTest
10
+ class Error < StandardError; end
11
+ # Your code goes here...
12
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/repeat_test/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "repeat_test"
7
+ spec.version = RepeatTest::VERSION
8
+ spec.authors = ["Masato Yamashita"]
9
+ spec.email = ["4653960+M-Yamashita01@users.noreply.github.com"]
10
+
11
+ spec.summary = "Repeat test"
12
+ spec.description = "You can repeat tests you specified."
13
+ spec.homepage = "https://github.com/M-Yamashita01/repeat_test"
14
+ spec.license = "MIT"
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/M-Yamashita01/repeat_test"
19
+ spec.metadata["changelog_uri"] = "https://github.com/M-Yamashita01/repeat_test"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
24
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ # Uncomment to register a new dependency of your gem
31
+ # spec.add_dependency "example-gem", "~> 1.0"
32
+
33
+ # For more information and examples about making a new gem, checkout our
34
+ # guide at: https://bundler.io/guides/creating_gem.html
35
+
36
+ spec.add_development_dependency "rake", "~> 13.0"
37
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: repeat_test
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Masato Yamashita
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-07-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ description: You can repeat tests you specified.
28
+ email:
29
+ - 4653960+M-Yamashita01@users.noreply.github.com
30
+ executables:
31
+ - repeat_test
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - ".github/workflows/release.yaml"
36
+ - ".github/workflows/rspec.yml"
37
+ - ".github/workflows/rubocop.yml"
38
+ - ".gitignore"
39
+ - ".rspec"
40
+ - ".rubocop.yml"
41
+ - ".ruby-version"
42
+ - Gemfile
43
+ - Gemfile.lock
44
+ - LICENSE.txt
45
+ - README.md
46
+ - Rakefile
47
+ - bin/console
48
+ - bin/repeat_test
49
+ - bin/setup
50
+ - exe/repeat_test
51
+ - lib/repeat_test.rb
52
+ - lib/repeat_test/cli.rb
53
+ - lib/repeat_test/configuration_options.rb
54
+ - lib/repeat_test/parser.rb
55
+ - lib/repeat_test/rspec_runner.rb
56
+ - lib/repeat_test/version.rb
57
+ - repeat_test.gemspec
58
+ homepage: https://github.com/M-Yamashita01/repeat_test
59
+ licenses:
60
+ - MIT
61
+ metadata:
62
+ homepage_uri: https://github.com/M-Yamashita01/repeat_test
63
+ source_code_uri: https://github.com/M-Yamashita01/repeat_test
64
+ changelog_uri: https://github.com/M-Yamashita01/repeat_test
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 3.1.0
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubygems_version: 3.3.27
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Repeat test
84
+ test_files: []