Giter Site home page Giter Site logo

irb-config's Introduction

Installation

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.

Updates

To update the repository and all the gems, run

make update

What is it ?

Watch the screencast

Watch the screencast!

It packages:

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 rspec command pretty much like the usual one.
  • Use the cucumber command pretty much like the usual one.
  • Use the rake, test, generate, destroy, update commands as usual.
  • Type help to see the Pry help.

Notes

  • 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 reload!.

Vim Integration

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:

  • :W saves and reloads the current file in the console.
  • ,c opens a tmux pane with a rails console.
  • ,r saves the file and run the rspec test corresponding to the cursor line.
  • ,e saves the file and run the cucumber test corresponding to the cursor line.
  • ,b puts a break point on the current line

License

irb config is released under the MIT license.

irb-config's People

Contributors

amiel avatar caifara avatar deiga avatar dontneedgithubaccount avatar lunks avatar nviennot avatar quentindecock avatar tjhosford avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.