Listing installed gems

Discussion in 'Ruby' started by Shilo Ayalon, Jan 25, 2009.

  1. Shilo Ayalon

    Shilo Ayalon Guest

    Hi -

    I'm trying to find out if there's a simple way to list all the gems I
    have installed on my system (linux/windows), or perhaps there exists a
    rake task that does this. Of course, I could execute ls/dir on my gem
    directory, but just wanted to see if there's already something like this
    or more (say, list gem and version).

    I'd appreciate any feedback - thanks!
    --
    Posted via http://www.ruby-forum.com/.
    Shilo Ayalon, Jan 25, 2009
    #1
    1. Advertising

  2. Alle domenica 25 gennaio 2009, Shilo Ayalon ha scritto:
    > Hi -
    >
    > I'm trying to find out if there's a simple way to list all the gems I
    > have installed on my system (linux/windows), or perhaps there exists a
    > rake task that does this. Of course, I could execute ls/dir on my gem
    > directory, but just wanted to see if there's already something like this
    > or more (say, list gem and version).
    >
    > I'd appreciate any feedback - thanks!


    Doesn't

    gem list

    does what you want? On my system (with rubygems 1.3.1) this command prints a
    list of all the installed gems, together with their version. For example, a
    part of the list looks like this:

    rdoc (2.2.1)
    RedCloth (4.1.1)
    rice (1.0.2)
    rspec (1.1.12, 1.1.10)
    ruby-debug (0.10.3)
    ruby-debug-base (0.10.3, 0.10.2)
    rubyforge (1.0.1)
    RubyInline (3.8.1)

    Stefano
    Stefano Crocco, Jan 25, 2009
    #2
    1. Advertising

  3. Shilo Ayalon

    Shilo Ayalon Guest


    > Doesn't
    >
    > gem list
    >
    > does what you want?


    Bingo, must have missed that in the gem --help (yup, feeling dumb right
    now).

    Thanks!
    --
    Posted via http://www.ruby-forum.com/.
    Shilo Ayalon, Jan 25, 2009
    #3
  4. Shilo Ayalon

    Tom Cloyd Guest

    Shilo Ayalon wrote:
    >> Doesn't
    >>
    >> gem list
    >>
    >> does what you want?
    >>

    >
    > Bingo, must have missed that in the gem --help (yup, feeling dumb right
    > now).
    >
    > Thanks!
    >

    technically, the correct command, I believe is "gem list --local" or
    "gem list -l"

    And, here's another one I just learned (from this list) - in case you
    missed it:

    If I want to know if I have a particular gem installed, say "webby", any
    of these will return the desired result:

    gem list | grep we
    gem list | grep ebb
    gem list | grep bey

    $ gem list | grep ebb
    webby (0.9.3)


    t.

    --

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
    Bellingham, Washington, U.S.A: (360) 920-1226
    << >> (email)
    << TomCloyd.com >> (website)
    << sleightmind.wordpress.com >> (mental health weblog)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Tom Cloyd, Jan 25, 2009
    #4
  5. On Jan 25, 2009, at 3:55 PM, Tom Cloyd wrote:

    > Shilo Ayalon wrote:
    >>> Doesn't
    >>>
    >>> gem list
    >>>
    >>> does what you want?

    >>
    >> Bingo, must have missed that in the gem --help (yup, feeling dumb
    >> right now).
    >>
    >> Thanks!
    >>

    > technically, the correct command, I believe is "gem list --local" or
    > "gem list -l"
    >
    > And, here's another one I just learned (from this list) - in case
    > you missed it:
    >
    > If I want to know if I have a particular gem installed, say "webby",
    > any of these will return the desired result:
    >
    > gem list | grep we
    > gem list | grep ebb
    > gem list | grep bey
    >
    > $ gem list | grep ebb
    > webby (0.9.3)
    >
    > t.
    > --
    >
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    > Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
    > Bellingham, Washington, U.S.A: (360) 920-1226
    > << >> (email)
    > << TomCloyd.com >> (website) << sleightmind.wordpress.com >> (mental
    > health weblog)
    > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



    In that case, you can give a prefix to gem list:

    $ gem list --local ra

    *** LOCAL GEMS ***

    rack (0.9.1)
    rails (2.1.2, 2.1.0, 2.0.2, 1.2.6, 1.2.5, 1.2.3)
    rake (0.8.3, 0.8.1, 0.7.3)

    This gets unfortunately messy with github building gems now:

    $ gem list --local w

    *** LOCAL GEMS ***

    webgen (0.5.0, 0.4.7, 0.4.6)

    $ gem list --local | grep -e paginate
    mislav-will_paginate (2.3.6)

    Oh well, "progress"!

    -Rob

    Rob Biedenharn http://agileconsultingllc.com
    Rob Biedenharn, Jan 25, 2009
    #5
  6. Shilo Ayalon

    Tom Cloyd Guest

    Rob Biedenharn wrote:
    > On Jan 25, 2009, at 3:55 PM, Tom Cloyd wrote:
    >
    >> Shilo Ayalon wrote:
    >>>> Doesn't
    >>>>
    >>>> gem list
    >>>>
    >>>> does what you want?
    >>>
    >>> Bingo, must have missed that in the gem --help (yup, feeling dumb
    >>> right now).
    >>>
    >>> Thanks!
    >>>

    >> technically, the correct command, I believe is "gem list --local" or
    >> "gem list -l"
    >>
    >> And, here's another one I just learned (from this list) - in case you
    >> missed it:
    >>
    >> If I want to know if I have a particular gem installed, say "webby",
    >> any of these will return the desired result:
    >>
    >> gem list | grep we
    >> gem list | grep ebb
    >> gem list | grep bey
    >>
    >> $ gem list | grep ebb
    >> webby (0.9.3)
    >>
    >> t.
    >> --
    >>
    >>

    >
    >
    > In that case, you can give a prefix to gem list:
    >
    > $ gem list --local ra
    >
    > *** LOCAL GEMS ***
    >
    > rack (0.9.1)
    > rails (2.1.2, 2.1.0, 2.0.2, 1.2.6, 1.2.5, 1.2.3)
    > rake (0.8.3, 0.8.1, 0.7.3)

    OK, that's interesting, but not equivalent, I find:

    * gem list -l ra => lists all local gems BEGINNING with "ra"
    * gem list -l | grep ra => list all CONTAINING "ra"

    It's nice to have options, eh? (unless you don't know about them!)

    t.

    --

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Tom Cloyd, MS MA, LMHC - Private practice Psychotherapist
    Bellingham, Washington, U.S.A: (360) 920-1226
    << >> (email)
    << TomCloyd.com >> (website)
    << sleightmind.wordpress.com >> (mental health weblog)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Tom Cloyd, Jan 25, 2009
    #6
  7. Shilo Ayalon

    Luc Heinrich Guest

    On 25 janv. 09, at 22:07, Rob Biedenharn wrote:

    > In that case, you can give a prefix to gem list:
    >
    > $ gem list --local ra


    This prefix can apparently be a regular expression so you can do:

    % gem list -l ".*ra"

    to list all gems containing "ra".

    --
    Luc Heinrich -
    Luc Heinrich, Jan 26, 2009
    #7
  8. On Jan 26, 2009, at 2:40 AM, Luc Heinrich wrote:
    > On 25 janv. 09, at 22:07, Rob Biedenharn wrote:
    >
    >> In that case, you can give a prefix to gem list:
    >>
    >> $ gem list --local ra

    >
    > This prefix can apparently be a regular expression so you can do:
    >
    > % gem list -l ".*ra"
    >
    > to list all gems containing "ra".
    >
    > --
    > Luc Heinrich -


    Good to know! I like when my own advice comes back even better!

    Thanks, Luc

    -Rob

    Rob Biedenharn http://agileconsultingllc.com
    Rob Biedenharn, Jan 26, 2009
    #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. gusmeister

    Listing installed perl modules

    gusmeister, Mar 2, 2004, in forum: Perl
    Replies:
    3
    Views:
    2,058
    Will Stranathan
    Mar 3, 2004
  2. Tomás

    Gems -- #include <gems.hpp>

    Tomás, Mar 4, 2006, in forum: C++
    Replies:
    7
    Views:
    422
    Tomás
    Mar 5, 2006
  3. Lloyd Zusman
    Replies:
    3
    Views:
    182
    Lloyd Zusman
    Jun 21, 2005
  4. Thaddeus L Olczyk

    Problem getting gems/listing gems. EINVAL

    Thaddeus L Olczyk, Aug 15, 2006, in forum: Ruby
    Replies:
    0
    Views:
    190
    Thaddeus L Olczyk
    Aug 15, 2006
  5. Julien Phalip

    Listing modules from all installed packages

    Julien Phalip, Jun 9, 2013, in forum: Python
    Replies:
    5
    Views:
    145
    Julien Phalip
    Jun 14, 2013
Loading...

Share This Page