Discussion:
Augmenting gem search path
Ryan Davis
2018-05-25 19:47:49 UTC
Permalink
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



Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Cristian Feldman
2018-06-11 20:59:53 UTC
Permalink
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 (<
Post by Ryan Davis
On May 24, 2018, at 19:26, Albert Chin <
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).
% 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
% 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
$ /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
--
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
--
the new generation of assesins, robots
Ryan Davis
2018-06-11 21:54:50 UTC
Permalink
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.

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%)
--------------------------
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/


Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-tal
Hassan Schroeder
2018-06-13 16:05:08 UTC
Permalink
On Wed, Jun 13, 2018 at 12:10 AM, Albert Chin
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...
--
Hassan Schroeder ------------------------ ***@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
Hassan Schroeder
2018-06-13 17:54:00 UTC
Permalink
On Wed, Jun 13, 2018 at 10:42 AM, Albert Chin
Post by Hassan Schroeder
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... ¯\_(ツ)_/¯
--
Hassan Schroeder ------------------------ ***@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

Unsubscribe: <mailto:ruby-talk-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ru
Loading...