Skip to content

Commit cbe965e

Browse files
committed
🔨 Improved default rake tasks
- Compatibility with kettle-soup-cover v1.0.6
1 parent ae7ac14 commit cbe965e

File tree

5 files changed

+51
-42
lines changed

5 files changed

+51
-42
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export K_SOUP_COV_MIN_BRANCH=100 # Means you want to enforce X% branch coverage
2323
export K_SOUP_COV_MIN_LINE=100 # Means you want to enforce X% line coverage
2424
export K_SOUP_COV_MIN_HARD=true # Means you want the build to fail if the coverage thresholds are not met
2525
export K_SOUP_COV_MULTI_FORMATTERS=true
26+
export K_SOUP_COV_OPEN_BIN= # Means don't try to open coverage results in browser
2627
export MAX_ROWS=1 # Setting for simplecov-console gem for tty output, limits to the worst N rows of bad coverage
2728

2829
# Internal Debugging Controls

Gemfile.lock

+7-7
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ GEM
6969
rdoc (>= 4.0.0)
7070
reline (>= 0.4.2)
7171
json (2.11.3)
72-
kettle-soup-cover (1.0.5)
72+
kettle-soup-cover (1.0.6)
7373
simplecov (~> 0.22)
7474
simplecov-cobertura (~> 2.1)
7575
simplecov-console (~> 0.9, >= 0.9.1)
7676
simplecov-html (~> 0.12)
7777
simplecov-lcov (~> 0.8)
7878
simplecov-rcov (~> 0.3, >= 0.3.3)
7979
simplecov_json_formatter (~> 0.1, >= 0.1.4)
80-
version_gem (~> 1.1, >= 1.1.4)
80+
version_gem (~> 1.1, >= 1.1.7)
8181
language_server-protocol (3.17.0.4)
8282
lint_roller (1.1.0)
8383
logger (1.7.0)
@@ -94,7 +94,7 @@ GEM
9494
pry (0.15.2)
9595
coderay (~> 1.1)
9696
method_source (~> 1.0)
97-
psych (5.2.3)
97+
psych (5.2.4)
9898
date
9999
stringio
100100
racc (1.8.1)
@@ -120,13 +120,13 @@ GEM
120120
rspec-block_is_expected (1.0.6)
121121
rspec-core (3.13.3)
122122
rspec-support (~> 3.13.0)
123-
rspec-expectations (3.13.3)
123+
rspec-expectations (3.13.4)
124124
diff-lcs (>= 1.2.0, < 2.0)
125125
rspec-support (~> 3.13.0)
126-
rspec-mocks (3.13.2)
126+
rspec-mocks (3.13.3)
127127
diff-lcs (>= 1.2.0, < 2.0)
128128
rspec-support (~> 3.13.0)
129-
rspec-support (3.13.2)
129+
rspec-support (3.13.3)
130130
rubocop (1.75.4)
131131
json (~> 2.3)
132132
language_server-protocol (~> 3.17.0.2)
@@ -244,7 +244,7 @@ DEPENDENCIES
244244
bundler-audit (~> 0.9.2)
245245
debug (>= 1.0.0)
246246
github-markup (~> 5.0, >= 5.0.1)
247-
kettle-soup-cover (~> 1.0, >= 1.0.4)
247+
kettle-soup-cover (~> 1.0, >= 1.0.6)
248248
pry (~> 0.14)
249249
rake (~> 13.0)
250250
rdoc (~> 6.11)

Rakefile

+34-31
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ require "bundler/gem_tasks"
44

55
defaults = []
66

7+
### DEVELOPMENT TASKS
78
# Setup Kettle Soup Cover
89
begin
910
require "kettle-soup-cover"
@@ -19,18 +20,6 @@ rescue LoadError
1920
end
2021
end
2122

