(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 M.
http://www.cfcl.com/rdm/resume [email protected]
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, and web development

Rich M. a écrit :

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.

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

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:

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.

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

On Jul 13, 2009, at 18:37, Rich M. wrote:

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.

Rich M. a écrit :

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 !

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs