-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
178 lines (163 loc) · 8.11 KB
/
Rakefile
File metadata and controls
178 lines (163 loc) · 8.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# frozen_string_literal: true
# kettle-jem:freeze
# To retain chunks of comments & code during bash-merge templating:
# Wrap custom sections with freeze markers (e.g., as above and below this comment chunk).
# bash-merge will then preserve content between those markers across template runs.
# kettle-jem:unfreeze
# bash-merge Rakefile v1.0.0 - 2026-04-05
# Ruby 2.3 (Safe Navigation) or higher required
#
# MIT License (see License.txt)
#
# Copyright (c) 2026 Peter H. Boling (galtzo.com)
#
# Expected to work in any project that uses Bundler.
#
# Sets up tasks for appraisal, floss_funding, rspec, minitest, rubocop, reek, yard, and stone_checksums.
#
# rake appraisal:install # Install Appraisal gemfiles (initial setup...
# rake appraisal:reset # Delete Appraisal lockfiles (gemfiles/*.gemfile.lock)
# rake appraisal:update # Update Appraisal gemfiles and run RuboCop...
# rake bench # Run all benchmarks (alias for bench:run)
# rake bench:list # List available benchmark scripts
# rake bench:run # Run all benchmark scripts (skips on CI)
# rake build:generate_checksums # Generate both SHA256 & SHA512 checksums i...
# rake bundle:audit:check # Checks the Gemfile.lock for insecure depe...
# rake bundle:audit:update # Updates the bundler-audit vulnerability d...
# rake ci:act[opt] # Run 'act' with a selected workflow
# rake coverage # Run specs w/ coverage and open results in...
# rake default # Default tasks aggregator
# rake install # Build and install bash-merge-1.0.0.gem in...
# rake install:local # Build and install bash-merge-1.0.0.gem in...
# rake kettle:jem:install # Install bash-merge GitHub automation and ...
# rake kettle:jem:selftest # Self-test: template bash-merge against itse...
# rake kettle:jem:template # Template bash-merge files into the curren...
# rake reek # Check for code smells
# rake reek:update # Run reek and store the output into the RE...
# rake release[remote] # Create tag v1.0.0 and build and push kett...
# rake rubocop_gradual # Run RuboCop Gradual
# rake rubocop_gradual:autocorrect # Run RuboCop Gradual with autocorrect (onl...
# rake rubocop_gradual:autocorrect_all # Run RuboCop Gradual with autocorrect (saf...
# rake rubocop_gradual:check # Run RuboCop Gradual to check the lock file
# rake rubocop_gradual:force_update # Run RuboCop Gradual to force update the l...
# rake rubocop_gradual_debug # Run RuboCop Gradual
# rake rubocop_gradual_debug:autocorrect # Run RuboCop Gradual with autocorrect (onl...
# rake rubocop_gradual_debug:autocorrect_all # Run RuboCop Gradual with autocorrect (saf...
# rake rubocop_gradual_debug:check # Run RuboCop Gradual to check the lock file
# rake rubocop_gradual_debug:force_update # Run RuboCop Gradual to force update the l...
# rake spec # Run RSpec code examples
# rake test # Run tests
# rake yard # Generate YARD Documentation
#
# :nocov:
require "bundler/gem_tasks" if !Dir[File.join(__dir__, "*.gemspec")].empty?
# :nocov:
# Define a base default task early so other files can enhance it.
desc "Default tasks aggregator"
task :default do
puts "Default task complete."
end
# External gems that define tasks - add here!
require "kettle/dev"
### DUPLICATE DRIFT TASKS
begin
require "kettle/drift"
Kettle::Drift.install_tasks
rescue LoadError
desc("(stub) kettle:drift:check is unavailable")
task("kettle:drift:check") do
warn("NOTE: kettle-drift isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
desc("(stub) kettle:drift:update is unavailable")
task("kettle:drift:update") do
warn("NOTE: kettle-drift isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
desc("(stub) kettle:drift:force_update is unavailable")
task("kettle:drift:force_update") do
warn("NOTE: kettle-drift isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
desc("(stub) kettle:drift is unavailable")
task("kettle:drift" => "kettle:drift:update")
end
### TEMPLATING TASKS
begin
require "kettle/jem"
rescue LoadError
desc("(stub) kettle:jem:selftest is unavailable")
task("kettle:jem:selftest") do
warn("NOTE: kettle-jem isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end
### SPEC TASKS
# Run FFI specs first (before the collision of MRI+FFI backends pollutes the environment),
# then run remaining specs. This ensures FFI tests get a clean environment
# while still validating that BackendConflict protection works.
#
# For coverage aggregation with SimpleCov merging:
# - Each task uses a unique K_SOUP_COV_COMMAND_NAME so SimpleCov tracks them separately
# - K_SOUP_COV_USE_MERGING=true must be set in .envrc for results to merge
# - K_SOUP_COV_MERGE_TIMEOUT should be set long enough for all tasks to complete
begin
require "rspec/core/rake_task"
# FFI specs run first in a clean environment
# Uses :ffi_backend tag which triggers isolated_test_mode in dependency_tags.rb
# This prevents MRI backend from being loaded during availability checks
desc("Run FFI backend specs first (before MRI loads)")
RSpec::Core::RakeTask.new(:ffi_specs) do |t|
t.pattern = "./spec/**/*_spec.rb"
t.rspec_opts = "--tag ffi_backend"
end
# Set unique command name at execution time for SimpleCov merging
desc("Set SimpleCov command name for FFI specs")
task(:set_ffi_command_name) do
ENV["K_SOUP_COV_MIN_HARD"] = "false"
ENV["MAX_ROWS"] = "0"
ENV["K_SOUP_COV_COMMAND_NAME"] = "FFI Specs"
# CRITICAL: Restrict native backends to FFI only
# This prevents MRI.available? from being called during backend auto-selection
ENV["TREE_HAVER_NATIVE_BACKEND"] = "ffi"
end
Rake::Task[:ffi_specs].enhance([:set_ffi_command_name])
# All other specs run after FFI specs
# Excludes :ffi_backend tests (which already ran in ffi_specs)
desc("Run non-FFI specs (after FFI specs have run)")
RSpec::Core::RakeTask.new(:remaining_specs) do |t|
t.pattern = "./spec/**/*_spec.rb"
t.rspec_opts = "--tag ~ffi_backend"
end
desc("Set SimpleCov command name for remaining specs")
task(:set_remaining_command_name) do
ENV["K_SOUP_COV_MIN_HARD"] = "false"
ENV["MAX_ROWS"] = "0"
ENV["K_SOUP_COV_COMMAND_NAME"] = "Remaining Specs"
# CRITICAL: Clear the FFI-only restriction set by ffi_specs
# This allows remaining specs to use MRI and other backends
ENV.delete("TREE_HAVER_NATIVE_BACKEND")
end
Rake::Task[:remaining_specs].enhance([:set_remaining_command_name])
# kettle-dev creates an RSpec::Core::RakeTask.new(:spec) which has both
# prerequisites and actions. We will leave that, and the default test task, alone,
# and use *magic* here.
Rake::Task[:magic].clear if Rake::Task.task_defined?(:magic)
desc("Run specs with FFI tests first, then backend matrix, then remaining tests")
task(magic: [:ffi_specs, :remaining_specs])
rescue LoadError
desc("(stub) spec is unavailable")
task(:spec) do # rubocop:disable Rake/DuplicateTask
warn("NOTE: rspec isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
desc("(stub) test is unavailable")
task(:test) do # rubocop:disable Rake/DuplicateTask
warn("NOTE: rspec isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end
### RELEASE TASKS
# Setup stone_checksums
begin
require "stone_checksums"
rescue LoadError
desc("(stub) build:generate_checksums is unavailable")
task("build:generate_checksums") do
warn("NOTE: stone_checksums isn't installed, or is disabled for #{RUBY_VERSION} in the current environment")
end
end