Prerequisites: rvm or rbenv.
To install, run
git clone git://github.com/nviennot/irb-config.git ~/.irb cd ~/.irb make install
make install installs all the required gems for all your installed rubies.
When installing a new ruby, please
make update in the ~/.irb directory.
To update the repository and all the gems, run
What is it ?
Watch the screencast
This way you can switch back and forth from the development environment and the test environment, which is what the rspec/cucumber commands do.
How to use
- All the goodies are automatically loaded into your rails console.
- Use the
rspeccommand pretty much like the usual one.
- Use the
cucumbercommand pretty much like the usual one.
- Use the
updatecommands as usual.
helpto see the Pry help.
- All the gems from your global gemset can be loaded bypassing Bundler.
- The RSpec/Cucumber context run with your test environment, including your test
database settings. Furthermore, whenever you run the rspec command, all your
classes are reloaded with
With the Screen plugin, you can communicate with screen/tmux to send some commands. I find these one particularly useful:
command -nargs=? -complete=shellcmd W :w | :call ScreenShellSend("load '".@%."';") map <Leader>c :ScreenShellVertical bundle exec rails c<CR> map <Leader>r :w<CR> :call ScreenShellSend("rspec ".@% . ':' . line('.'))<CR> map <Leader>e :w<CR> :call ScreenShellSend("cucumber --format=pretty ".@% . ':' . line('.'))<CR> map <Leader>b :w<CR> :call ScreenShellSend("break ".@% . ':' . line('.'))<CR>
This is setup in my Vim configuration.
Assuming you have a tmux session with vim and the rails console:
:Wsaves and reloads the current file in the console.
,copens a tmux pane with a rails console.
,rsaves the file and run the rspec test corresponding to the cursor line.
,esaves the file and run the cucumber test corresponding to the cursor line.
,bputs a break point on the current line
irb config is released under the MIT license.