Run and re-run a ruby script without restarting the process. Plays well with firetower and firetower editor hooks, but neither are required.
Especially useful when the REPL isn't enough, but the config or initialization overhead is high.
Clone the repository, add a symlink you'll remember.
git clone https://github.com/mweitzel/firetower-ruby ~/projects/firetower-ruby
ln -s ~/projects/firetower-ruby/firetower.rb ~/bin/firetower.rb
Preface your script with the path to firetower.rb
ruby ~/bin/firetower.rb my-script.rb
Re-load the script with ^R
(control-r), or with firetower editor hooks
Exit with ^C
(control-c)
rails runner ~/bin/firetower.rb my-script.rb
This will load the rails config, then load and run my-script.rb
. Unlike Zeus or Spring, only the specified file will be reloaded.
Continually reloading a file in Ruby does not clear variables and functions which were previous defined in the file