I had tried in this way:
s.add_dependency 'gem', :path => '../gem'
like add gem in the gemfile,
but it doesn't work, and will cause this error:
/Users/chenqh/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/requirement.rb:81:in `parse': Illformed requirement
While developing 2 gems, gem1 and gem2, requiring that gem1 locally depends on gem2 is quite handy.
You can't do this in your gemspec
, however, you can do so in your gem's Gemfile
!
# Gemfile
source "https://rubygems.org"
gem 'gem2', :path => '../gem2'
# Specify your gem's dependencies in gem1.gemspec
gemspec
And then in your gemspec, require your gem like you would normally if that gem was already published:
# gem1.gemspec
spec.add_runtime_dependency "gem2"
Just make sure you don't accidentally push that Gemfile
change!