18

The gem has a few development dependencies like 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 ?

gduq
  • 1,434
  • 11
  • 13

1 Answers1

14

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.

Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
  • 1
    Why is that? Does add_development_dependency accomplish the same thing as :required => false? – Isaac Betesh Jul 09 '13 at 20:56
  • 2
    So I guess if we want to `require: false` a development dependency, then we need to specify the gem in the gemspec first as a development dependency, then add it to the Gemfile as a development dependency and `require: false`? – Dennis Jun 08 '14 at 01:25