Search code examples
ruby-on-rails-3ubuntugedit

How do I browse the source code for a gem in Rails3 with RVM (linux & gedit)


I am running rails3 in Ubuntu and using gedit for coding. I am using RVM. To look at the gem source code I tried: bundle open jquery-rails

That doesn't work since I hadn't setup an editor. After setting gedit as the editor it still doesn't work because gedit can't be passed directories. I guess it only works with files. Too bad :(.

nathan.f77's answer to this question ( Lookup Gem or Plugin code packaged in a Rails3 application ) seems promising, but I wasn't able to follow his instructions. They lacked sufficient detail for me.

What is a very easy way to browse the source files for gems that I am using in my rails3 app?


Solution

  • CubaLibre's response got me half-way there. The other piece of the puzzle I was able to get from Ask Ubuntu.

    Here are the steps to browse gem code in gedit using Ubuntu.

    a. From the command line run:

    gnome-open $(bundle show [gem-name])
    

    b. This will open up the gem directory in nautilus. From there just double click on file you'd like to see and it will open up in gedit.