简体   繁体   English

通过捆绑程序安装的Ruby Gem和Gemfile无法加载

[英]Ruby Gem installed through bundler and Gemfile not loading

Checkr is the gem I have built recently and code is hosted in github and gem is hosted in rubygems.org. Checkr是我最近构建的gem,代码托管在github中,gem托管在rubygems.org中。 If we install it using bundler, specifying gem 'checkr' in Gemfile, it is not loading. 如果我们使用捆绑程序安装它,并在Gemfile中指定gem'checkr',则不会加载它。 We get this error: 我们得到这个错误:

uninitialized constant Checkr (NameError)

But installing it from github like this in Gemfile works fine, I guess. 但是我想可以像这样在Gemfile中从github安装它。

gem 'checkr', git: 'https://github.com/vijendra/checkr.git'

Am I missing some thing in rubygems.org settings? 我是否在rubygems.org设置中缺少某些内容?

$ gem install checkr
Successfully installed checkr-0.0.2
1 gem installed

$ ruby -e "require 'checkr'"
/Users/radarek/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require': cannot load such file -- checkr/base (LoadError)
        from /Users/radarek/.rbenv/versions/2.1.2/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:121:in `require'
        from /Users/radarek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/checkr-0.0.2/lib/checkr.rb:1:in `<top (required)>'

$ ls /Users/radarek/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/checkr-0.0.2/lib/checkr/
candidate.rb  core_ext.rb  report.rb  subaccount.rb  version.rb

As you see your gem release has missing base.rb file. 如您所见,gem版本缺少base.rb文件。 I cloned your github repo and build gem locally. 我克隆了您的github存储库,并在本地构建了gem。 This gem has all files from lib/checkr/ included so you just have to release new version of your gem and it will work. 这个gem具有lib / checkr /中的所有文件,因此您只需要发布gem的新版本即可使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM