4

I'm currently trying to run 'bundle install' to install a git based gem using a Gemfile and consequently use ruby/ other ruby commands without bundler with the latest version of RVM (1.14.3).

I believe the cause of the issue is that bundler is installing the git gem into .rvm/gems/ruby-1.9.3-p194@something/bundler/gems while all other gems are installed into .rvm/gems/ruby-1.9.3-p194@something/gems. As a result, 'bundle list' shows the gem but 'gem list' does not.

Any thoughts here? I'd really prefer not to use bundle to execute everything.

Michael Wasser
  • 1,776
  • 2
  • 21
  • 32

1 Answers1

6

Bundler is for bundling gems with applications. It doesn't make sense to use it for system gems. Unfortunately, the non-bundler gem system offers no direct way to install git-based gems (I actually asked a question about this previously, see Is it possible to directly install a gem from a git repository?). Instead, you have to do it manually in three steps:

  1. Clone the gem repo (this is assuming a github repository, but it will work for a repository hosted anywhere, just substitute the right git repo location).

    git clone git://github.com/user/gem.git
    
  2. Go to the cloned gem repo directory and build the gem (this will also check for dependencies and warn you if the install failed because of a missing dependency -- in that case just install the dependencies and try again).

    rake gem
    

    Or if that doesn't work:

    gem build gem.gemspec
    
  3. This should have created a file with a name like pkg/gem-1.2.3.gem (sometimes it will build in the pkg directory like this, sometimes it will build in the gem repo root directory). You can now install it.

    gem install pkg/gem-1.2.3.gem
    
Community
  • 1
  • 1
Ben Lee
  • 52,489
  • 13
  • 125
  • 145
  • I guess this ticket is related https://github.com/mpapis/rubygems-bundler/issues/21 – mpapis Jun 29 '12 at 00:05
  • I did more research and found the comment in http://stackoverflow.com/questions/3175511/why-is-bundler-not-installing-gems-stored-in-get-repo-properly which references http://yehudakatz.com/2010/04/12/some-of-the-problems-bundler-solves/ -- I recognize that gem and bundler are different but I'm really looking for way to make the gem/ bundler/gem dirs be the same dirs so gem can just use the bundler installed git gems? – Michael Wasser Jun 30 '12 at 20:30