According to this article, we can test around our gem code by adding those lines to our rakefile:
task :console do
require 'irb'
require 'irb/completion'
require 'my_gem' # You know what to do.
ARGV.clear
IRB.start
end
It works really well, except that whenever a change is made to the gem, I need to exit
and rerun rake console
to get the code updated. It is really not convenient as a creation/debugging tool ...
Is there a way to write a custom method that would act as the awesome reload!
method from Rails?
A bash script won't work as the first command is in the Ruby console, and I'd rather have a 100% ruby solution.
Thanks!
load 'whatever_file_that_was_changed.rb'
– Stop