开发者

'Could not find gem' error when specifying a forked version of a gem from Github in my gemfile

开发者 https://www.devze.com 2023-01-21 19:53 出处:网络
I am trying to use this forked version of the searchlogic gem. In my gemfile, I have gem \"searchlogic\", :git => \"http://github.com/railsd开发者_JAVA技巧og/searchlogic.git\"

I am trying to use this forked version of the searchlogic gem. In my gemfile, I have

gem "searchlogic", :git => "http://github.com/railsd开发者_JAVA技巧og/searchlogic.git"

when I do bundle install, I get this error:

Could not find gem 'searchlogic (>= 0, runtime)' in http://github.com/railsdog/searchlogic.git (at master).
Source does not contain any versions of 'searchlogic (>= 0, runtime)'

What is causing this error? Thanks for reading.


It's because your fork not define searchlogic gem by rd_searchlogic gem. So use in your Gemfile :

gem "rd_searchlogic", 
  :git => "rd_searchlogic.gemspec", 
  :require => "searchlogic"


Use:

gem 'rd_searchlogic', :git => 'https://github.com/railsdog/searchlogic.git', :require => 'searchlogic'


The .gemspec of your fork might contain a different name to that of the gem on RubyGems, for example when I forked active_merchant on GitHub their .gemspec file had:

s.name         = 'activemerchant'

but the gem is defined as active_merchant on RubyGems so I changed my Gemfile from:

gem "active_merchant", git: "https://github.com/adamwaite/active_merchant.git", require: "active_merchant"

to:

gem "activemerchant", git: "https://github.com/adamwaite/active_merchant.git", require: "active_merchant"

note the lack of _.

All worked perfectly after that. This may be an obscure case, but hope it helps someone!


It doesn't look like that gem has been upgraded for Rails3. From the issues listed in Github, it seems that searchlogic is heavily dependent on ActiveRecord2 and may not be easily upgraded for Rails 3. It may be worth looking into an alternative.

Will searchlogic work with Rails 3?

http://github.com/binarylogic/searchlogic/issues/issue/65

0

精彩评论

暂无评论...
验证码 换一张
取 消