general query about ruby libraries

Discussion in 'Ruby' started by Sandip Gangakhedkar, Jun 2, 2008.

  1. 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-forum.com/.
    Sandip Gangakhedkar, Jun 2, 2008
    #1
    1. Advertising

  2. Sandip Gangakhedkar

    7stud -- Guest

    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-forum.com/.
    7stud --, Jun 3, 2008
    #2
    1. Advertising

  3. 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 Masover, Jun 3, 2008
    #3
  4. 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-forum.com/.
    Sandip Gangakhedkar, Jun 3, 2008
    #4
  5. 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
    Stefano Crocco, Jun 3, 2008
    #5
  6. 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.
    David Masover, Jun 3, 2008
    #6
  7. 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
    Stefano Crocco, Jun 3, 2008
    #7
  8. Sandip Gangakhedkar

    Avdi Grimm Guest

    On Tue, Jun 3, 2008 at 11:44 AM, 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.


    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: http://avdi.org/devblog/
    Twitter: http://twitter.com/avdi
    Journal: http://avdi.livejournal.com
    Avdi Grimm, Jun 5, 2008
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andreas Pauley

    General Ledger/Accounting Libraries

    Andreas Pauley, May 11, 2004, in forum: Python
    Replies:
    6
    Views:
    419
    Nicolas Chauvat
    May 17, 2004
  2. chris
    Replies:
    4
    Views:
    875
    chris
    May 17, 2004
  3. Karsten Wutzke
    Replies:
    21
    Views:
    897
    Roedy Green
    Jun 29, 2007
  4. JNLSeb
    Replies:
    1
    Views:
    252
    Walter Roberson
    Jan 24, 2008
  5. Sriram Srinivasan
    Replies:
    13
    Views:
    541
    Benjamin Kaplan
    Nov 12, 2009
Loading...

Share This Page