宝石定制

发布于 2024-09-17 21:06:36 字数 1426 浏览 4 评论 0原文

我向 geokit gem 添加了一些缓存功能,并使用 gemcutter 创建了一个副本“badnaam-geokit”。唯一的变化是在 Geocoders.rb 中,如果我只是在本地修改它,它就可以正常工作。

然而,在我将它发布到 ruby​​gems 并安装它并在我的environment.rb(config.gem“badnaam-geokit”)文件中要求它作为“badnaam-geokit”之后,我得到了一个令人讨厌的结果。

有什么想法吗?

这是我在 github 上的分支

http://github.com/badnaam/geokit-gem

这是宝石。 http://rubygems.org/gems/badnaam-geokit

no such file to load -- badnaam-geokit
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in `load'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'

I added some caching functionality to the geokit gem and used gemcutter to create a copy 'badnaam-geokit'. The only changed are in Geocoders.rb which works fine if I just modify it locally.

However, after I published it to rubygems and installed it and require it as 'badnaam-geokit' in my environment.rb (config.gem "badnaam-geokit") file I get a nasty.

Any ideas?

Here is the my fork on github

http://github.com/badnaam/geokit-gem

and here is the gem.
http://rubygems.org/gems/badnaam-geokit

no such file to load -- badnaam-geokit
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:521:in `new_constants_in'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:156:in `require'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:208:in `load'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:307:in `load_gems'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情域 2024-09-24 21:06:37

虽然您的 gem 已更改名称,但库名称并未更改。您的 config.gem 行告诉 Rails 加载 gem,然后 require 'badnaam-geokit' ,但您的 gem 中没有该名称的文件。

要修复此问题,请使用 config.gem:lib 选项:

config.gem 'badnaam-geokit', :lib => 'geokit'

此外,不鼓励将 gems 推送到 Rubygems 进行此类更改。相反,我建议您将 Rails 项目切换为 使用 Bundler (其中 使用 Bundler)。 com/rails23.html" rel="nofollow noreferrer">与 Rails 2.3.5 配合良好),然后使用 :git 选项直接从 Github 分支加载 gem。

While your gem has changed names, the library name has not changed. Your config.gem line is telling Rails to load the gem and then require 'badnaam-geokit' but there's no file in your gem by that name.

The fix this, use the :lib option to config.gem:

config.gem 'badnaam-geokit', :lib => 'geokit'

Furthermore, pushing gems to Rubygems for changes like this is not encouraged. I would instead suggest you switch your Rails project to use Bundler (which works great with Rails 2.3.5) and then use the :git option to load the gem directly from your Github fork.

躲猫猫 2024-09-24 21:06:37

我使用了 :lib 选项。

这就是

config.gem "badnaam-geokit", :lib => 的工作原理“地质套件”

I used the :lib option.

So this is what worked

config.gem "badnaam-geokit", :lib => "geokit"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文