(just) retrieve and unpack a gem

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 rdm@cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, and web development

Rich Morin a écrit :

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
  

Do it like this

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.

···

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

Rich Morin wrote:

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

···

--
Posted via http://www.ruby-forum.com/\.

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.

···

On Jul 13, 2009, at 18:37, Rich Morin wrote:

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

geistteufel wrote:

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.

···

--
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Roger Pack wrote:

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

···

--
Posted via http://www.ruby-forum.com/\.

Joel VanderWerf a écrit :

geistteufel wrote:

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.

You can do like this :

gem fetch rake
ls rake*.gem

et pour l'unpack
gem unpack rake*.gem

=> nothing install :slight_smile:

···

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

Rich Morin a écrit :

Roger Pack wrote:
  

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
  

no prob !

···

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