Augmenting gem search path

I installed ruby-2.4.4 from the default tarball on a RHEL5 system to
/tmp/ruby24. I want to install gems manually to /tmp/ruby24p (I want
all gems in a separate directory). I installed ruby-2.4.4 as follows:
  $ tar Jxf ruby-2.4.4.tar.xz
  $ cd ruby-2.4.4
  $ ./configure LDFLAGS=-Wl,-rpath,/tmp/ruby24/lib \
  --enable-shared --with-mantype=man \
  --disable-rpath --disable-dtrace --enable-install-doc \
  --with-baseruby=/usr/local/ruby20/bin/ruby \
  --with-sitedir=/tmp/ruby24p/lib \
  --with-vendordir=/tmp/ruby24p/vendor/lib \
  --datadir=/tmp/ruby24/share --datarootdir=/tmp/ruby24/share \
  --prefix=/tmp/ruby24
  ...
  $ make
  $ make install

I want to install the bones-3.8.4 gem. I first install the
dependencies little-plugger-1.1.4 and loquacious-1.9.1:
  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  little-plugger-1.1.4.gem

  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  loquacious-1.9.1.gem

  $ ls -l /tmp/ruby24p/vendor/lib/2.4.0/specifications
  total 8
  -rw-rw-r-- 1 china china 1506 May 25 01:53 little-plugger-1.1.4.gemspec
  -rw-rw-r-- 1 china china 2644 May 25 01:53 loquacious-1.9.1.gemspec

Then I try to install bones-3.8.4:
  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'loquacious' (~> 1.9) in any repository

Why isn't /tmp/ruby24p/vendor/lib/2.4.0/specifications being searched
to find the loquacious dependency for bones? This worked fine for
ruby-2.0.0 but not 2.1, 2.2, 2.3, 2.4, or 2.5.

···

--
albert chin (china@thewrittenword.com)

Use GEM_HOME=/tmp/ruby24p instead:

% export GEM_HOME=/tmp/ruby24p
% gem install xyz

If you want to install into DIFFERENT directories each, keep setting GEM_HOME to the locations. To use them all, set GEM_PATH to the previous GEM_HOME values, separated by $IFS (:):

% export GEM_HOME=/tmp/ruby24p1
% gem install abc
% export GEM_HOME=/tmp/ruby24p2
% gem install def
% export GEM_PATH=/tmp/ruby24p1:/tmp/ruby24p2
% ruby my_script.rb

···

On May 24, 2018, at 19:26, Albert Chin <ruby-talk@mlists.thewrittenword.com> wrote:

I installed ruby-2.4.4 from the default tarball on a RHEL5 system to
/tmp/ruby24. I want to install gems manually to /tmp/ruby24p (I want
all gems in a separate directory).

Thanks. I tried setting GEM_HOME and GEM_PATH but it doesn't help:
  $ /tmp/ruby24/bin/gem list

  *** LOCAL GEMS ***

  bigdecimal (default: 1.3.2)
  did_you_mean (1.1.0)
  io-console (default: 0.4.6)
  json (default: 2.0.4)
  minitest (5.10.1)
  net-telnet (0.1.1)
  openssl (default: 2.0.7)
  power_assert (0.4.1)
  psych (default: 2.2.2)
  rake (12.0.0)
  rdoc (default: 5.0.0)
  test-unit (3.2.3)
  xmlrpc (0.2.1)

  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'rdoc' (~> 5.0) in any repository

  GEM_PATH=/tmp/ruby24p /tmp/ruby24/bin/gem install --local -V \
  --document --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'rdoc' (~> 5.0) in any repository

  GEM_HOME=/tmp/ruby24p /tmp/ruby24/bin/gem install --local -V \
  --document --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'rdoc' (~> 5.0) in any repository

···

On Fri, May 25, 2018 at 12:47:49PM -0700, Ryan Davis wrote:

> On May 24, 2018, at 19:26, Albert Chin <ruby-talk@mlists.thewrittenword.com> wrote:
>
> I installed ruby-2.4.4 from the default tarball on a RHEL5 system
> to /tmp/ruby24. I want to install gems manually to /tmp/ruby24p (I
> want all gems in a separate directory).

Use GEM_HOME=/tmp/ruby24p instead:

% export GEM_HOME=/tmp/ruby24p
% gem install xyz

