gem customizations
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.
开发者_如何学CHowever, 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'
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.
I used the :lib option.
So this is what worked
config.gem "badnaam-geokit", :lib => "geokit"
精彩评论