class Bundler::Dsl
def _normalize_options(name, version, opts)
def _normalize_options(name, version, opts) _normalize_hash(opts) invalid_keys = opts.keys - %w(group groups git path name branch ref tag require submodules platform platforms type) if invalid_keys.any? plural = invalid_keys.size > 1 message = "You passed #{invalid_keys.map{|k| ':'+k }.join(", ")} " if plural message << "as options for gem '#{name}', but they are invalid." else message << "as an option for gem '#{name}', but it is invalid." end raise InvalidOption, message end groups = @groups.dup opts["group"] = opts.delete("groups") || opts["group"] groups.concat Array(opts.delete("group")) groups = [:default] if groups.empty? platforms = @platforms.dup opts["platforms"] = opts["platform"] || opts["platforms"] platforms.concat Array(opts.delete("platforms")) platforms.map! { |p| p.to_sym } platforms.each do |p| next if VALID_PLATFORMS.include?(p) raise DslError, "`#{p}` is not a valid platform. The available options are: #{VALID_PLATFORMS.inspect}" end # Normalize git and path options ["git", "path"].each do |type| if param = opts[type] if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/ options = opts.merge("name" => name, "version" => $1) else options = opts.dup end source = send(type, param, options, :prepend => true) {} opts["source"] = source end end opts["source"] ||= @source opts["env"] ||= @env opts["platforms"] = platforms.dup opts["group"] = groups end