If you want to install into DIFFERENT directories each, keep setting
GEM_HOME to the locations. To use them all, set GEM_PATH to the
previous GEM_HOME values, separated by $IFS (:):

% export GEM_HOME=/tmp/ruby24p1
% gem install abc
% export GEM_HOME=/tmp/ruby24p2
% gem install def
% export GEM_PATH=/tmp/ruby24p1:/tmp/ruby24p2
% ruby my_script.rb

--
albert chin (china@thewrittenword.com)

I had the problem that when updating between versions of Ruby, I had to
reinstall all the gems and I did this fix if it works (it worked for me),
In your user directory create a ".gemrc" file and fill it in as
the next:

···

---
gemhome: /home/usuario/.gems
gempath:
- /home/usuario/.gems
- /usr/lib/ruby/gems/1.8
---

(Of course change the paths by which they apply in your case).

Now update ".bash_profile" (or ".bashrc", I've never heard
of the difference) with the same values:

---
export GEM_PATH = / home / user / .gems: /usr/lib/ruby/gems/1.8
export GEM_HOME = / home / user / .gems
export PATH = / home / user / .gems / bin: $ PATH
---
(Of course change the paths by which they apply in your case).

El lun., 11 jun. 2018 a las 17:14, Albert Chin (< ruby-talk@mlists.thewrittenword.com>) escribió:

On Fri, May 25, 2018 at 12:47:49PM -0700, Ryan Davis wrote:
>
> > On May 24, 2018, at 19:26, Albert Chin < > ruby-talk@mlists.thewrittenword.com> wrote:
> >
> > I installed ruby-2.4.4 from the default tarball on a RHEL5 system
> > to /tmp/ruby24. I want to install gems manually to /tmp/ruby24p (I
> > want all gems in a separate directory).
>
> Use GEM_HOME=/tmp/ruby24p instead:
>
> % export GEM_HOME=/tmp/ruby24p
> % gem install xyz
>
> If you want to install into DIFFERENT directories each, keep setting
> GEM_HOME to the locations. To use them all, set GEM_PATH to the
> previous GEM_HOME values, separated by $IFS (:):
>
> % export GEM_HOME=/tmp/ruby24p1
> % gem install abc
> % export GEM_HOME=/tmp/ruby24p2
> % gem install def
> % export GEM_PATH=/tmp/ruby24p1:/tmp/ruby24p2
> % ruby my_script.rb

Thanks. I tried setting GEM_HOME and GEM_PATH but it doesn't help:
  $ /tmp/ruby24/bin/gem list

  *** LOCAL GEMS ***

  bigdecimal (default: 1.3.2)
  did_you_mean (1.1.0)
  io-console (default: 0.4.6)
  json (default: 2.0.4)
  minitest (5.10.1)
  net-telnet (0.1.1)
  openssl (default: 2.0.7)
  power_assert (0.4.1)
  psych (default: 2.2.2)
  rake (12.0.0)
  rdoc (default: 5.0.0)
  test-unit (3.2.3)
  xmlrpc (0.2.1)

  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'rdoc' (~> 5.0) in any repository

  GEM_PATH=/tmp/ruby24p /tmp/ruby24/bin/gem install --local -V \
  --document --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'rdoc' (~> 5.0) in any repository

  GEM_HOME=/tmp/ruby24p /tmp/ruby24/bin/gem install --local -V \
  --document --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'rdoc' (~> 5.0) in any repository

--
albert chin (china@thewrittenword.com)

Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk&gt;

--
the new generation of assesins, robots

You’re cargo-culting flags that don’t even make sense with what you’re trying to do.

9994 % rm -rf /tmp/ruby24p; GEM_HOME=/tmp/ruby24p gem install bones
Fetching: rake-12.3.1.gem (100%)
Successfully installed rake-12.3.1
Fetching: rdoc-5.1.0.gem (100%)
Successfully installed rdoc-5.1.0
Fetching: little-plugger-1.1.4.gem (100%)
Successfully installed little-plugger-1.1.4
Fetching: loquacious-1.9.1.gem (100%)
Successfully installed loquacious-1.9.1
Fetching: bones-3.8.4.gem (100%)

···

On Jun 11, 2018, at 13:13, Albert Chin <ruby-talk@mlists.thewrittenword.com> wrote:

