Project

spiker

0.0
The project is in a healthy, maintained state
Scaffold for code spikes, includes simple boilerplate with Minitest + Guard to make red/green work out-of-the-box.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 1.3
 Project Readme

πŸ§ͺ Spiker

Spiker helps you spin up quick, testable Ruby experiments, aka spikes. Whether you're validating an idea, poking at a new API, or just noodling with some code, Spiker gives you a clean, red-green workflow in seconds.

It’s like rails new for code spikes.

Gem Version


πŸš€ Install

Get Spiker the same way you get any other Ruby gem:

gem install spiker

πŸ› οΈ Use It

Navigate to wherever you keep your brilliant ideas:

cd ~/spikes

Then create your first Spiker-flavored spike:

spiker simple my_rad_idea
cd my_rad_idea

Start coding. Run tests. Celebrate small wins. πŸŽ‰


🧬 Spike Types

Spiker gives you different formats depending on your mood:

simple

All code and tests in one file. Perfect for one-off ideas or sharing snippets with others.

spiker simple my_rad_idea

Generates:

my_rad_idea/
β”œβ”€β”€ app.rb
β”œβ”€β”€ Gemfile
β”œβ”€β”€ Guardfile
β”œβ”€β”€ .env
β”œβ”€β”€ Dockerfile*
β”œβ”€β”€ docker-compose.yml*
β”œβ”€β”€ Makefile*

* Skippable via --skip-docker, --skip-bundle, etc.

The app.rb file includes your class, a few tests, and support for .env values:

require 'minitest'
require 'minitest/autorun'
require 'minitest/reporters'

Minitest::Reporters.use!

class MyRadIdeaTest < Minitest::Test
  def test_name
    assert_equal "Fred", MySpike.new(name: "Fred").name
  end

  def test_default_env_value
    assert_equal "test", ENV["TEST_VALUE"]
  end
end

# your brilliance goes here
class MyRadIdea
  attr_accessor :name

  def initialize(name:)
    @name = name
  end
end

Start Guard and hack away:

bundle exec guard

given

Like simple, but with support for Minitest::Spec and Given/When/Then style tests. Inspired by the late, great Jim Weirich.

spiker given my_given_spike

multi

When you need more structure β€” say you're testing something big, or just like folders.

spiker multi cool_tool
cd cool_tool

You get:

cool_tool/
β”œβ”€β”€ lib/cool_tool.rb
β”œβ”€β”€ test/
β”‚   β”œβ”€β”€ test_helper.rb
β”‚   └── cool_tool_test.rb
β”œβ”€β”€ Guardfile
β”œβ”€β”€ Gemfile
β”œβ”€β”€ Rakefile
β”œβ”€β”€ README.md
...etc

Minitest is still the test framework. Rake is wired up. Guard watches your files. You're all set.


rspec

Like multi, but for people who write describe instead of def test_thing. 🐹

spiker rspec spike_it
cd spike_it

You’ll get:

spike_it/
β”œβ”€β”€ lib/spike_it.rb
β”œβ”€β”€ spec/
β”‚   β”œβ”€β”€ spec_helper.rb
β”‚   └── spike_it_spec.rb
β”œβ”€β”€ Guardfile
β”œβ”€β”€ Gemfile
β”œβ”€β”€ Rakefile

Just add ideas and run bundle exec guard or rake or... rspec.


βš™οΈ Options

Want fewer moving parts?

spiker simple my_spike --skip-docker --skip-bundle --skip-git

Run spiker help or spiker help [COMMAND] to see all your options.


πŸ’‘ Why Use Spiker?

  • βœ… Fast: From idea to testable code in seconds and no boring boilerplate by hand
  • βœ… Familiar: Minitest, RSpec, Guard, Rake β€” tools you already know... or want to know
  • βœ… Simple: No weird configs or meta-generators
  • βœ… Docker-Ready: Write code in your favorite editor, run your code in Docker? Intriguing...
  • βœ… Flexible: Choose the spike format that fits your flow

πŸ’ͺ Development

Spiker is a straightforward "generator"-style Ruby gem. It uses Thor to handle the bulk of the generator heavy lifting, so it will be straightforward to adapt to your needs. If you want to make a new style of "spike", you'll work in:

lib/spiker.rb
lib/spiker/cli.rb
lib/spiker/generators/<YOUR_GENERATOR_HERE>
lib/spiker/templates/<YOUR_GENERATOR_TEMPLATES_HERE>

Adapting an existing spike just requires attention to the last two items above.

To get rolling, check out the repo and run bundle exec bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bundle exec bin/console for an interactive prompt that will allow you to experiment.

To install your updated version of the gem onto your local machine, run bundle exec rake install. To see what else you can do, there's always bundle exec rake -T


🧼 Fine Print

Spiker is open source, MIT-licensed, and built for fun and function.

Use it. Fork it. Spike responsibly.

β†’ https://github.com/norlinga/spiker