Skip to content

Commit 8650e08

Browse files
committed
📝 Document kettle-rb usage
1 parent d4a6861 commit 8650e08

1 file changed

Lines changed: 65 additions & 1 deletion

File tree

README.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-ta
2121

2222
## 🌻 Synopsis <a href="https://discord.gg/3qme4XHNKN"><img alt="Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px.svg" width="8%" align="right"/></a> <a href="https://ruby-toolbox.com"><img alt="ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5" src="https://logos.galtzo.com/assets/images/ruby-lang/avatar-128px.svg" width="8%" align="right"/></a>
2323

24+
`kettle-rb` is the small shared Ruby library for the kettle-dev toolchain.
25+
26+
Its first public responsibility is `Kettle::Rb::CompatMatrix`: a single source
27+
of truth for Ruby engine compatibility data used by `kettle-jem`,
28+
`kettle-dev`, and related release/template tooling. The matrix records MRI,
29+
JRuby, and TruffleRuby versions, workflow Ruby buckets, RubyGems/Bundler
30+
policy, Rails appraisal hints, and RuboCop LTS selection data.
31+
32+
Use it when tooling needs to answer questions like:
33+
34+
- Which Ruby workflow should represent this engine?
35+
- Which RuboCop LTS family matches a minimum supported Ruby?
36+
- Which `rubocop-rubyN_N` gem and rubocop-lts branch belong together?
37+
- Which Rails appraisal version is the newest stable target for a Ruby bucket?
38+
2439
## 💡 Info you can shake a stick at
2540

2641
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
@@ -122,9 +137,58 @@ gem install kettle-rb
122137

123138
## ⚙️ Configuration
124139

140+
`kettle-rb` has no runtime configuration. The compatibility matrix is packaged
141+
with the gem and exposed as immutable data.
142+
143+
Tooling that needs local, unreleased kettle-dev siblings should use normal
144+
Bundler/Gemfile wiring through `KETTLE_RB_DEV`; do not alter `$LOAD_PATH`.
145+
For example, downstream kettle gems can resolve a local checkout with:
146+
147+
```console
148+
KETTLE_RB_DEV=/home/pboling/src/my/kettle-dev bundle install
149+
```
150+
151+
After changing matrix data, update this gem first, release it, then bump the
152+
consumer dependency floors in gems such as `kettle-dev` and `kettle-jem`.
153+
125154
## 🔧 Basic Usage
126155

127-
TODO: Write usage instructions here
156+
Require the library:
157+
158+
```ruby
159+
require "kettle/rb"
160+
```
161+
162+
Look up an engine or Ruby entry:
163+
164+
```ruby
165+
entry = Kettle::Rb::CompatMatrix.entry("truffleruby-34.0")
166+
167+
entry.ruby # => "truffleruby-34.0.1"
168+
entry.engine # => "truffleruby"
169+
entry.mri # => "3.4"
170+
entry.workflow_ruby # => "3.4"
171+
```
172+
173+
Select generated workflow behavior:
174+
175+
```ruby
176+
Kettle::Rb::CompatMatrix.engine_workflow("truffle")
177+
# => "truffleruby"
178+
179+
Kettle::Rb::CompatMatrix.workflow_ruby_floor("truffleruby-23.1")
180+
# => "3.1"
181+
```
182+
183+
Select RuboCop LTS template data:
184+
185+
```ruby
186+
Kettle::Rb::CompatMatrix.rubocop_template_tokens(Gem::Version.new("3.2"))
187+
# => ["\"~> 24.2\", \">= 24.2.0\"", "rubocop-ruby3_2", "\"~> 3.0\", \">= 3.0.6\""]
188+
189+
Kettle::Rb::CompatMatrix.rubocop_lts_branch_for_gem("rubocop-ruby3_2")
190+
# => "r3_2-even-v24"
191+
```
128192

129193
## 🦷 FLOSS Funding
130194

0 commit comments

Comments
 (0)