-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
153 lines (139 loc) · 6.36 KB
/
Rakefile
File metadata and controls
153 lines (139 loc) · 6.36 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
# frozen_string_literal: true
# kettle-dev Rakefile v1.1.60 - 2025-11-23
# Ruby 2.3 (Safe Navigation) or higher required
#
# MIT License (see License.txt)
#
# Copyright (c) 2025 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 kettle-dev-1.0.0.gem in...
# rake install:local # Build and install kettle-dev-1.0.0.gem in...
# rake kettle:dev:install # Install kettle-dev GitHub automation and ...
# rake kettle:dev:template # Template kettle-dev 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
#
require "bundler/gem_tasks" if !Dir[File.join(__dir__, "*.gemspec")].empty?
# 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"
### SPEC TASKS
# 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"
# 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")
RSpec::Core::RakeTask.new(:magic) do |t|
t.pattern = "./spec/**/*_spec.rb"
end
desc("Set SimpleCov command name for remaining specs")
task(:set_coverage_command_name) do
ENV["K_SOUP_COV_COMMAND_NAME"] = "Test Coverage"
end
Rake::Task[:magic].enhance([:set_coverage_command_name])
Rake::Task[:coverage].clear if Rake::Task.task_defined?(:coverage)
desc("Slap magic onto the main coverage task")
task(coverage: [:magic])
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
### BENCHMARK TASKS
namespace :bench do
desc("List available benchmark scripts")
task(:list) do
benchmark_files = Dir[File.join(__dir__, "benchmarks", "*.rb")]
if benchmark_files.empty?
puts "No benchmark scripts found in benchmarks/"
else
puts "Available benchmark scripts:"
benchmark_files.each do |file|
puts " - #{File.basename(file, ".rb")}"
end
end
end
desc("Run comparison benchmark (token-resolver vs gsub vs sprintf)")
task(:comparison) do
if ENV["CI"]
puts "Skipping benchmarks in CI environment"
else
ruby File.join(__dir__, "benchmarks", "comparison.rb")
end
end
desc("Run all benchmark scripts (skips on CI)")
task(:run) do
if ENV["CI"]
puts "Skipping benchmarks in CI environment"
else
benchmark_files = Dir[File.join(__dir__, "benchmarks", "*.rb")]
if benchmark_files.empty?
puts "No benchmark scripts found in benchmarks/"
else
benchmark_files.each do |file|
puts "\n" + "=" * 80
puts "Running: #{File.basename(file)}"
puts "=" * 80
ruby file
end
end
end
end
end
desc("Run all benchmarks (alias for bench:run)")
task(bench: ["bench:run"])
### 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