Gems not found - what is the standard

I have Ruby installed on AIX. When running an application (typo in this
case) I received no sch file to load message …

I found it was looking for redcloth. I found the gem in my gems library.
After I ran ruby setup.rb in the RedCloth directory, I noticed it got
installed/copied to my site directory.

Rerunning the application now found the redcloth file but did find
active_suppot file. In the ACtive_Support directory, I did not find any
instruction what and where to copy.

So I have two questions:

Why does the gem install NOT install the files in a proper directory or
what is the set up to have ruby application access the gems directories
for require command

PATH? LIBPATH? what ??

Thanks

Lanny

On 6/29/06, Lanny R. [email protected] wrote:

require ‘rubygems’
require ‘RedCloth’

RubyGems modifies the search path.

-austin

Austin Z. wrote:

On 6/29/06, Lanny R. [email protected] wrote:

require ‘rubygems’
require ‘RedCloth’

RubyGems modifies the search path.

-austin

I am sorry? Am I to prepend some file/all files/ with require ‘rubygems’

I need to set it up so that the applications executing the require
actually find the objects of the require statement

On 6/29/06, Lanny R. [email protected] wrote:

I need to set it up so that the applications executing the require
actually find the objects of the require statement

This may be changed in Ruby 1.8.5, I think, but the answer essentially
is yes.

You can use RUBYOPTS=-rubygems but that’s a bit of a hack.

-austin

Austin Z. wrote:

On 6/29/06, Lanny R. [email protected] wrote:

I need to set it up so that the applications executing the require
actually find the objects of the require statement

This may be changed in Ruby 1.8.5, I think, but the answer essentially
is yes.

You can use RUBYOPTS=-rubygems but that’s a bit of a hack.

-austin

Thanks. Setting RUBYOPTS would not be a hack if it worked. In my case ir
would be /usr/local/lib/ruby/site_ruby/but that is precicely where the
GEMS do not get installed by gem install …

Thank you for your help. I am not about to grep through all files
prepending a missing line of code, that is no fun :-). I’ll wait for a
while to see if this is fixed and play with Ruby on my Mac where it
works perfectly - same version, same gems and same typi application.

Lanny R. wrote:

Austin Z. wrote:

On 6/29/06, Lanny R. [email protected] wrote:

I need to set it up so that the applications executing the require
actually find the objects of the require statement

This may be changed in Ruby 1.8.5, I think, but the answer essentially
is yes.

You can use RUBYOPTS=-rubygems but that’s a bit of a hack.

-austin

Thanks. Setting RUBYOPTS would not be a hack if it worked.

Heh, Austin misstyped. Place the following in your .profile (or
equivalent):

export RUBYOPT=rubygems

See http://docs.rubygems.org/read/chapter/3#page70 for a discussion of
the different options.

In my case ir
would be /usr/local/lib/ruby/site_ruby/but that is precicely where the
GEMS do not get installed by gem install …

Umm … you don’t need to put the path name in RUBYOPT. Just
“rubygems”. That makes sure the RubyGems runtime is loaded and then it
will find the rubygems for you.

On 6/29/06, Lanny R. [email protected] wrote:

Thanks. Setting RUBYOPTS would not be a hack if it worked. In my case ir
would be /usr/local/lib/ruby/site_ruby/but that is precicely where the
GEMS do not get installed by gem install …

What the RUBYOPT environment variable provides is a default set of
flags to provide to the ruby runtime. So these are essentially
equivalent:

RUBYOPT=-rubygems ruby foo.rb
ruby -rubygems foo.rb

An added bonus to using RUBYOPT is that scripts marked as executable
and with a shebang will receive the benefit as well. So if you’re
script starts with #!/usr/bin/ruby, then setting RUBYOPT=-rubygems
before running the script is the same as changing the shebang to
include the -rubygems flag.

Now, the -rubygems flag itself isn’t really it’s own flag, it’s a
clever use of Ruby’s -r flag. The -r flag requires its argument at the
start of the script, as if you had added a require statement. So using
the -rubygems flag (or placing -rubygems in your RUBYOPT) is
equivalent to adding the following line to the top of every script:

require ‘ubygems’

The ubygems.rb file (in /usr/lib/ruby/site_ruby/1.8/ on my system) in
turn simply loads the actual ‘rubygems’ library. The ‘ubygems’ version
is there just so you can type a -rubygems flag rather than -rrubygems.

