Skip to content

fpsvogel/advent_of_ruby

Repository files navigation

Advent of Ruby

There are lots of CLI tools for doing Advent of Code in Ruby. Why make another?

This one does a few things differently:

  • It shows other people's solutions. This was inspired by Exercism's community solutions.
  • It's geared toward leisurely solving puzzles across all years. You can use it for the competition in December, but I didn't build it with that in mind.
  • It has a magically simple CLI, which mostly involves spamming the arb command.
  • It uses Git instead of a database to track the user's progress and current state.

Installation

gem install advent_of_ruby

Usage

In a directory where you want to store your solutions, run the command arb and follow the prompts.

Here's a demo. (Not pictured: perusing other people's solutions for each part, 01_1.rb and 01_2.rb.)

advent-of-ruby-cli-demo.mp4

Commands

Shortcuts:

  • Any command can be abbreviated with its first letter, e.g. arb b for arb bootstrap.
  • Just arb is short for arb run.
  • arb help shows a summary of each command.

arb bootstrap [YEAR] [DAY]

arb run [YEAR] [DAY]

  • Runs specs for the given day.
  • If specs pass, also runs the currently in-progress part (Part One or Part Two) of the given day.
  • If you're seeing specs run when you want to run only the real input, or vice versa, add one of the following flags:
    • --spec (-s) runs only the specs. (To run only Part One or Part Two specs, in the spec file change it to xit on the other part's example to skip it.)
    • --one (-o) runs only Part One with the real input.
    • --two (-t) runs only Part Two with the real input.
  • Optionally submits the answer, via a prompt that appears if specs pass and the answer has not already been submitted.
  • If both arguments are omitted, it runs the puzzle that is untracked in Git, if any.

arb commit

  • Commits new or modified solutions to Git.

arb progress

  • Shows progress (total and by year) based on the number of your solutions committed in Git.

Prior art

About

CLI tool for Advent of Code in Ruby

Resources

License

Stars

Watchers

Forks

Languages