ci-helper 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/.editorconfig +9 -0
- data/.github/workflows/ruby.yml +43 -0
- data/.gitignore +8 -0
- data/.rspec +3 -0
- data/.rubocop.yml +12 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +104 -0
- data/LICENSE.txt +21 -0
- data/README.md +32 -0
- data/Rakefile +10 -0
- data/bin/console +7 -0
- data/bin/setup +8 -0
- data/ci_helper.gemspec +38 -0
- data/exe/ci-helper +12 -0
- data/lib/ci_helper.rb +17 -0
- data/lib/ci_helper/cli.rb +44 -0
- data/lib/ci_helper/commands.rb +66 -0
- data/lib/ci_helper/commands/bundler_audit.rb +25 -0
- data/lib/ci_helper/commands/check_db_rollback.rb +19 -0
- data/lib/ci_helper/commands/rubocop_lint.rb +11 -0
- data/lib/ci_helper/commands/run_specs.rb +48 -0
- data/lib/ci_helper/tools/inflector.rb +17 -0
- data/lib/ci_helper/version.rb +5 -0
- metadata +209 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f1aa6bfe29d050175db60010ea49b38125a9f46f0e903348c67145e881b8dc7e
|
|
4
|
+
data.tar.gz: 614acf1d6cd9b22bb7697e54b51437d4cc67e13d65676e82c1ba934dc43e8f50
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: a99b5df7187a385ef8895a76a3d4631a540d5a72deab1c704cda1c7bb710a6818ac29a69a702f6e6bb658ef5110af228e972a88a9ac985c0fd30231bcd318a66
|
|
7
|
+
data.tar.gz: 3268627ed3a52c57f0b8328498c84a97c416ccb703c860d4599baee885195e7143734ec0096521375bb6f0d40cf5fbd12863b5b25ba5ba32bfd59c52ca97eddc
|
data/.editorconfig
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
+
|
|
8
|
+
name: Ruby
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
branches: [ master ]
|
|
13
|
+
pull_request:
|
|
14
|
+
branches: [ master ]
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
test:
|
|
18
|
+
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v2
|
|
23
|
+
- name: Set up Ruby
|
|
24
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
|
25
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
|
26
|
+
# uses: ruby/setup-ruby@v1
|
|
27
|
+
uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
|
28
|
+
with:
|
|
29
|
+
ruby-version: 2.7
|
|
30
|
+
- name: Install dependencies
|
|
31
|
+
run: bundle install && gem install bundler-audit
|
|
32
|
+
- name: Build and install gem to systems gems
|
|
33
|
+
run: bundle exec rake install
|
|
34
|
+
- name: Run Linter
|
|
35
|
+
run: ci-helper RubocopLint
|
|
36
|
+
- name: Run specs
|
|
37
|
+
run: ci-helper RunSpecs
|
|
38
|
+
- name: Audit
|
|
39
|
+
run: ci-helper BundlerAudit
|
|
40
|
+
- name: Coveralls
|
|
41
|
+
uses: coverallsapp/github-action@v1.1.1
|
|
42
|
+
with:
|
|
43
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
ci-helper (0.1.0)
|
|
5
|
+
colorize (~> 0.8)
|
|
6
|
+
dry-inflector (~> 0.2)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
activesupport (6.0.3.1)
|
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
13
|
+
i18n (>= 0.7, < 2)
|
|
14
|
+
minitest (~> 5.1)
|
|
15
|
+
tzinfo (~> 1.1)
|
|
16
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
|
17
|
+
ast (2.4.1)
|
|
18
|
+
bundler-audit (0.6.1)
|
|
19
|
+
bundler (>= 1.2.0, < 3)
|
|
20
|
+
thor (~> 0.18)
|
|
21
|
+
coderay (1.1.3)
|
|
22
|
+
colorize (0.8.1)
|
|
23
|
+
concurrent-ruby (1.1.6)
|
|
24
|
+
diff-lcs (1.3)
|
|
25
|
+
docile (1.3.2)
|
|
26
|
+
dry-inflector (0.2.0)
|
|
27
|
+
i18n (1.8.3)
|
|
28
|
+
concurrent-ruby (~> 1.0)
|
|
29
|
+
jaro_winkler (1.5.4)
|
|
30
|
+
method_source (1.0.0)
|
|
31
|
+
minitest (5.14.1)
|
|
32
|
+
parallel (1.19.1)
|
|
33
|
+
parser (2.7.1.3)
|
|
34
|
+
ast (~> 2.4.0)
|
|
35
|
+
pry (0.13.1)
|
|
36
|
+
coderay (~> 1.1)
|
|
37
|
+
method_source (~> 1.0)
|
|
38
|
+
rack (2.2.2)
|
|
39
|
+
rainbow (3.0.0)
|
|
40
|
+
rake (13.0.1)
|
|
41
|
+
rexml (3.2.4)
|
|
42
|
+
rspec (3.9.0)
|
|
43
|
+
rspec-core (~> 3.9.0)
|
|
44
|
+
rspec-expectations (~> 3.9.0)
|
|
45
|
+
rspec-mocks (~> 3.9.0)
|
|
46
|
+
rspec-core (3.9.2)
|
|
47
|
+
rspec-support (~> 3.9.3)
|
|
48
|
+
rspec-expectations (3.9.2)
|
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
50
|
+
rspec-support (~> 3.9.0)
|
|
51
|
+
rspec-mocks (3.9.1)
|
|
52
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
53
|
+
rspec-support (~> 3.9.0)
|
|
54
|
+
rspec-support (3.9.3)
|
|
55
|
+
rubocop (0.81.0)
|
|
56
|
+
jaro_winkler (~> 1.5.1)
|
|
57
|
+
parallel (~> 1.10)
|
|
58
|
+
parser (>= 2.7.0.1)
|
|
59
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
60
|
+
rexml
|
|
61
|
+
ruby-progressbar (~> 1.7)
|
|
62
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
63
|
+
rubocop-config-umbrellio (0.81.0.78)
|
|
64
|
+
rubocop (= 0.81.0)
|
|
65
|
+
rubocop-performance (= 1.5.2)
|
|
66
|
+
rubocop-rails (= 2.5.0)
|
|
67
|
+
rubocop-rspec (= 1.38.1)
|
|
68
|
+
rubocop-performance (1.5.2)
|
|
69
|
+
rubocop (>= 0.71.0)
|
|
70
|
+
rubocop-rails (2.5.0)
|
|
71
|
+
activesupport
|
|
72
|
+
rack (>= 1.1)
|
|
73
|
+
rubocop (>= 0.72.0)
|
|
74
|
+
rubocop-rspec (1.38.1)
|
|
75
|
+
rubocop (>= 0.68.1)
|
|
76
|
+
ruby-progressbar (1.10.1)
|
|
77
|
+
simplecov (0.18.5)
|
|
78
|
+
docile (~> 1.1)
|
|
79
|
+
simplecov-html (~> 0.11)
|
|
80
|
+
simplecov-html (0.12.2)
|
|
81
|
+
simplecov-lcov (0.8.0)
|
|
82
|
+
thor (0.20.3)
|
|
83
|
+
thread_safe (0.3.6)
|
|
84
|
+
tzinfo (1.2.7)
|
|
85
|
+
thread_safe (~> 0.1)
|
|
86
|
+
unicode-display_width (1.7.0)
|
|
87
|
+
zeitwerk (2.3.0)
|
|
88
|
+
|
|
89
|
+
PLATFORMS
|
|
90
|
+
ruby
|
|
91
|
+
|
|
92
|
+
DEPENDENCIES
|
|
93
|
+
bundler
|
|
94
|
+
bundler-audit
|
|
95
|
+
ci-helper!
|
|
96
|
+
pry
|
|
97
|
+
rake
|
|
98
|
+
rspec
|
|
99
|
+
rubocop-config-umbrellio
|
|
100
|
+
simplecov
|
|
101
|
+
simplecov-lcov
|
|
102
|
+
|
|
103
|
+
BUNDLED WITH
|
|
104
|
+
2.1.4
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 dude
|
|
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,32 @@
|
|
|
1
|
+
# CIHelper [](https://github.com/umbrellio/ci_helper/actions) [](https://coveralls.io/github/umbrellio/ci_helper?branch=master)
|
|
2
|
+
|
|
3
|
+
Documentation about gem here.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'ci_helper'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle install
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install ci_helper
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
TODO: Write usage instructions here
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
|
|
27
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/umbrellio/ci_helper.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
data/bin/setup
ADDED
data/ci_helper.gemspec
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/ci_helper/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "ci-helper"
|
|
7
|
+
spec.version = CIHelper::VERSION
|
|
8
|
+
spec.authors = ["JustAnotherDude"]
|
|
9
|
+
spec.email = ["vanyaz158@gmail.com"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Continuous Integration helpers for Ruby"
|
|
12
|
+
spec.description = "CIHelper is a gem with Continuous Integration helpers for Ruby"
|
|
13
|
+
spec.homepage = "https://github.com/umbrellio"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
|
16
|
+
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/umbrellio/ci_helper"
|
|
19
|
+
|
|
20
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
22
|
+
end
|
|
23
|
+
spec.bindir = "exe"
|
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
|
+
spec.require_paths = ["lib"]
|
|
26
|
+
|
|
27
|
+
spec.add_runtime_dependency "colorize", "~> 0.8"
|
|
28
|
+
spec.add_runtime_dependency "dry-inflector", "~> 0.2"
|
|
29
|
+
|
|
30
|
+
spec.add_development_dependency "bundler"
|
|
31
|
+
spec.add_development_dependency "bundler-audit"
|
|
32
|
+
spec.add_development_dependency "pry"
|
|
33
|
+
spec.add_development_dependency "rake"
|
|
34
|
+
spec.add_development_dependency "rspec"
|
|
35
|
+
spec.add_development_dependency "rubocop-config-umbrellio"
|
|
36
|
+
spec.add_development_dependency "simplecov"
|
|
37
|
+
spec.add_development_dependency "simplecov-lcov"
|
|
38
|
+
end
|
data/exe/ci-helper
ADDED
data/lib/ci_helper.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "colorized_string"
|
|
4
|
+
require "delegate"
|
|
5
|
+
require "dry/inflector"
|
|
6
|
+
require "open3"
|
|
7
|
+
require "pathname"
|
|
8
|
+
require "shellwords"
|
|
9
|
+
require "singleton"
|
|
10
|
+
|
|
11
|
+
require "ci_helper/cli"
|
|
12
|
+
require "ci_helper/commands"
|
|
13
|
+
require "ci_helper/tools/inflector"
|
|
14
|
+
require "ci_helper/version"
|
|
15
|
+
|
|
16
|
+
module CIHelper
|
|
17
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CIHelper
|
|
4
|
+
module CLI
|
|
5
|
+
extend self
|
|
6
|
+
|
|
7
|
+
class Error < StandardError; end
|
|
8
|
+
|
|
9
|
+
def run!(args)
|
|
10
|
+
self.args = args.dup
|
|
11
|
+
prepare!
|
|
12
|
+
perform_command!
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
attr_accessor :args, :command_class, :options
|
|
18
|
+
|
|
19
|
+
def prepare!
|
|
20
|
+
class_name = args.shift
|
|
21
|
+
self.options = parse_options_from(args)
|
|
22
|
+
require(Tools::Inflector.instance.underscore("ci_helper/commands/#{class_name}"))
|
|
23
|
+
self.command_class = Commands.const_get(class_name)
|
|
24
|
+
rescue LoadError => error
|
|
25
|
+
raise Error, "Can't find command with path: #{error.path}"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def parse_options_from(args)
|
|
29
|
+
args.each_slice(2).with_object({}) do |args, options|
|
|
30
|
+
key = Tools::Inflector.instance.underscore(args.first.split("--").last)
|
|
31
|
+
value = args[1] || ""
|
|
32
|
+
raise Error, "Not valid options" if key.empty?
|
|
33
|
+
|
|
34
|
+
options[key.to_sym] = value
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def perform_command!
|
|
39
|
+
command_class.call!(**options).to_i
|
|
40
|
+
rescue CIHelper::Commands::Error => error
|
|
41
|
+
raise Error, error.message
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CIHelper
|
|
4
|
+
module Commands
|
|
5
|
+
class Error < StandardError; end
|
|
6
|
+
|
|
7
|
+
class BaseCommand
|
|
8
|
+
class << self
|
|
9
|
+
def call!(**options)
|
|
10
|
+
new(**options).call
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# :nocov:
|
|
14
|
+
def process_stdout
|
|
15
|
+
@process_stdout ||= STDOUT
|
|
16
|
+
end
|
|
17
|
+
# :nocov:
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def initialize(**options)
|
|
21
|
+
self.options = options
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def execute_with_env(*commands)
|
|
25
|
+
commands = ["export RAILS_ENV=#{env}", *commands] if env
|
|
26
|
+
execute(*commands)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def execute(*commands)
|
|
30
|
+
command = commands.join(" && ")
|
|
31
|
+
|
|
32
|
+
process_stdout.puts(ColorizedString["> "].green.bold + ColorizedString[command].blue.bold)
|
|
33
|
+
|
|
34
|
+
Open3.popen2e(command) do |_stdin, stdout, thread|
|
|
35
|
+
stdout.each_char { |char| process_stdout.print(char) }
|
|
36
|
+
exit_code = thread.value.exitstatus
|
|
37
|
+
|
|
38
|
+
fail!("Bad exit code #{exit_code} for command #{command.inspect}") unless exit_code.zero?
|
|
39
|
+
0
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
attr_accessor :options
|
|
46
|
+
|
|
47
|
+
def env; end
|
|
48
|
+
|
|
49
|
+
def create_and_migrate_database!
|
|
50
|
+
execute_with_env("bundle exec rake db:drop db:create db:migrate")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def fail!(message)
|
|
54
|
+
raise Error, message
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def path
|
|
58
|
+
@path ||= Pathname.pwd
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def process_stdout
|
|
62
|
+
self.class.process_stdout
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CIHelper
|
|
4
|
+
module Commands
|
|
5
|
+
class BundlerAudit < BaseCommand
|
|
6
|
+
def call
|
|
7
|
+
execute(audit_cmd)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
private
|
|
11
|
+
|
|
12
|
+
def audit_cmd
|
|
13
|
+
(+"bundle exec bundler-audit check --update").tap do |audit_cmd|
|
|
14
|
+
if ignored_advisories&.any?
|
|
15
|
+
audit_cmd << " --ignore #{ignored_advisories.join(" ")}"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def ignored_advisories
|
|
21
|
+
@ignored_advisories ||= options[:ignored_advisories]&.split(",")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CIHelper
|
|
4
|
+
module Commands
|
|
5
|
+
class CheckDBRollback < BaseCommand
|
|
6
|
+
def call
|
|
7
|
+
create_and_migrate_database!
|
|
8
|
+
execute_with_env("bundle exec rake db:rollback_new_migrations")
|
|
9
|
+
execute_with_env("bundle exec rake db:migrate")
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def env
|
|
15
|
+
:test
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CIHelper
|
|
4
|
+
module Commands
|
|
5
|
+
class RunSpecs < BaseCommand
|
|
6
|
+
def call
|
|
7
|
+
return if job_files.empty?
|
|
8
|
+
|
|
9
|
+
create_and_migrate_database! if with_database?
|
|
10
|
+
execute("bundle exec rspec #{Shellwords.join(job_files)}")
|
|
11
|
+
return 0 unless split_resultset?
|
|
12
|
+
|
|
13
|
+
execute("mv coverage/.resultset.json coverage/resultset.#{job_index}.json")
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def env
|
|
19
|
+
:test
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def job_files
|
|
23
|
+
all_files = path.glob("spec/**/*_spec.rb")
|
|
24
|
+
sorted_files =
|
|
25
|
+
all_files.map { |x| [x.size, x.relative_path_from(path).to_s] }.sort.map(&:last)
|
|
26
|
+
sorted_files.reverse.select.with_index do |_file, index|
|
|
27
|
+
(index % job_count) == (job_index - 1)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def job_index
|
|
32
|
+
@job_index ||= options[:node_index]&.to_i || 1
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def job_count
|
|
36
|
+
@job_count ||= options[:node_total]&.to_i || 1
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def with_database?
|
|
40
|
+
options[:with_database] == "true"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def split_resultset?
|
|
44
|
+
options[:split_resultset] == "true"
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module CIHelper
|
|
4
|
+
module Tools
|
|
5
|
+
class Inflector < Delegator
|
|
6
|
+
include Singleton
|
|
7
|
+
|
|
8
|
+
def initialize
|
|
9
|
+
@inflector = Dry::Inflector.new { |inflections| inflections.acronym "DB" }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def __getobj__
|
|
13
|
+
@inflector
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ci-helper
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- JustAnotherDude
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: colorize
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.8'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.8'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: dry-inflector
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0.2'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0.2'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bundler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: bundler-audit
|
|
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
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: pry
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rake
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: rspec
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: rubocop-config-umbrellio
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: simplecov
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: simplecov-lcov
|
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '0'
|
|
153
|
+
description: CIHelper is a gem with Continuous Integration helpers for Ruby
|
|
154
|
+
email:
|
|
155
|
+
- vanyaz158@gmail.com
|
|
156
|
+
executables:
|
|
157
|
+
- ci-helper
|
|
158
|
+
extensions: []
|
|
159
|
+
extra_rdoc_files: []
|
|
160
|
+
files:
|
|
161
|
+
- ".editorconfig"
|
|
162
|
+
- ".github/workflows/ruby.yml"
|
|
163
|
+
- ".gitignore"
|
|
164
|
+
- ".rspec"
|
|
165
|
+
- ".rubocop.yml"
|
|
166
|
+
- Gemfile
|
|
167
|
+
- Gemfile.lock
|
|
168
|
+
- LICENSE.txt
|
|
169
|
+
- README.md
|
|
170
|
+
- Rakefile
|
|
171
|
+
- bin/console
|
|
172
|
+
- bin/setup
|
|
173
|
+
- ci_helper.gemspec
|
|
174
|
+
- exe/ci-helper
|
|
175
|
+
- lib/ci_helper.rb
|
|
176
|
+
- lib/ci_helper/cli.rb
|
|
177
|
+
- lib/ci_helper/commands.rb
|
|
178
|
+
- lib/ci_helper/commands/bundler_audit.rb
|
|
179
|
+
- lib/ci_helper/commands/check_db_rollback.rb
|
|
180
|
+
- lib/ci_helper/commands/rubocop_lint.rb
|
|
181
|
+
- lib/ci_helper/commands/run_specs.rb
|
|
182
|
+
- lib/ci_helper/tools/inflector.rb
|
|
183
|
+
- lib/ci_helper/version.rb
|
|
184
|
+
homepage: https://github.com/umbrellio
|
|
185
|
+
licenses:
|
|
186
|
+
- MIT
|
|
187
|
+
metadata:
|
|
188
|
+
homepage_uri: https://github.com/umbrellio
|
|
189
|
+
source_code_uri: https://github.com/umbrellio/ci_helper
|
|
190
|
+
post_install_message:
|
|
191
|
+
rdoc_options: []
|
|
192
|
+
require_paths:
|
|
193
|
+
- lib
|
|
194
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
195
|
+
requirements:
|
|
196
|
+
- - ">="
|
|
197
|
+
- !ruby/object:Gem::Version
|
|
198
|
+
version: 2.7.0
|
|
199
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
200
|
+
requirements:
|
|
201
|
+
- - ">="
|
|
202
|
+
- !ruby/object:Gem::Version
|
|
203
|
+
version: '0'
|
|
204
|
+
requirements: []
|
|
205
|
+
rubygems_version: 3.1.3
|
|
206
|
+
signing_key:
|
|
207
|
+
specification_version: 4
|
|
208
|
+
summary: Continuous Integration helpers for Ruby
|
|
209
|
+
test_files: []
|