So… setting RUBYOPT=-rubygems is essentially equivalent to adding
require ‘rubygems’ to each of your scripts, all through one
environment variable.

Thank you for your help. I am not about to grep through all files
prepending a missing line of code, that is no fun :-). I’ll wait for a
while to see if this is fixed and play with Ruby on my Mac where it
works perfectly - same version, same gems and same typi application.

My guess is that it works on your Mac but not on your other machine
because the Mac already has the RUBYOPT environment variable set up,
while your other machine doesn’t. You can check with:

echo $RUBYOPT

on both machines at the command line. You can also try:

RUBYOPT=-rubygems script/server

in your typo directory.

Jacob F.

On 6/29/06, Lanny R. [email protected] wrote:

Thanks. Setting RUBYOPTS would not be a hack if it worked. In my case ir
would be /usr/local/lib/ruby/site_ruby/but that is precicely where the
GEMS do not get installed by gem install …

And they shouldn’t be installed in site_ruby.

Thank you for your help. I am not about to grep through all files
prepending a missing line of code, that is no fun :-). I’ll wait for a
while to see if this is fixed and play with Ruby on my Mac where it
works perfectly - same version, same gems and same typi application.

If the software that you’re playing with is written right, you
shouldn’t need to prepend that missing line of code.

-austin

Oh, and by the way, what version of Typo are you using? As far as I
know, the current distribution of Typo comes with it’s own copy of
Rails 1.0 frozen in the vendor/ directory since Typo doesn’t work
(yet) with Rails 1.1. So it shouldn’t even be looking for the rails
gems. Also, looking in the default config/boot.rb for any Rails
project, it looks like it’s going to load rubygems explicitly for you
unless you’re using a copy of Rails in vendor/. I’m just curious about
what your setup is like…

Jacob F.

Austin Z. wrote:

On 6/29/06, Lanny R. [email protected] wrote:

Thanks. Setting RUBYOPTS would not be a hack if it worked. In my case ir
would be /usr/local/lib/ruby/site_ruby/but that is precicely where the
GEMS do not get installed by gem install …

And they shouldn’t be installed in site_ruby.

Thank you for your help. I am not about to grep through all files
prepending a missing line of code, that is no fun :-). I’ll wait for a
while to see if this is fixed and play with Ruby on my Mac where it
works perfectly - same version, same gems and same typi application.

If the software that you’re playing with is written right, you
shouldn’t need to prepend that missing line of code.

-austin

Thank you. Seems you are right, I tried another test project and it
worked well. Except for the coonect to Apache but I myst read some more
on it…

Jacob F. wrote:
<…>

I did not wait for confirmation and reinstalled everything from scratch
to be able to shouw you the original message:

rs6000:/huge/typo-2.6.0_with-rails>script/server
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require__': no such file to load -- redcloth (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require’
from ./script/…/config/environment.rb:40
from script/server:42
rs6000:/huge/typo-2.6.0_with-rails>

The standard test works …

rs6000:/u/rails/test>script/server
=> Booting WEBrick…
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2006-06-30 02:50:10] INFO WEBrick 1.3.1
[2006-06-30 02:50:10] INFO ruby 1.8.4 (2005-12-24) [powerpc-aix4.3.3.0]
[2006-06-30 02:50:10] INFO WEBrick::HTTPServer#start: pid=18794
port=3000

On 6/30/06, Lanny R. [email protected] wrote:

rs6000:/huge/typo-2.6.0_with-rails>script/server
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require__': no such file to load -- redcloth (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require’
from ./script/…/config/environment.rb:40
from script/server:42

Ok, it looks like rubygems is being required as necessary, since the
error is originating in rubygems/custom_require.rb. Have you installed
the redcloth gem? (via ‘gem install redcloth’… once it’s installed
as a gem, you shouldn’t have to do anything else).

Jacob F.

Jacob F. wrote:

Oh, and by the way, what version of Typo are you using? As far as I
know, the current distribution of Typo comes with it’s own copy of
Rails 1.0 frozen in the vendor/ directory since Typo doesn’t work
(yet) with Rails 1.1. So it shouldn’t even be looking for the rails
gems. Also, looking in the default config/boot.rb for any Rails
project, it looks like it’s going to load rubygems explicitly for you
unless you’re using a copy of Rails in vendor/. I’m just curious about
what your setup is like…