22-
# Setup stone_checksums
23-
begin
24-
require "stone_checksums"
25-
26-
GemChecksums.install_tasks
27-
rescue LoadError
28-
desc("(stub) build:generate_checksums is unavailable")
29-
task("build:generate_checksums") do
30-
warn("NOTE: stone_checksums isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
31-
end
32-
end
33-
3423
# Setup Bundle Audit
3524
begin
3625
require "bundler/audit/task"
@@ -52,7 +41,8 @@ begin
5241
require "rspec/core/rake_task"
5342

5443
RSpec::Core::RakeTask.new(:spec)
55-
defaults << "spec"
44+
# This takes the place of `coverage` task when running as CI=true
45+
defaults << "spec" if Kettle::Soup::Cover::IS_CI
5646
rescue LoadError
5747
desc("spec task stub")
5848
task(:spec) do
@@ -63,20 +53,16 @@ end
6353
desc "run spec task with test task"
6454
task test: :spec
6555

66-
# Setup Reek
56+
# Setup RuboCop-LTS
6757
begin
68-
require "reek/rake/task"
58+
require "rubocop/lts"
6959

70-
Reek::Rake::Task.new do |t|
71-
t.fail_on_error = true
72-
t.verbose = false
73-
t.source_files = "{lib,spec}/**/*.rb"
74-
end
75-
defaults << "reek"
60+
Rubocop::Lts.install_tasks
61+
defaults << "rubocop_gradual"
7662
rescue LoadError
77-
desc("(stub) reek is unavailable")
78-
task(:reek) do
79-
warn("NOTE: reek isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
63+
desc("(stub) rubocop_gradual is unavailable")
64+
task(:rubocop_gradual) do
65+
warn("NOTE: rubocop-lts isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
8066
end
8167
end
8268

@@ -98,16 +84,33 @@ rescue LoadError
9884
end
9985
end
10086

101-
# Setup RuboCop-LTS
87+
# Setup Reek
10288
begin
103-
require "rubocop/lts"
89+
require "reek/rake/task"
10490

105-
Rubocop::Lts.install_tasks
106-
defaults << "rubocop_gradual"
91+
Reek::Rake::Task.new do |t|
92+
t.fail_on_error = true
93+
t.verbose = false
94+
t.source_files = "{lib,spec}/**/*.rb"
95+
end
96+
defaults << "reek"
10797
rescue LoadError
108-
desc("(stub) rubocop_gradual is unavailable")
109-
task(:rubocop_gradual) do
110-
warn("NOTE: rubocop-lts isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
98+
desc("(stub) reek is unavailable")
99+
task(:reek) do
100+
warn("NOTE: reek isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
101+
end
102+
end
103+
104+
### RELEASE TASKS
105+
# Setup stone_checksums
106+
begin
107+
require "stone_checksums"
108+
109+
GemChecksums.install_tasks
110+
rescue LoadError
111+
desc("(stub) build:generate_checksums is unavailable")
112+
task("build:generate_checksums") do
113+
warn("NOTE: stone_checksums isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
111114
end
112115
end
113116

gemfiles/modular/coverage.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
# We run code coverage on the latest version of Ruby only.
44

55
# Coverage
6-
gem "kettle-soup-cover", "~> 1.0", ">= 1.0.4"
6+
gem "kettle-soup-cover", "~> 1.0", ">= 1.0.6", require: false

spec/spec_helper.rb

+8-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@
1616
# kettle-soup-cover does not require "simplecov", but
1717
# we do that next, and that has a side effect of running `.simplecov`
1818
# Also, we must avoid loading "version_gem" (this gem) via "kettle-soup-cover",
19-
# so instead of the normal kettle-soup-cover we use kettle/soup/cover.
20-
require "kettle/soup/cover"
21-
require "simplecov" if defined?(Kettle) && Kettle::Soup::Cover::DO_COV
19+
# so instead of the normal kettle-soup-cover, or kettle/soup/cover,
20+
# we do some proper hacking around the internals. Fortunately 2 gems, one author!
21+
# require "kettle/soup/cover"
22+
require "kettle/change"
23+
require "kettle/soup/cover/version"
24+
require "kettle/soup/cover/loaders"
25+
require "kettle/soup/cover/constants"
26+
require "simplecov" if Kettle::Soup::Cover::Constants::DO_COV
2227
rescue LoadError
2328
nil
2429
end

0 commit comments

Comments
 (0)