7 Lines Every Gem's Rakefile Should Have
CommentsHaving ample documentation and solid test coverage for your gem is great. But nothing beats dropping into a console and just playing around.
Make it easy on yourself, and easy on your users. Add these 7 lines to your project’s Rakefile:
task :console do
require 'irb'
require 'irb/completion'
require 'my_gem' # You know what to do.
ARGV.clear
IRB.start
end
Now, a suitable playground is only a rake console
away. For bonus points, if
your gem requires a bit of fixture data to do anything useful, you can stage
some data before starting the console. Even users who aren’t adept at writing
tests should be able to give you steps to reproduce problems using this
console, in a clean environment free of their app code and other gems.