Hi all,
I would like to know where exactly to unpack external ruby libraries for
future use. I’m using aaronp’s mechanize library (zip file)…and it
uses the require ‘mechanize’ directive.
Thanks,
Sandip
Hi all,
I would like to know where exactly to unpack external ruby libraries for
future use. I’m using aaronp’s mechanize library (zip file)…and it
uses the require ‘mechanize’ directive.
Thanks,
Sandip
Sandip Gangakhedkar wrote:
Hi all,
I would like to know where exactly to unpack external ruby libraries for
future use. I’m using aaronp’s mechanize library (zip file)…and it
uses the require ‘mechanize’ directive.Thanks,
Sandip
I think the generally accepted way to install a 3rd party library is to
use RubyGems:
“RubyGems is a standardized packaging and installation framework for
libraries and applications, making it easy to locate, install, upgrade,
and uninstall Ruby packages.” pickaxe2 p 215.
That’s what I do. You need to install RubyGems and learn how to use it.
On Monday 02 June 2008 23:38:02 7stud – wrote:
Sandip Gangakhedkar wrote:
I’m using aaronp’s mechanize library (zip file)…and it
uses the require ‘mechanize’ directive.
I think the generally accepted way to install a 3rd party library is to
use RubyGems:
Just to simplify: After installing rubyGems, the command you probably
want is:
gem install mechanize
Or, on many Unix systems:
sudo gem install mechanize
David M. wrote:
On Monday 02 June 2008 23:38:02 7stud – wrote:
Sandip Gangakhedkar wrote:
I’m using aaronp’s mechanize library (zip file)…and it
uses the require ‘mechanize’ directive.I think the generally accepted way to install a 3rd party library is to
use RubyGems:Just to simplify: After installing rubyGems, the command you probably
want is:gem install mechanize
Or, on many Unix systems:
sudo gem install mechanize
What about tarballs? Or zip files?
I am aware of RubyGems. However, lots of new and recent libraries,
especially the ones hosted on github are not yet available as gems.
Thanks,
Sandip
On Tuesday 03 June 2008, David M. wrote:
On Tuesday 03 June 2008 10:44:47 Sandip Gangakhedkar wrote:
What about tarballs? Or zip files?
I am aware of RubyGems. However, lots of new and recent libraries,
especially the ones hosted on github are not yet available as gems.If a library is new enough to not be available as a gem, I’m not sure I’d
want to install it system-wide. You can always put it somewhere in your
home directory and add it to the RUBYLIB environment variable.
I wouldn’t be so categorical. There are libraries which are quite new
and
still, for various reasons, aren’t packaged as gems. One which comes
immediately to my mind, because I use it, is qt-ruby, the ruby bindings
for
the Qt toolkit. Other are (I think) ruby-gtk2 and ruby-gnome. Then,
there’s
fastri, which offers both gem and tar.gz versions whose release note
states:
RubyGems adds a noticeable overhead to fri, making it run slower than if
you
installed it directly from the tarball with setup.rb.
If someone is concerned about speed, he may choose to install the tar.gz
version.
So, there may be more than one reason for which a library is not
released as
gems, although I wouldn’t deny that in most cases your statement is
correct.
Stefano
On Tuesday 03 June 2008 10:44:47 Sandip Gangakhedkar wrote:
What about tarballs? Or zip files?
I am aware of RubyGems. However, lots of new and recent libraries,
especially the ones hosted on github are not yet available as gems.
If a library is new enough to not be available as a gem, I’m not sure
I’d want
to install it system-wide. You can always put it somewhere in your home
directory and add it to the RUBYLIB environment variable.
On Tuesday 03 June 2008, Sandip Gangakhedkar wrote:
What about tarballs? Or zip files?
I am aware of RubyGems. However, lots of new and recent libraries,
especially the ones hosted on github are not yet available as gems.Thanks,
Sandip
To know where ruby looks for files, you can look at the contents of the
$:
global variable in ruby:
ruby -e ‘puts $:’
On my (gentoo linux) system, the output is:
/usr/lib/ruby/site_ruby/1.8
/usr/lib/ruby/site_ruby/1.8/i686-linux
/usr/lib/ruby/site_ruby
/usr/lib/ruby/1.8
/usr/lib/ruby/1.8/i686-linux
.
On other systems, the output may vary. I think that the most correct
place to
put user-installed libraries is under the site_ruby/1.8 directory.
An alternative could be to install them in any place you like and set
the
environment variable RUBYLIB to include that directory. For instance, if
I
decided to install some ruby libraries in /home/stefano/ruby_libraries,
I
should put the line (assuming a bash shell)
export RUBYLIB=/home/stefano/ruby_libraries
in my .bashrc file.
At any rate, unless you have very good reasons to install the library in
a
custom place, I think you should use the site_ruby directory, as I said
above.
I hope this helps
Stefano
On Tue, Jun 3, 2008 at 11:44 AM, Sandip Gangakhedkar
[email protected] wrote:
What about tarballs? Or zip files?
I am aware of RubyGems. However, lots of new and recent libraries,
especially the ones hosted on github are not yet available as gems.
Github gems are all available via rubygems so long as the package
maintainer enables the option. See http://gems.github.com/
Do note the warning there, though. Permanently adding github as a gem
source royally b0rked my rubygems installation. Stick with the manual
source specification for now. E.g.
sudo gem install mojombo-grit -s http://gems.github.com
–
Avdi
Home: http://avdi.org
Developer Blog: Avdi Grimm, Code Cleric
Twitter: http://twitter.com/avdi
Journal: http://avdi.livejournal.com
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs