(just) retrieve and unpack a gem

R

Rich Morin

I need to retrieve and unpack a large number of gems, without
either (a) affecting my local gem installation or (b) getting
involved with dependencies. "gem fetch" will retrieve random
gems, but "gem unpack" is a bit more picky.

According to http://docs.rubygems.org/read/chapter/10#page34:

You can only unpack gems that you have installed, ...

I can hack the gem command to get the results I want, but it
seems like there should be a way to do this. Clues, anyone?

-r
--
http://www.cfcl.com/rdm Rich Morin
http://www.cfcl.com/rdm/resume (e-mail address removed)
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, and web development
 
G

geistteufel

Rich Morin a =E9crit :
I need to retrieve and unpack a large number of gems, without
either (a) affecting my local gem installation or (b) getting
involved with dependencies. "gem fetch" will retrieve random
gems, but "gem unpack" is a bit more picky.

According to http://docs.rubygems.org/read/chapter/10#page34:

You can only unpack gems that you have installed, ...

I can hack the gem command to get the results I want, but it
seems like there should be a way to do this. Clues, anyone?

-r
=20
Do it like this

cd /tmp
GEM_HOME=3D$PWD GEM_PATH=3D$PWD gem install PACKAGE
So look in cache directory. All gem is there.
Just do gem unpack GEM and done !
System is protected ! You can do it as user to be sure of that.


--=20
http://blog.celogeek.fr : Celogeek Blog
- a geek web site, with my tricks for phone (tuto, test ...), linux and m=
ore (french only)
- Fan de linux, de mobile et de programmation, mon blog est fait pour vou=
s ! Tous mes trucs et astuces la !
 
R

Roger Pack

Rich said:
I need to retrieve and unpack a large number of gems, without
either (a) affecting my local gem installation or (b) getting
involved with dependencies. "gem fetch" will retrieve random
gems, but "gem unpack" is a bit more picky.

According to http://docs.rubygems.org/read/chapter/10#page34:

You can only unpack gems that you have installed, ...

Oh no--you can unpack arbitrary gems [I think that's the only ones you
can].
gem fetch gem_name
gem unpack gem_name.version.gem
Cheers.
=r
 
J

Joel VanderWerf

geistteufel said:
cd /tmp
GEM_HOME=$PWD GEM_PATH=$PWD gem install PACKAGE
So look in cache directory. All gem is there.
Just do gem unpack GEM and done !
System is protected ! You can do it as user to be sure of that.

Won't that still install bin stuff? For example, gem install rake.
 
G

geistteufel

Joel VanderWerf a =E9crit :
Won't that still install bin stuff? For example, gem install rake.
You can do like this :

gem fetch rake
ls rake*.gem

et pour l'unpack
gem unpack rake*.gem

=3D> nothing install :)

--=20
http://blog.celogeek.fr : Celogeek Blog
- a geek web site, with my tricks for phone (tuto, test ...), linux and m=
ore (french only)
- Fan de linux, de mobile et de programmation, mon blog est fait pour vou=
s ! Tous mes trucs et astuces la !
 
R

Rich Morin

Roger said:
gem unpack gem_name.version.gem

That is really close, but it gets a nastygram:

$ gem unpack rails.2.3.2.gem
ERROR: While executing gem ... (Gem::Exception)
Cannot load gem at [rails.2.3.2.gem] in .../rails

However, this seems to work just fine:

$ gem unpack rails-2.3.2.gem
Unpacked gem: '.../rails/rails-2.3.2'

Thanks!

-r
 
G

geistteufel

Rich Morin a =C3=A9crit :
Roger Pack wrote:
=20
gem unpack gem_name.version.gem
=20

That is really close, but it gets a nastygram:

$ gem unpack rails.2.3.2.gem
ERROR: While executing gem ... (Gem::Exception)
Cannot load gem at [rails.2.3.2.gem] in .../rails

However, this seems to work just fine:

$ gem unpack rails-2.3.2.gem
Unpacked gem: '.../rails/rails-2.3.2'

Thanks!

-r
=20
no prob !

--=20
http://blog.celogeek.fr : Celogeek Blog
- a geek web site, with my tricks for phone (tuto, test ...), linux and m=
ore (french only)
- Fan de linux, de mobile et de programmation, mon blog est fait pour vou=
s ! Tous mes trucs et astuces la !
 
E

Eric Hodel

You can only unpack gems that you have installed, ...

There's probably a feature request for that, but I've not bothered to
implement it.

It would be a nice feature to have, though, so I welcome a patch if
you have more time than me.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top