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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe12d4e12b312f65bd43218e3443d40c4ab27ce41aeb386bccebf4b9779d292e
4
- data.tar.gz: ec3b1f6d22c637c72dd1600672cd1bb8b960e33727ebf3f16c97e6e10ce25e27
3
+ metadata.gz: 61e68cfd07a49efbe7edeedfd4bb579d5359caa0b6660bf00d6a6f8cd653226b
4
+ data.tar.gz: 915c87759e1da667c808d7136e4c3dc5fcf4be1ae81f3476b11b4b006542ecf2
5
5
  SHA512:
6
- metadata.gz: d0fd1d742b556b1c6c3eac720d0709fb484780c2ac5dfa80f749bd4c4d8a338e6def6082550298c5c768df3fe6a25e65d0bc0333e9a7c2840b8273a30b544328
7
- data.tar.gz: c50a69c1bf32a6ebec2299464063d656bd34af81eaf516935d20b9b55953851f293d5ac7bdaa82372fc79ad91f140ef4a65bda3191506d8a62cee5b7a6851f78
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
 
@@ -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"
@@ -17,4 +17,6 @@ require "ci_helper/tools/colorize"
17
17
  require "ci_helper/tools/inflector"
18
18
  require "ci_helper/version"
19
19
 
20
+ # :nocov:
20
21
  require "ci_helper/railtie" if defined?(Rails)
22
+ # :nocov:
@@ -12,7 +12,7 @@ module CIHelper
12
12
 
13
13
  # :nocov:
14
14
  def process_stdout
15
- @process_stdout ||= STDOUT
15
+ @process_stdout ||= $stdout
16
16
  end
17
17
  # :nocov:
18
18
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CIHelper
4
- VERSION = "0.2.5"
4
+ VERSION = "0.4.0"
5
5
  end
@@ -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(STDOUT)
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.2.5
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-08-31 00:00:00.000000000 Z
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