Problem with gem requirement when passing git-repo to gem to Gemfile

I have not done this before, so I may be missing something.

I changed the Gem files for "ruby-w20>" locally and it worked fine. I forked the gem and made the exact same changes to my Github registry.

When building a Sinatra app, to push it to Heroku, I changed Gemfile

as follows:

gem 'git', :git => "git://github.com/silverSpoon/ruby-git.git"`  

      

When I run bundle install

I get

Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rugged 0.21.0
Using sinatra 1.4.5
Using git 1.2.8 from git://github.com/silverSpoon/ruby-git.git (at master)
Your bundle is complete!

      

  • But when I say ⇒ gem list git

    it does not show the gem as set.
  • When I run, ⇒ bundle show git

    it shows the path where the gem repository was installed -
    /Users/jatinganhotra/.rvm/gems/ruby-2.1.3@527website/bundler/gems/ruby-git-c7fb35af1a99

  • When I run my application or run irb

    and do 2.1.3 :001 > require 'git'


    it it gets the following error -
    LoadError: cannot load such file -- git

Am I missing something stupid here?

+3


source to share


1 answer


Gems installed by Bundler via git are not handled in the same way as regular gems :

Since Rubygems does not have the ability to handle gems from git, any gems installed from the git repository do not show up in gem list

. However, they will be available after launch Bundler.setup

.

To use a gem, you need to do it through the Bundler. Use either bundle exec

when starting IRB or your application, or use Bundler.setup

in your code.



$ bundle exec irb
> require 'git' # should work ok

      

or

$ irb
> require 'bundler/setup'
> require 'git' # should also work

      

+9


source







All Articles