RubyAMP

Mar
28

Work faster, code better.

RubyAMP is a TextMate bundle that makes you more productive in editing, navigating, and debugging Ruby code. Now you can easily:

  • auto-complete from all open tabs
  • jump to a method, class, or fixture named under the cursor
  • start the debugger on a series of RSpec examples and break at the current line
  • inspect by highlighting to evaluate to tooltip or clipboard
  • fire up a Merb/Rails server or console for your current app
  • tail development.log

AMP = Amplified Mate Productivity

As introduced by Tim Harper at MtnWest RubyConf

The shortcuts in this screencast have changed slightly since this was recorded, to avoid keyboard conflicts with other commands.

Install with Git

(wait, I don’t have Git…)

  • Install tmtools (information about tmtools here)
  • Install these gems:

    sudo gem install rb-appscript ruby-debug

  • Run this:

    mkdir -p ~/Library/Application\ Support/TextMate/Bundles/
    cd ~/Library/Application\ Support/TextMate/Bundles/
    git clone git://github.com/timcharper/rubyamp.git RubyAMP.tmbundle

  • If you have two ruby versions installed, set TM_RUBY (in the TextMate preferences) to the ruby you would like RubyAMP to use
  • Reload your bundles

Keyboard Shortcuts

Misc

  • Go to method – ⌥⇧m
  • Go to class – ⌥⇧c
  • Go to fixture – ⌥⇧x
  • Intelligent go to file – ⌥⇧f
  • auto-complete from all open tabs – ⌘;
  • launch project terminal – ⌃⌘p
  • shrink selection – ⌥b
  • trim selection – ⌥b
  • Find in project (only searches rb and yml files) – ⌃⌥⌘f

Debugger

  • debug current file – ⌘d
  • set breakpoint – ⌃b
  • view / delete breakpoints – ⌃⌘b
  • see call stack / navigate call stack – ⌥w
  • quit debugger – ⌃\
  • inspect selected text or variable under cursor via pretty-print – ⌃i
  • Copy inspection as string, pretty print, or YAML⌃⌥i

Commands without shortcuts

  • Pretty Align – Align at a given symbol or regular expression (ie: ‘then’ or ‘=>’)
  • Cleanup windows – Closes all of your open html windows (IE: rspec runner results)
  • App Server in terminal window – Launch script/console or merb, depending on your project

See the bundle menu for some more bonus commands

Contributing

Credits / Recognition

This little bundle has been made possible by standing on the shoulders of giants. Particularly:

  • Hans-Joerg Bibiko, for TMTOOLS
  • Kent Sibilev, for ruby-debug
  • Hamish Sanderson, for rb-appscript.

    Thank you!

Jobs

Lead Media Partners is hiring full-time web people.