mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 07:08:01 +00:00
Add Show The Bundler Location Of An Installed Gem as a Ruby TIL
This commit is contained in:
@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
|
||||
|
||||
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
|
||||
|
||||
_1620 TILs and counting..._
|
||||
_1621 TILs and counting..._
|
||||
|
||||
See some of the other learning resources I work on:
|
||||
- [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators)
|
||||
@@ -1382,6 +1382,7 @@ If you've learned something here, support my efforts writing daily TILs by
|
||||
- [Set RVM Default Ruby](ruby/set-rvm-default-ruby.md)
|
||||
- [Shift The Month On A Date Object](ruby/shift-the-month-on-a-date-object.md)
|
||||
- [Show Public Methods With Pry](ruby/show-public-methods-with-pry.md)
|
||||
- [Show The Bundler Location Of An Installed Gem](ruby/show-the-bundler-location-of-an-installed-gem.md)
|
||||
- [Silence The Output Of A Ruby Statement In Pry](ruby/silence-the-output-of-a-ruby-statement-in-pry.md)
|
||||
- [Single And Double Quoted String Notation](ruby/single-and-double-quoted-string-notation.md)
|
||||
- [Skip Specific CVEs When Auditing Your Bundle](ruby/skip-specific-cves-when-auditing-your-bundle.md)
|
||||
|
||||
24
ruby/show-the-bundler-location-of-an-installed-gem.md
Normal file
24
ruby/show-the-bundler-location-of-an-installed-gem.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Show The Bundler Location Of An Installed Gem
|
||||
|
||||
When you run `bundle install` with a project, it is going to install all the
|
||||
gems specified by your project in a vendored location relative to the location
|
||||
of your Ruby version install.
|
||||
|
||||
If you want to find the location of a specific gem, you can ask bundler with
|
||||
`bundle show <gem-name>`.
|
||||
|
||||
Here I ask where the `rspec` gem is.
|
||||
|
||||
```bash
|
||||
$ bundle show rspec
|
||||
/Users/jbranchaud/.asdf/installs/ruby/3.1.3/lib/ruby/gems/3.1.0/gems/rspec-3.12.0
|
||||
```
|
||||
|
||||
I could `cd` into that directory to have a look around at the source. That's a
|
||||
great way to learn more about how our dependencies work.
|
||||
|
||||
I could even inject some debugging statements (e.g. `binding.irb`) which the
|
||||
program using these gems will break on. Not often, but sometimes you need to
|
||||
dig in this deep to understand what is causing a tricky bug or why code isn't
|
||||
behaving like you'd hoped. Just remember to remove those statements when you're
|
||||
done.
|
||||
Reference in New Issue
Block a user