When using 'gemspec' in a Gemfile how do I do the :require => 'foo'
The gem has a few development dependencies li开发者_运维知识库ke ruby-debug19 and sqlite3-ruby where the gem name and the require are different. We handle this in the Gemfile by using the :require => 'foo' option.
e.g.
gem "sqlite3-ruby", :require => "sqlite3"
gem 'ruby-debug19', :require => 'ruby-debug'
We are trying to move all of these to the gemspec file and use the 'gemspec' directive in the Gemfile.
in the gemspec these become:
s.add_development_dependency "sqlite3-ruby"
s.add_development_dependency 'ruby-debug19'
Is there a way to provide that :require => option when using s.add_dependency ?
No, you can't, you still need to override the value in the Gemfile.
source "http://rubygems.org"
gem 'ruby-debug19', :require => 'ruby-debug'
# Specify your gem's dependencies in .gemspec
gemspec
Small tip: if you use the sqlite3
gem instead of sqlite3-ruby
(which is actually the same), then you don't need to specify a different require.
精彩评论