Are you a Ruby GEM author? Are you tired to open
irb sessions and load your library to debug it? Here’s the solution: create a rake task to initialize a new irb session and preload your library.
Grab the following script and paste it into your library
desc "Open an irb session preloaded with this library" task :console do sh "irb -rubygems -I lib -r whois.rb" end
whois.rb with the main file that represents your GEM.
Now you can open a new
irb instance and get your library automatically mixed into your
$ rake console (in /Users/weppos/Code/whois) irb -rubygems -I lib -I test -r whois.rb >> Whois => Whois
You no longer need to launch
irb and include you library all the time. Stop wasting your time with the following
$ cd lib $ irb >> require 'whois' => true >> Whois => Whois
By default, this task appends the
lib folder to the
$LOAD_PATH. If you need to append multiple paths, call -I once for any additional folder.
desc "Open an irb session preloaded with this library" task :console do sh "irb -rubygems -I lib -I extra -r whois.rb" end
To learn more about
irb parameters, open a shell and enter the following command
$ irb --help