exercism-rb
xrb is a small CLI that removes friction from the Exercism Ruby workflow.
It remembers the current exercise, runs commands from the right exercise directory, opens your editor, starts IRB or Pry with the solution file loaded, runs tests, and submits the solution file without requiring manual cd work.
This is an independent helper for the Exercism Ruby track, not an official Exercism project.
Install
Install from RubyGems:
gem install exercism-rbMake sure your RubyGems executable directory is in your PATH, then verify the CLI:
xrb versionTo update:
gem update exercism-rbRequirements
- Ruby 3.2+
- Exercism CLI for
xrb newandxrb submit - An editor available on
PATHand configured throughXRB_EDITOR,VISUAL, orEDITORforxrb editand defaultxrb new
Configure the Exercism CLI separately:
exercism configure --token=<your-api-token>Main Flow
xrb new assembly-line
xrb test
xrb irb
xrb pry
xrb edit
xrb submitCommands
xrb new <exercise> # download, save as current, and open the editor
xrb edit [exercise] # open the editor for an exercise
xrb test [exercise] # run configured or selected test files
xrb irb [exercise] # open IRB with reload! available
xrb pry [exercise] # open Pry with reload! available
xrb submit [exercise] # submit through the Exercism CLI
xrb use <exercise> # save a downloaded exercise as current
xrb current # show the current exercise
xrb path [exercise] # print the exercise path
xrb list # list downloaded exercises
xrb clear # clear saved stateExercise resolution priority:
- Explicit slug, for example
xrb test assembly-line - Current working directory when inside
XRB_ROOT - Saved state from the previous
xrb neworxrb use
xrb irb [exercise] and xrb pry [exercise] open the console in the exercise directory, load the selected solution file, and define a reload! helper. After editing the solution file, run this inside the console:
reload!reload! uses Ruby's load, so it re-executes the solution file on every call instead of relying on require's one-time load cache. If the file has a syntax or runtime error, the console stays open, prints the load error, and lets you fix the file and run reload! again. Pry is optional; install it separately, for example with gem install pry, if xrb pry reports that Pry is missing.
xrb test reads .exercism/config.json when available and runs each file listed in files.test. Without that config, it preserves the older fallback of requiring a single *_test.rb file.
xrb submit lets the Exercism CLI choose default solution files when .exercism/config.json is present. Without that config, it preserves the older fallback of requiring a single solution .rb file.
Both xrb test and xrb submit accept a repeatable explicit override:
xrb test --file custom_test.rb
xrb submit two-fer --file two_fer.rb --file helper.rbUse xrb new <exercise> --no-edit to download and save the exercise as current without opening an editor.
Output And Color
xrb uses color automatically when stdout is a terminal. It stays plain when output is redirected, piped, or captured by tests.
Color controls:
XRB_COLOR=auto # default
XRB_COLOR=always # force ANSI color
XRB_COLOR=never # disable ANSI color
NO_COLOR=1 # disable color in auto mode
CLICOLOR_FORCE=1 # force color in auto modexrb path intentionally prints only the resolved path so it can be used in scripts.
State
The current exercise is stored as flat TOML:
~/.local/state/exercism-rb/state.toml
Example:
track = "ruby"
exercise = "assembly-line"
path = "/home/hvpaiva/exercism/ruby/assembly-line"
updated_at = "2026-05-05T12:00:00Z"Configuration
XRB_ROOT=~/exercism/ruby # exercise directory
XRB_TRACK=ruby # Exercism track
XRB_EDITOR="code --wait" # editor used by xrb new/edit
XRB_STATE=~/.local/state/exercism-rb/state.toml
XRB_COLOR=auto # auto, always, or neverxrb new uses exercism download, which downloads into the workspace configured in the Exercism CLI. If you customize XRB_ROOT, configure the Exercism workspace so its track directory matches it, for example exercism configure --workspace ~/exercism for XRB_ROOT=~/exercism/ruby.
Set XRB_EDITOR, VISUAL, or EDITOR before running xrb edit or xrb new without --no-edit. Editor commands are split with shell-like quoting, so this works:
XRB_EDITOR="code --wait" xrb editDevelopment
Install development dependencies:
bundle installRun the default test suite:
bundle exec rakeRun the full verification suite:
bundle exec rake ciThe CI task checks syntax, runs tests, runs tests with Ruby warnings enabled, runs required quality checks, smoke-tests the checkout executable, builds the gem, installs it into an isolated GEM_HOME, and smoke-tests the installed xrb executable.
Useful individual tasks:
bundle exec rake test
bundle exec rake syntax
bundle exec rake warnings
bundle exec rake style
bundle exec rake audit
bundle exec rake quality
bundle exec rake coverage
bundle exec rake smoke:bin
bundle exec rake smoke:gemOptional maintenance reports:
bundle exec rake smells
bundle exec rake criticbundle exec rake critic writes its report to tmp/rubycritic/, which is ignored by Git.
Release
Release process details are maintainer documentation and live in CONTRIBUTING.md.