DEV Community

matt swanson
matt swanson

Posted on • Originally published at boringrails.com on

6 2

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 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


Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE