gem unpack --target usage

Discussion in 'Ruby' started by James Britt, Aug 24, 2008.

  1. James Britt

    James Britt Guest

    I'm trying to unpack a gem into a particular directory, but cannot get
    the --target option to work.

    $ gem --version
    1.2.0



    gem help unpack
    Usage: gem unpack GEMNAME [options]

    Options:
    --target target directory for unpacking



    $ gem unpack RedCloth --target /tmp
    ERROR: While executing gem ... (Gem::CommandLineError)
    Too many gem names (RedCloth, /tmp); please specify only one

    $ gem unpack RedCloth --target=/tmp
    ERROR: While executing gem ... (OptionParser::NeedlessArgument)
    needless argument: --target=/tmp


    How is this supposed to work?

    $ gem unpack RedCloth

    works fine; trying to give a target not so fine.



    Thanks,


    --
    James Britt

    www.happycamperstudios.com - Wicked Cool Coding
    www.jamesbritt.com - Playing with Better Toys
    www.ruby-doc.org - Ruby Help & Documentation
    www.rubystuff.com - The Ruby Store for Ruby Stuff
    James Britt, Aug 24, 2008
    #1
    1. Advertising

  2. James Britt wrote:
    > I'm trying to unpack a gem into a particular directory, but cannot get
    > the --target option to work.


    gem unpack foo.gem -- --target foo # works here.
    --
    Posted via http://www.ruby-forum.com/.
    Erik Hollensbe, Aug 24, 2008
    #2
    1. Advertising

  3. James Britt

    James Britt Guest

    Erik Hollensbe wrote:
    > James Britt wrote:
    >> I'm trying to unpack a gem into a particular directory, but cannot get
    >> the --target option to work.

    >
    > gem unpack foo.gem -- --target foo # works here.


    I just tried it. It "works" by unpacking the gem into the current
    directory, completely ignoring the --target option.


    Not quite what I'm looking for.



    --
    James Britt

    www.happycamperstudios.com - Wicked Cool Coding
    www.jamesbritt.com - Playing with Better Toys
    www.ruby-doc.org - Ruby Help & Documentation
    www.rubystuff.com - The Ruby Store for Ruby Stuff
    James Britt, Aug 24, 2008
    #3
  4. James Britt wrote:
    > Erik Hollensbe wrote:
    >> James Britt wrote:
    >>> I'm trying to unpack a gem into a particular directory, but cannot get
    >>> the --target option to work.

    >>
    >> gem unpack foo.gem -- --target foo # works here.

    >
    > I just tried it. It "works" by unpacking the gem into the current
    > directory, completely ignoring the --target option.


    What version of rubygems do you have? Mine cleanly unpacked into the
    'foo' directory. I'm on 1.2.0.

    -Erik
    --
    Posted via http://www.ruby-forum.com/.
    Erik Hollensbe, Aug 25, 2008
    #4
  5. James Britt

    James Britt Guest

    Erik Hollensbe wrote:
    > James Britt wrote:
    >> Erik Hollensbe wrote:
    >>> James Britt wrote:
    >>>> I'm trying to unpack a gem into a particular directory, but cannot get
    >>>> the --target option to work.
    >>> gem unpack foo.gem -- --target foo # works here.

    >> I just tried it. It "works" by unpacking the gem into the current
    >> directory, completely ignoring the --target option.

    >
    > What version of rubygems do you have?



    I'm using 1.2.0, on Kubuntu, running

    ruby 1.8.6 (2008-08-08 patchlevel 286) [i686-linux]


    I don't have a 'foo.gem' file to try; I have RedCloth installed as a gem
    and want to unpack it to a particular location.



    I can unpack to the current directory if I omit any --target option.


    So, this works:


    james@james06:~$ pwd
    /home/james
    james@james06:~$ gem unpack RedCloth
    Unpacked gem: '/home/james/RedCloth-3.0.4'
    james@james06:~$


    This fails


    james@james06:~$ gem unpack RedCloth --target /tmp/RC
    ERROR: While executing gem ... (Gem::CommandLineError)
    Too many gem names (RedCloth, /tmp/RC); please specify only one
    james@james06:~$


    Using the extra '--' as in your example acts as if I pass no --target
    option:


    james@james06:~$ gem unpack RedCloth -- --target /tmp/RC
    Unpacked gem: '/home/james/RedCloth-3.0.4'


    If I copy the actual gem file to my working directory:

    james@james06:~$ gem unpack RedCloth-3.0.4.gem -- --target /tmp/RC
    Unpacked gem: '/home/james/RedCloth-3.0.4'


    james@james06:~$ gem unpack RedCloth-3.0.4.gem --target /tmp/RC
    ERROR: While executing gem ... (Gem::CommandLineError)
    Too many gem names (RedCloth-3.0.4.gem, /tmp/RC); please specify
    only one


    BTW, why do you use the extra '--' in your example? (Not that it helps
    me either way.)


    --
    James Britt

    www.happycamperstudios.com - Wicked Cool Coding
    www.jamesbritt.com - Playing with Better Toys
    www.ruby-doc.org - Ruby Help & Documentation
    www.rubystuff.com - The Ruby Store for Ruby Stuff
    James Britt, Aug 25, 2008
    #5
  6. James Britt wrote:
    > BTW, why do you use the extra '--' in your example? (Not that it helps
    > me either way.)


    The -- indicates that no more arguments are coming; I suspect it's a bug
    (feature?) in rubygems's argument parser that it wants it this way.

    -Erik
    --
    Posted via http://www.ruby-forum.com/.
    Erik Hollensbe, Aug 25, 2008
    #6
  7. James Britt

    James Britt Guest

    Erik Hollensbe wrote:
    > James Britt wrote:
    >> BTW, why do you use the extra '--' in your example? (Not that it helps
    >> me either way.)

    >
    > The -- indicates that no more arguments are coming; I suspect it's a bug
    > (feature?) in rubygems's argument parser that it wants it this way.


    Well, that would explain why, when I run unpack using those dahss it
    ignore the subsequent --target option.

    I'm thinking now that if you are unpacking foo.gem then, by default, it
    will go into foo/ (which is the same as having no --target option, and
    which is what you get using the '--' as you have).

    If you run

    gem unpack foo.gem -- --target bar

    I think you'd still get a foo/ directory, not bar/



    --
    James Britt

    www.happycamperstudios.com - Wicked Cool Coding
    www.jamesbritt.com - Playing with Better Toys
    www.ruby-doc.org - Ruby Help & Documentation
    www.rubystuff.com - The Ruby Store for Ruby Stuff
    James Britt, Aug 25, 2008
    #7
  8. James Britt

    F. Senault Guest

    Le 24 août 2008 à 21:17, James Britt a écrit :

    > I'm trying to unpack a gem into a particular directory, but cannot get
    > the --target option to work.


    Looks like a bug.

    Try this :

    # diff -u rubygems/commands/unpack_command.rb.orig rubygems/commands/unpack_command.rb
    --- rubygems/commands/unpack_command.rb.orig Mon Aug 25 12:53:50 2008
    +++ rubygems/commands/unpack_command.rb Mon Aug 25 12:53:20 2008
    @@ -12,7 +12,7 @@
    :version => Gem::Requirement.default,
    :target => Dir.pwd

    - add_option('--target', 'target directory for unpacking') do |value, options|
    + add_option('--target=DIR', 'target directory for unpacking') do |value, options|
    options[:target] = value
    end

    And...

    > gem unpack BlueCloth --target=./tmp

    Unpacked gem: '/home/fred/tmp/BlueCloth-1.0.0'

    Fred
    --
    You better make your face up In your favorite disguise
    With your button-down lips And your roller blind eyes
    With your empty smile And your hungry heart
    (Pink Floyd, Run Like Hell)
    F. Senault, Aug 25, 2008
    #8
  9. James Britt

    James Britt Guest

    F. Senault wrote:
    > Le 24 août 2008 à 21:17, James Britt a écrit :
    >
    >> I'm trying to unpack a gem into a particular directory, but cannot get
    >> the --target option to work.

    >
    > Looks like a bug.
    >
    > Try this :


    You, sir, are the greatest.


    Thank you!

    --
    James Britt

    www.happycamperstudios.com - Wicked Cool Coding
    www.jamesbritt.com - Playing with Better Toys
    www.ruby-doc.org - Ruby Help & Documentation
    www.rubystuff.com - The Ruby Store for Ruby Stuff
    James Britt, Aug 25, 2008
    #9
  10. James Britt

    F. Senault Guest

    Le 25 août 2008 à 20:37, James Britt a écrit :

    > F. Senault wrote:


    >> Try this :

    >
    > You, sir, are the greatest.
    >
    > Thank you!


    Well. If a maintainer of rubygems reads this, I believe it should be
    included.

    (I tried to submit the patch via rubyforge, but I don't have an account
    there.)

    Fred
    --
    Hey you, out there in the cold Getting lonely, getting old Can you
    feel me ? Hey you, standing in the aisle With itchy feet and fading
    smile Can you feel me ? Hey you, don't help them to bury the light
    Don't give in without a fight (Pink Floyd, Hey You)
    F. Senault, Aug 26, 2008
    #10
    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. mohit
    Replies:
    0
    Views:
    553
    mohit
    Jan 23, 2008
  2. Alex Young

    Gem unpack problem

    Alex Young, Jan 25, 2007, in forum: Ruby
    Replies:
    2
    Views:
    116
    Alex Young
    Jan 25, 2007
  3. Austin 7873
    Replies:
    5
    Views:
    185
    Eric Hodel
    Jan 27, 2007
  4. Rich Morin

    (just) retrieve and unpack a gem

    Rich Morin, Jul 14, 2009, in forum: Ruby
    Replies:
    7
    Views:
    137
    Eric Hodel
    Jul 22, 2009
  5. Ray K.
    Replies:
    2
    Views:
    96
    Brian Candler
    Oct 14, 2009
Loading...

Share This Page