GEM_HOME=/tmp/ruby24p /tmp/ruby24/bin/gem install --local -V \
--document --bindir=/tmp/ruby24p/bin \
--install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
bones-3.8.4.gem
ERROR: Could not find a valid gem 'rdoc' (~> 5.0) in any repository

--------------------------
Keep rattlin' dem bones!
--------------------------
Successfully installed bones-3.8.4
Parsing documentation for rake-12.3.1
Installing ri documentation for rake-12.3.1
Parsing documentation for rdoc-5.1.0
Installing ri documentation for rdoc-5.1.0
Parsing documentation for little-plugger-1.1.4
Installing ri documentation for little-plugger-1.1.4
Parsing documentation for loquacious-1.9.1
Installing ri documentation for loquacious-1.9.1
Parsing documentation for bones-3.8.4
Installing ri documentation for bones-3.8.4
Done installing documentation for rake, rdoc, little-plugger, loquacious, bones after 5 seconds
5 gems installed
9995 % l /tmp/ruby24p/gems/
total 0
0 bones-3.8.4/ 0 loquacious-1.9.1/ 0 rdoc-5.1.0/
0 little-plugger-1.1.4/ 0 rake-12.3.1/

>
> GEM_HOME=/tmp/ruby24p /tmp/ruby24/bin/gem install --local -V \
> --document --bindir=/tmp/ruby24p/bin \
> --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
> bones-3.8.4.gem
> ERROR: Could not find a valid gem 'rdoc' (~> 5.0) in any repository

You’re cargo-culting flags that don’t even make sense with what
you’re trying to do.

Probably. I only understand enough of Ruby to do what I am attempting.
Note that we are trying to install against a .gem file that we have
manually downloaded. And yes, there is a good reason for us to do
this.

9994 % rm -rf /tmp/ruby24p; GEM_HOME=/tmp/ruby24p gem install bones
Fetching: rake-12.3.1.gem (100%)
Successfully installed rake-12.3.1
Fetching: rdoc-5.1.0.gem (100%)
Successfully installed rdoc-5.1.0
Fetching: little-plugger-1.1.4.gem (100%)
Successfully installed little-plugger-1.1.4
Fetching: loquacious-1.9.1.gem (100%)
Successfully installed loquacious-1.9.1
Fetching: bones-3.8.4.gem (100%)

The problem with the above is that you're downloading the latest gems.
We are packaging Ruby for a customer and have downloaded the
individual .gem files we want to ship with Ruby and want to install
the .gem's one-by-one, ensuring we install a particular version of the
gem. However, it doesn't work (unlike what you are doing above).
Ruby's 'gem' tool will download all the requisite gems and install
them as above as you have indicated. But, why can't we install the
gems one-by-one?
  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  little-plugger-1.1.4.gem
  ...
  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  loquacious-1.9.1.gem
  ...
  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  rdoc-5.1.0.gem
  ...
  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  rake-12.3.1.gem
  ...
  $ /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'loquacious' (~> 1.9) in any repository

Even if I specify GEM_HOME and GEM_PATH it doesn't work:
  $ GEM_PATH=/tmp/ruby24p/vendor/lib/2.4.0 \
  /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'loquacious' (~> 1.9) in any repository
  $ GEM_PATH=/tmp/ruby24p \
  /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'loquacious' (~> 1.9) in any repository
  $ GEM_HOME=/tmp/ruby24p/vendor/lib/2.4.0 \
  /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'loquacious' (~> 1.9) in any repository
  $ GEM_HOME=/tmp/ruby24p \
  /tmp/ruby24/bin/gem install --local -V --document \
  --bindir=/tmp/ruby24p/bin \
  --install-dir=/tmp/ruby24p/vendor/lib/2.4.0 \
  bones-3.8.4.gem
  ERROR: Could not find a valid gem 'loquacious' (~> 1.9) in any repository

