class Bundler::Dsl
def gemspec(opts = nil)
def gemspec(opts = nil) path = opts && opts[:path] || "." glob = opts && opts[:glob] name = opts && opts[:name] || "{,*}" development_group = opts && opts[:development_group] || :development expanded_path = File.expand_path(path, Bundler.default_gemfile.dirname) gemspecs = Dir[File.join(expanded_path, "#{name}.gemspec")] case gemspecs.size when 1 spec = Bundler.load_gemspec(gemspecs.first) unless spec raise InvalidOption, "There was an error loading the gemspec at " \ "#{file}. Make sure you can build the gem, then try again" end gem spec.name, :path => path, :glob => glob, :platforms => Bundler::Dependency::REVERSE_PLATFORM_MAP[spec.platform] group(development_group) do spec.development_dependencies.each do |dep| gem dep.name, *(dep.requirement.as_list + [:type => :development]) end end @gemspecs << gemspecs.first when 0 raise InvalidOption, "There are no gemspecs at #{expanded_path}" else raise InvalidOption, "There are multiple gemspecs at #{expanded_path}. " \ "Please use the :name option to specify which one should be used" end end