[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

general query about ruby libraries

Sandip Gangakhedkar

6/2/2008 8:28:00 PM

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
--
Posted via http://www.ruby-....

7 Answers

7stud --

6/3/2008 4:38:00 AM

0

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.

--
Posted via http://www.ruby-....

David Masover

6/3/2008 4:43:00 AM

0

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

Sandip Gangakhedkar

6/3/2008 3:45:00 PM

0

David Masover 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
--
Posted via http://www.ruby-....

Stefano Crocco

6/3/2008 3:55:00 PM

0

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

David Masover

6/3/2008 6:07:00 PM

0

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.



Stefano Crocco

6/3/2008 6:57:00 PM

0

On Tuesday 03 June 2008, David Masover 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

Avdi Grimm

6/5/2008 4:30:00 AM

0

On Tue, Jun 3, 2008 at 11:44 AM, Sandip Gangakhedkar
<sandipfloyd@gmail.com> 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.g...

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....


--
Avdi

Home: http:...
Developer Blog: http:.../devblog/
Twitter: http://twitte...
Journal: http://avdi.livej...