I would like to add a default search path for gems without setting
RUBYLIB and GEM_PATH. For the purposes of this discussion, let's say
the search path is "/tmp/rubygems/vendor/lib/2.3.0". I created the
attached patch to lib/rubygems/defaults.rb.
I built ruby-2.3.3 as follows before applying this patch:
tar Jxf ruby\-2\.3\.3\.tar\.xz
cd ruby-2.3.3
LDFLAGS="\-Wl,\-rpath,/tmp/ruby23/lib" \./configure \-\-enable\-shared \\
\-\-with\-mantype=man \-\-disable\-rpath \-\-disable\-dtrace \\
\-\-enable\-install\-doc \-\-datadir=/tmp/ruby23/share \\
\-\-datarootdir=/tmp/ruby23/share \-\-prefix=/tmp/ruby23
gmake
$ gmake install
I then built loquacious-1.9.1 which is a dependency for bones-3.8.3.gem:
$ PATH=/tmp/ruby23/bin:$PATH gem install --local -V --rdoc \
--ri --bindir=/tmp/rubygems/bin \
--install-dir="/tmp/rubygems/vendor/lib/2.3.0" \
loquacious-1.9.1.gem
$ PATH=/tmp/ruby23/bin:$PATH gem list
*** LOCAL GEMS ***
bigdecimal (1.2.8)
did_you_mean (1.0.0)
io-console (0.4.5)
json (1.8.3)
loquacious (1.9.1)
minitest (5.8.5)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (2.1.0)
rake (10.4.2)
rdoc (4.2.1)
test-unit (3.1.5)
$ PATH=/tmp/ruby23/bin:$PATH gem environment
...
- GEM PATHS:
- /tmp/ruby23/lib/ruby/gems/2.3.0
- /tmp/rubygems/vendor/lib/2.3.0
- /home/china/.gem/ruby/2.3.0
...
$ ls /tmp/ruby23/lib/ruby/gems/2.3.0/gems
did_you_mean-1.0.0 net-telnet-0.1.1 rake-10.4.2 test-unit-3.1.5
minitest-5.8.5 power_assert-0.2.6 rdoc-4.2.1
However, when I tried to install bones-3.8.3.gem, which requires
loquacious-1.9.1, I received the following error:
$ PATH=/tmp/ruby23/bin:$PATH gem install --local -V --rdoc \
--ri --bindir=/tmp/rubygems/bin \
--install-dir="/tmp/rubygems/vendor/lib/2.3.0" \
bones-3.8.3.gem
ERROR: Could not find a valid gem 'rdoc' (~> 4.0) in any repository
Do I need to patch more than lib/rubygems/defaults.rb? The version of
rdoc, 4.2.1, clearly satisfies "~> 4.0". So why the error?
gem-search-path.patch (496 Bytes)
···
--
albert chin (china@thewrittenword.com)