[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

gem unpack --target usage

James Britt

8/24/2008 7:18:00 PM

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

9 Answers

Erik Hollensbe

8/24/2008 7:46:00 PM

0

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

James Britt

8/24/2008 9:45:00 PM

0

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

Erik Hollensbe

8/25/2008 12:04:00 AM

0

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

James Britt

8/25/2008 12:30:00 AM

0

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

Erik Hollensbe

8/25/2008 12:39:00 AM

0

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

James Britt

8/25/2008 1:31:00 AM

0

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

F. Senault

8/25/2008 10:56:00 AM

0

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)

James Britt

8/25/2008 6:37:00 PM

0

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

F. Senault

8/26/2008 10:16:00 AM

0

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)