Skip to content

Commit 395ad09

Browse files
hsbtmatzbot
authored andcommitted
[ruby/rubygems] Clarify local gem override docs to require git-sourced gems
ruby/rubygems@a4a5cdb12c
1 parent c3b6f2e commit 395ad09

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

lib/bundler/man/bundle-config.1.ronn

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,16 @@ up a local override:
295295

296296
bundle config set --local local.GEM_NAME /path/to/local/git/repository
297297

298-
For example, in order to use a local Rack repository, a developer could call:
298+
Important: This feature only works for gems that are specified with a git
299+
source in your Gemfile. It does not work for gems installed from RubyGems
300+
or other sources. The gem must be defined with `git:` option pointing to a
301+
remote repository.
302+
303+
For example, if your Gemfile contains:
304+
305+
gem "rack", git: "https://github.com/rack/rack.git", branch: "main"
306+
307+
Then you can use a local Rack repository by running:
299308

300309
bundle config set --local local.rack ~/Work/git/rack
301310

@@ -321,6 +330,11 @@ Finally, Bundler also ensures that the current revision in the
321330
`Gemfile.lock` exists in the local git repository. By doing this, Bundler
322331
forces you to fetch the latest changes in the remotes.
323332

333+
If you need to temporarily use a local version of a gem that is normally
334+
installed from RubyGems (not from git), use a path source instead:
335+
336+
gem "rack", path: "~/Work/git/rack"
337+
324338
## MIRRORS OF GEM SOURCES
325339

326340
Bundler supports overriding gem sources with mirrors. This allows you to

0 commit comments

Comments
 (0)