Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using 'gemspec' in a Gemfile how do I do the :require => 'foo'

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 ?

like image 794
gduq Avatar asked Jan 28 '11 07:01

gduq


1 Answers

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.

like image 119
Simone Carletti Avatar answered Sep 30 '22 01:09

Simone Carletti