ci-helper 0.2.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/ci_helper.gemspec +1 -0
- data/lib/ci_helper.rb +2 -0
- data/lib/ci_helper/commands.rb +1 -1
- data/lib/ci_helper/commands/check_coverage.rb +32 -0
- data/lib/ci_helper/commands/check_sidekiq_scheduler_config.rb +35 -0
- data/lib/ci_helper/tools/inflector.rb +2 -0
- data/lib/ci_helper/version.rb +1 -1
- data/lib/tasks/sequel_management.rake +2 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61e68cfd07a49efbe7edeedfd4bb579d5359caa0b6660bf00d6a6f8cd653226b
|
4
|
+
data.tar.gz: 915c87759e1da667c808d7136e4c3dc5fcf4be1ae81f3476b11b4b006542ecf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e8d5ecaa8724f9f44df8606ebd1be1d64fe010e8c5f27947ee5e320b43b782ec97baa0e52c82b51190fcb68ef184c0aaa98e08f0cc31a8a5f51087348626572
|
7
|
+
data.tar.gz: 5c48c38e8847e5a00d6b987a015d580ee1329b1fc32d9ba84963e677f59cff731eb08ffb6d90578277b82883c28bc7bb50484e129dff4de2445ffa59276925c1
|
data/README.md
CHANGED
@@ -47,7 +47,7 @@ List of available commands:
|
|
47
47
|
If you want to use `ActiveRecord::Migrator`, you'll have to write rake task by your own.
|
48
48
|
* **RubocopLint** — executes rubocop linter. Does not accept flags.
|
49
49
|
* **RunSpecs** — executes `rspec` in project root.
|
50
|
-
Accepted flags: `--node-index`, `node-total`, `with-database`, `split-resultset`.
|
50
|
+
Accepted flags: `--node-index`, `node-total`, `with-database`, `split-resultset`.
|
51
51
|
* `--node-index` — if you run specs in parallel in CI, then you might use this flag.
|
52
52
|
* `--node-total` — if you run specs in parallel in CI, then you might use this flag.
|
53
53
|
* `--with-database` — if you want to prepare database before executing specs,
|
@@ -62,6 +62,18 @@ Accepted flags: `--node-index`, `node-total`, `with-database`, `split-resultset`
|
|
62
62
|
delimited by coma.
|
63
63
|
* `--ignored-paths [values]` - accepts path patterns that should be ignored,
|
64
64
|
delimited by coma.
|
65
|
+
* **CheckCoverage** — checks coverage by executing `SimpleCov::collate`.
|
66
|
+
Accepted flags: `--split-resultset`, `--setup-file-path`.
|
67
|
+
* `--split-resultset` — if you execute command `RunSpecs` with `--split-resultset true`,
|
68
|
+
you also should set this flag to `true`. If this flag set to `true`, final coverage will be
|
69
|
+
calculated by merging results in all files, matching the mask `coverage/resultset.*.json`.
|
70
|
+
By default final coverage is calculated using result from `coverage/.resultset.json`.
|
71
|
+
* `--setup-file-path` — relative path to your `.rb` file, which setups `SimpleCov`.
|
72
|
+
Usually it is `spec_helper.rb`.
|
73
|
+
* **CheckSidekiqSchedulerConfig** — checks `sidekiq_scheduler` config by trying to resolve jobs constants via `rails runner`.
|
74
|
+
Accepted flags: `--config-path`
|
75
|
+
* `--config-path` — relative path to your config yaml file with schedule.
|
76
|
+
Usually it is `config/sidekiq_scheduler.yml`.
|
65
77
|
|
66
78
|
### Rake Tasks
|
67
79
|
|
data/ci_helper.gemspec
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.add_runtime_dependency "colorize", "~> 0.8"
|
28
28
|
spec.add_runtime_dependency "dry-inflector", "~> 0.2"
|
29
|
+
spec.add_runtime_dependency "umbrellio-sequel-plugins", "~> 0.4"
|
29
30
|
|
30
31
|
spec.add_development_dependency "bundler"
|
31
32
|
spec.add_development_dependency "bundler-audit"
|
data/lib/ci_helper.rb
CHANGED
data/lib/ci_helper/commands.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "simplecov"
|
4
|
+
|
5
|
+
module CIHelper
|
6
|
+
module Commands
|
7
|
+
class CheckCoverage < BaseCommand
|
8
|
+
def call
|
9
|
+
require(path.join(setup_file_path)) unless setup_file_path.nil?
|
10
|
+
|
11
|
+
::SimpleCov.collate(files)
|
12
|
+
0
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def files
|
18
|
+
return path.glob("coverage/resultset.*.json") if split_resultset?
|
19
|
+
|
20
|
+
[path.join("coverage/.resultset.json")]
|
21
|
+
end
|
22
|
+
|
23
|
+
def split_resultset?
|
24
|
+
options[:split_resultset] == "true"
|
25
|
+
end
|
26
|
+
|
27
|
+
def setup_file_path
|
28
|
+
options[:setup_file_path]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "yaml"
|
4
|
+
|
5
|
+
module CIHelper
|
6
|
+
module Commands
|
7
|
+
class CheckSidekiqSchedulerConfig < BaseCommand
|
8
|
+
def call
|
9
|
+
return 0 if job_constants.empty?
|
10
|
+
|
11
|
+
cmd = craft_jobs_const_get_cmd
|
12
|
+
execute_with_rails_runner(cmd)
|
13
|
+
0
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def execute_with_rails_runner(cmd)
|
19
|
+
execute("bundle exec rails runner \"#{cmd}\"")
|
20
|
+
end
|
21
|
+
|
22
|
+
def craft_jobs_const_get_cmd
|
23
|
+
"#{job_constants}.each { |x| Object.const_get(x) }"
|
24
|
+
end
|
25
|
+
|
26
|
+
def job_constants
|
27
|
+
@job_constants ||= config.values.reject(&:nil?).flat_map(&:keys).uniq
|
28
|
+
end
|
29
|
+
|
30
|
+
def config
|
31
|
+
@config ||= YAML.load_file(options[:config_path])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -5,9 +5,11 @@ module CIHelper
|
|
5
5
|
class Inflector < Delegator
|
6
6
|
include Singleton
|
7
7
|
|
8
|
+
# rubocop:disable Lint/MissingSuper
|
8
9
|
def initialize
|
9
10
|
@inflector = Dry::Inflector.new { |inflections| inflections.acronym "DB" }
|
10
11
|
end
|
12
|
+
# rubocop:enable Lint/MissingSuper
|
11
13
|
|
12
14
|
def __getobj__
|
13
15
|
@inflector
|
data/lib/ci_helper/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "logger"
|
4
|
+
require "sequel/timestamp_migrator_undo_extension"
|
4
5
|
|
5
6
|
class SequelManagement
|
6
7
|
include Rake::DSL
|
@@ -8,7 +9,7 @@ class SequelManagement
|
|
8
9
|
MIGRATIONS_PATH = "db/migrate"
|
9
10
|
|
10
11
|
def initialize
|
11
|
-
self.logger = Logger.new(
|
12
|
+
self.logger = Logger.new($stdout)
|
12
13
|
|
13
14
|
define_db_task!
|
14
15
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ci-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JustAnotherDude
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.2'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: umbrellio-sequel-plugins
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.4'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,8 +190,10 @@ files:
|
|
176
190
|
- lib/ci_helper/cli.rb
|
177
191
|
- lib/ci_helper/commands.rb
|
178
192
|
- lib/ci_helper/commands/bundler_audit.rb
|
193
|
+
- lib/ci_helper/commands/check_coverage.rb
|
179
194
|
- lib/ci_helper/commands/check_db_development.rb
|
180
195
|
- lib/ci_helper/commands/check_db_rollback.rb
|
196
|
+
- lib/ci_helper/commands/check_sidekiq_scheduler_config.rb
|
181
197
|
- lib/ci_helper/commands/check_spec_suffixes.rb
|
182
198
|
- lib/ci_helper/commands/rubocop_lint.rb
|
183
199
|
- lib/ci_helper/commands/run_specs.rb
|