5

How can I unpack a gem specified in bundler by a :git => url?

My Gemfile has

gem 'my_gem', :git => 'git@github.com:xxxxx/xxxxx.git'

$ bundle correctly reports the gem as available, and my code works. $ bundle which my_gem even tells me where my gem is stored. However:

$ gem unpack my_gem
ERROR:  Gem 'my_gem' not installed nor fetchable.
$ bundle exec gem unpack my_gem
ERROR:  Gem 'my_gem' not installed nor fetchable.

Is it possible to unpack a gem installed like this?

Gareth
  • 133,157
  • 36
  • 148
  • 157

3 Answers3

6

Why the need to unpack it? You already have the sourcecode. The point of specifying a git repository is that you don't have a bundled gem, but the source to generate it.

Simply use

git clone git://github.com/xxxx/yyy.git

and the source will be in the yyy folder of the current directory.

Femaref
  • 60,705
  • 7
  • 138
  • 176
  • Argh, yes of course it's that simple. I'm getting messed up deploying an app to Heroku, which can't access gems in private repos. This was completely the wrong question to ask, so thanks anyway :) – Gareth Sep 22 '11 at 17:45
3

Also, you can open any gem in your Gemfile using:

    bundle open my_gem
rdvdijk
  • 4,400
  • 26
  • 30
0

Not exactly answering the question but supposing you had the gem file to hand, it's a bunch of gzip files tarred up (opposite to the usual)

$ tar xzf mygem.gem
$ ls
mygem.gem checksums.yaml.gz  data.tar.gz  metadata.gz

metaddata.gz is the gemspec, and data.tar.gz is all the files (lib/my/stuff.rb etc).

robert
  • 4,612
  • 2
  • 29
  • 39