Note that if I try to install the previous bones-3.8.3.gem using
Ruby-2.0.0, I have no such problem:
  $ /tmp/ruby20/bin/gem install --local -V --document
  --bindir=/tmp/ruby20p/bin \
  --install-dir=/tmp/ruby20p/vendor/lib/2.0.0
  little-plugger-1.1.4.gem
  ...
  $ /tmp/ruby20/bin/gem install --local -V --document
  --bindir=/tmp/ruby20p/bin \
  --install-dir=/tmp/ruby20p/vendor/lib/2.0.0
  loquacious-1.9.1.gem
  ...
  $ /tmp/ruby20/bin/gem install --local -V --document
  --bindir=/tmp/ruby20p/bin \
  --install-dir=/tmp/ruby20p/vendor/lib/2.0.0
  rake-10.5.0.gem
  ...
  $ /tmp/ruby20/bin/gem install --local -V --document
  --bindir=/tmp/ruby20p/bin \
  --install-dir=/tmp/ruby20p/vendor/lib/2.0.0
  bones-3.8.3.gem
  ...

This problem seems to have started with Ruby-2.1 and above as 2.1-2.4
exhibit the same problem as 2.4 whereas 2.0 works ok.

···

On Mon, Jun 11, 2018 at 02:54:50PM -0700, Ryan Davis wrote:

> On Jun 11, 2018, at 13:13, Albert Chin > > <ruby-talk@mlists.thewrittenword.com> wrote:

--
albert chin (china@thewrittenword.com)

What is the point of that?

Is there a reason you're not just using a Gemfile and bundler?
Specifying versions is exactly what it's for...

···

On Wed, Jun 13, 2018 at 12:10 AM, Albert Chin <ruby-talk@mlists.thewrittenword.com> wrote:

The problem with the above is that you're downloading the latest gems.
We are packaging Ruby for a customer and have downloaded the
individual .gem files we want to ship with Ruby and want to install
the .gem's one-by-one, ensuring we install a particular version of the
gem. However, it doesn't work (unlike what you are doing above).
Ruby's 'gem' tool will download all the requisite gems and install
them as above as you have indicated. But, why can't we install the
gems one-by-one?

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

We're packing Ruby and 3rd-party modules just like distros do. They
package everything one-by-one.

···

On Wed, Jun 13, 2018 at 09:05:08AM -0700, Hassan Schroeder wrote:

On Wed, Jun 13, 2018 at 12:10 AM, Albert Chin > <ruby-talk@mlists.thewrittenword.com> wrote:

> The problem with the above is that you're downloading the latest
> gems. We are packaging Ruby for a customer and have downloaded the
> individual .gem files we want to ship with Ruby and want to
> install the .gem's one-by-one, ensuring we install a particular
> version of the gem. However, it doesn't work (unlike what you are
> doing above). Ruby's 'gem' tool will download all the requisite
> gems and install them as above as you have indicated. But, why
> can't we install the gems one-by-one?

What is the point of that?

Is there a reason you're not just using a Gemfile and bundler?
Specifying versions is exactly what it's for...

--
albert chin (china@thewrittenword.com)

That's not really an answer. Bundler installs gems and dependencies
one-by-one too, it's just done with a config file and a single command.

The end result is gems on disk, so... ¯\_(ツ)_/¯

···

On Wed, Jun 13, 2018 at 10:42 AM, Albert Chin <ruby-talk@mlists.thewrittenword.com> wrote:

Is there a reason you're not just using a Gemfile and bundler?
Specifying versions is exactly what it's for...

We're packing Ruby and 3rd-party modules just like distros do. They
package everything one-by-one.

--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

Zn Wed, Jun 13, 2018 at 10:54:00AM -0700, Hassan Schroeder wrote:

>> Is there a reason you're not just using a Gemfile and bundler?
>> Specifying versions is exactly what it's for...
>
> We're packing Ruby and 3rd-party modules just like distros do.
> They package everything one-by-one.

That's not really an answer. Bundler installs gems and dependencies
one-by-one too, it's just done with a config file and a single
command.

The end result is gems on disk, so... ¯\_(ツ)_/¯

When we built ruby-2.0.0 we used the same process as we've done for
Python, Tcl, Perl, etc. Download the source for the 3rd-party module,
build it, install it, and then package it. We're upgrading ruby to 2.4
and wanted to do the same thing as we've always done. Even if our
process is more time consuming, we would like to continue doing it
because then we're doing the same across the different interpreters we
provide.

We just seem to be running into a problem with Ruby 2.4 finding gem
dependencies that we didn't experience with 2.0.

···

On Wed, Jun 13, 2018 at 10:42 AM, Albert Chin > <ruby-talk@mlists.thewrittenword.com> wrote:

--
albert chin (china@thewrittenword.com)