I had tried in this way:
s.add_dependency \'gem\', :path => \'../gem\'
like add gem in the gemfile, but it doesn\'t work,
Sometimes you want to embed one gem into another gem, nevermind why. You can reference one gempec from another to completely encapsulate a local gem.
require "rubygems"
embedded_gemspec = Gem::Specification::load("path/to/internal.gemspec")
Gem::Specification.new do |spec|
spec.name = "gem_that_contains_another_gem"
# spec.whatever, = whole bunch of other info
# our files + other gem's files
spec.files = ['file1.rb', 'file2.rb'] + embedded_gemspec.files
# our dependencies
spec.add_dependency 'nokogiri'
# other gem's dependencies
embedded_gemspec.runtime_dependencies.each { |d| spec.add_dependency d }
end
EDIT: this appears to only work locally. If you try to install this gemspec from, say, a git repo, it won't know where to get embedded_gemspec (even though embedded_gemspec's dependencies come in just fine).