bundler-site
bundler-site copied to clipboard
bundler-site documentation :path behavior confusion
Greetings,
I was reviewing the documentation for loading a gem via: "gem .... path: dir" in an attempt to install a gem directly from the file system.
Site Documentation
As I read the documentation for v2.2 (latest) at https://bundler.io/v2.2/man/gemfile.5.html#PATH it says:
Similar to the semantics of the :git option, the :path option requires that the directory in question either contains a .gemspec for the gem, or that you specify an explicit version that bundler should use.
The feature that you specify an explicit version did not work for me.
As I reviewed the code & documentation. I downloaded rubygems/bundler-site and attempted to grep the above documentation.
I found the following documentation instead which appears more correct:
Source code for Site documentation
At: https://github.com/rubygems/bundler-site/blob/master/source/v2.2/gemfile.html.haml#L125
.bullet
.description
If you would like to use an unpacked gem directly from the filesystem, simply set the <code>:path</code> option to the path containing the gem's files.
:code
# lang: ruby
gem 'extracted_library', :path => './vendor/extracted_library'
The above documentation appears to be correct, in my experiments with the code.
Summary
I believe the website documentation is out of date with the documentation source code and am asking you to review this confusion.
What I was trying to do....
I was attempting to install a gem locally via:
Gemfile
gem 'lex', '0.0.14', path: 'gems'
What I expected to happen, was that "lex-0.0.14.gem" would be unpacked and installed into
/home/[user]/.bundle/ruby/2.7.0/gems/lex-0.0.14
The bundle(r) does not work in this manner as I thought it would.
If I can help in any manner, please give me a pointer to how to resolve this conflict and I will be happy to fork and update any documentation.
Thank you!
Daniel Lo
This documentation is indeed confusing but for two things:
-
One is the one you mention. The current wording could mislead you into thinking that the
:path
option is a target folder for installing a packaged gem, not what it is: a source folder to pickup an unpackaged gem. -
The other one is that the current wording makes you think that if the folder specified does not include a gemspec, it will automagically generate one if you specify a target version. I don't think this is how bundler works, but it'd be a cute hidden feature :smile:.