Forum: Ruby Newbie question: Where to put library .rb files?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
47df9cfb356c3ee0523cc3571b169730?d=identicon&s=25 Kenneth McDonald (Guest)
on 2008-11-04 18:24
(Received via mailing list)
At our site, newly started using Ruby, we're now starting to get code
we'd like to make generally available via 'require'. What is the
standard location/method for doing this? Can it be done in such a
manner that rdoc and ri documentation is made available to the site,
preferably integrated with the rest of the ruby docs on this site?

Thanks,
Ken McDonald
76d5176f2419e5984d7680d1951c0b5e?d=identicon&s=25 Aldric Giacomoni (Guest)
on 2008-11-05 16:35
(Received via mailing list)
I don't have a direct answer to your question - but what you're looking
for is how to create a gem..
Best of luck on your research!

--Aldric
31fdda5f38fc6df4e193cfb7445ddc5a?d=identicon&s=25 RichardOnRails (Guest)
on 2008-11-05 22:20
(Received via mailing list)
On Nov 4, 12:22 pm, Kenneth McDonald
<kenneth.m.mcdon...@sbcglobal.net> wrote:
> At our site, newly started using Ruby, we're now starting to get code  
> we'd like to make generally available via 'require'. What is the  
> standard location/method for doing this? Can it be done in such a  
> manner that rdoc and ri documentation is made available to the site,  
> preferably integrated with the rest of the ruby docs on this site?
>
> Thanks,
> Ken McDonald

The place you want is ruby\lib\ruby\site_ruby.

For example,  I have my home-grown utility Search.rb stored there,
which defines a Search class.  Then a Ruby program stored anywhere can
simply include:

require 'search' # case-insensitive on WinXP, e.g.
s = Seach.new # etc.

HTH,
Richard
C1b6b5557723c9db912b075e954166d3?d=identicon&s=25 Jeff Moore (djief)
on 2008-11-06 01:20
Kenneth McDonald wrote:
> At our site, newly started using Ruby, we're now starting to get code
> we'd like to make generally available via 'require'. What is the
> standard location/method for doing this? Can it be done in such a
> manner that rdoc and ri documentation is made available to the site,
> preferably integrated with the rest of the ruby docs on this site?
>
> Thanks,
> Ken McDonald

To see what your current config is set to cut-n-paste this into
irb:


puts "ruby load directories"
puts
$:.each do |e|
  puts e
end


Since I work across a variety of platforms, I prefer to set the
RUBYLIB environment variable on each of my systems to a directory
of my choosing. This directory is added to load paths in $:
This topic is locked and can not be replied to.