문제

I want to add geocoder gem to a spree extension and I have included in the the gemspec as

 s.add_development_dependency 'geocoder', '~> 1.1'

and have added this line to lib/extension_name.rb file:

require 'geocoder'

When I do rake -T, I do not see any geocoder related tasks in my extensions and when I include this extension in a spree website, it throws

cannot load such file -- geocoder (LoadError)

error. Where am I going wrong? In web, all I can see is to include the gem in gemspec and require it. What am I missing?

도움이 되었습니까?

해결책

You're misunderstanding the gemspec dependencies a bit.

add_development_dependency is used for adding dependencies that aid in coding of the gem. Examples would be things like TestUnit, Pry, or RSpec. These dependencies won't be available in applications that use your gem.

add_dependency is used for dependencies which are important for the operation of your gem. For example, geocoder in your case.

If you make that change, you should be good to go.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top