Jacob F.

Thank you for responding. I will try to be brief …

I installed Ruby on 3 systems

  • OS/X from prepackaged installer - works well
  • Win XP binaries - works well
  • AIX 4.3.3 from tarball - took a while but finally it compiled and ran
    the basic rails test. I installed NOT using GNU compilers in standard
    locations as root. Typo has no boot.rb in config. It is version
    2.6.0_with_rails.

I think that by trying to get it going, I might have messed things up by
moving stuff around.

What do you think about me just cleaning up and doing it all over again

  • install clean and all…

Lanny

Jacob F. wrote:

On 6/30/06, Lanny R. [email protected] wrote:

rs6000:/huge/typo-2.6.0_with-rails>script/server
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require__': no such file to load -- redcloth (LoadError) from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require’
from ./script/…/config/environment.rb:40
from script/server:42

Ok, it looks like rubygems is being required as necessary, since the
error is originating in rubygems/custom_require.rb. Have you installed
the redcloth gem? (via ‘gem install redcloth’… once it’s installed
as a gem, you shouldn’t have to do anything else).

Jacob F.

You would think so, wouldn’t you … Here is the results after
installing redcloth and rubypants

rs6000:/huge/typo-2.6.0_with-rails>script/server
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:53:in
alias_method': undefined method process_cleanup’ for class
ActionController::Base' (NameError) from /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:53:in included’
from
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/components.rb:52:in
included' from ./script/../config/..//vendor/rails/actionpack/lib/action_controller.rb:73 from ./script/../config/..//vendor/rails/actionpack/lib/action_controller.rb:61 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in require’
from
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require’
from ./script/…/config/environment.rb:49
from script/server:42
rs6000:/huge/typo-2.6.0_with-rails>

(I’ve snipped some of the path off the backtrace lines for readability)

On 6/30/06, Lanny R. [email protected] wrote:

  from config/environment.rb:49
  from script/server:42

Hmm. That’s a really odd trace. Basically, since you’re using the
2.6.0_with-rails version of Typo, it should be using the version of
Rails frozen in vendor/rails/ exclusively. But your trace jumps back
and forth between the rails libs in the gem installed version of rails
and the libs in vendor/rails/. Looks like a bug to me, not sure
whether it’s typo or rails, though. Or it might be something about
your environment, but I’m not sure. Best approach would probably be to
go ask on the typo and/or rails lists. Sorry :confused:

Jacob F.

“Austin Z.” [email protected] writes:

I am sorry? Am I to prepend some file/all files/ with require ‘rubygems’

I need to set it up so that the applications executing the require
actually find the objects of the require statement

This may be changed in Ruby 1.8.5, I think, but the answer essentially is yes.

You can use RUBYOPTS=-rubygems but that’s a bit of a hack.

Definitely no worse than breaking software for people that don’t want
to use Gems.

require ‘rubygems’ is the thing I hate most about Rubygems:

  1. As long as Rubygems is not standard, it adds a useless dependency
    to the source.

  2. If Rubygems becomes standard, it should not be needed anymore anyway.

If you feel like having to use require ‘rubygems’, please catch the
LoadError if it’s not there. Thank you.

Jacob F. wrote:

(I’ve snipped some of the path off the backtrace lines for readability)

On 6/30/06, Lanny R. [email protected] wrote:

  from config/environment.rb:49
  from script/server:42

Hmm. That’s a really odd trace. Basically, since you’re using the
2.6.0_with-rails version of Typo, it should be using the version of
Rails frozen in vendor/rails/ exclusively. But your trace jumps back
and forth between the rails libs in the gem installed version of rails
and the libs in vendor/rails/. Looks like a bug to me, not sure
whether it’s typo or rails, though. Or it might be something about
your environment, but I’m not sure. Best approach would probably be to
go ask on the typo and/or rails lists. Sorry :confused:

Jacob F.

Jacob, you have been most helpfull and the problem is not a show
stopper. I am just trying out RoR as a potential replacement of the
current development environment which is Java-JSP-Tomcat.

All the “new” stuff works and I am slowly learning my directions.

Thanks again

Lanny