Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top