Search and debug gems with `bundle open`

Ever get frustrated trying to search through code on GitHub? Or wish you could put a breakpoint in a gem so you could figure out what it was doing?

Don’t mess around with cloning the gem repo or monkey patching code in your own app. Use bundle open in…


This content originally appeared on DEV Community and was authored by matt swanson

Ever get frustrated trying to search through code on GitHub? Or wish you could put a breakpoint in a gem so you could figure out what it was doing?

Don’t mess around with cloning the gem repo or monkey patching code in your own app. Use bundle open instead.

Example of bundle open command

Usage

In your shell, run the command: bundle open GEM_NAME

bundler will open the source code for the exact version of the gem you’ve got installed in your editor. You can search the code inside your editor and even add breakpoints or make code changes locally to test out things.

Options

The bundle open command launches the editor that you’ve set via the EDITOR or BUNDLER_EDITOR environment variables. You can set this to be vim, emacs, VS Code, or whatever tool you like to use.

If you’ve made changes to the local gems for debugging or experimental purposes, you can use the bundle pristine command to restore your gems to their “original” state.

Additional Resources

Bundler Docs: bundle open

Bundler Docs: bundle pristine


This content originally appeared on DEV Community and was authored by matt swanson


Print Share Comment Cite Upload Translate Updates
APA

matt swanson | Sciencx (2021-02-16T13:00:00+00:00) Search and debug gems with `bundle open`. Retrieved from https://www.scien.cx/2021/02/16/search-and-debug-gems-with-bundle-open/

MLA
" » Search and debug gems with `bundle open`." matt swanson | Sciencx - Tuesday February 16, 2021, https://www.scien.cx/2021/02/16/search-and-debug-gems-with-bundle-open/
HARVARD
matt swanson | Sciencx Tuesday February 16, 2021 » Search and debug gems with `bundle open`., viewed ,<https://www.scien.cx/2021/02/16/search-and-debug-gems-with-bundle-open/>
VANCOUVER
matt swanson | Sciencx - » Search and debug gems with `bundle open`. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/02/16/search-and-debug-gems-with-bundle-open/
CHICAGO
" » Search and debug gems with `bundle open`." matt swanson | Sciencx - Accessed . https://www.scien.cx/2021/02/16/search-and-debug-gems-with-bundle-open/
IEEE
" » Search and debug gems with `bundle open`." matt swanson | Sciencx [Online]. Available: https://www.scien.cx/2021/02/16/search-and-debug-gems-with-bundle-open/. [Accessed: ]
rf:citation
» Search and debug gems with `bundle open` | matt swanson | Sciencx | https://www.scien.cx/2021/02/16/search-and-debug-gems-with-bundle-open/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.