ruby / rake

A make-like build utility for Ruby.

Home Page:https://ruby.github.io/rake

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add --console

avdi opened this issue · comments

It would be handy to have an option to start an IRB session in the context of the current Rake workspace, e.g.:

$ rake --console
irb(main):001:0> 

We can currently get the same effect with -e, but there's some nonobvious work to keep IRB from getting confused by the Rake command-line arguments.

$ rake -rirb -e 'ARGV.clear; IRB.start'
irb(main):001:0>

If this is a contribution others would be interested in, I wouldn't mind adding it.

Isn't it irb -rrake?

So, I'm keen to help on this if needed, but I'm unsure exactly what this does, since I'm not that familiar with rake yet.

I understood the concept but, for example, what would be the use of this feature? to test out rake tasks or debugging things?

For performing one-off operations in the exact same context that Rake tasks run in (loaded libraries, whatever constant initialization is triggered by the Rakefile loading, etc.)

Sometimes you want to try something out before you turn it into a rake task. Sometimes you want to do something exactly once, but with the whole Rake context loaded.