class Gem::Commands::SourcesCommand
def add_source(source_uri) # :nodoc:
def add_source(source_uri) # :nodoc: check_rubygems_https source_uri source = Gem::Source.new source_uri check_typo_squatting(source) begin if Gem.sources.include? source say "source #{source_uri} already present in the cache" else source.load_specs :released Gem.sources << source Gem.configuration.write say "#{source_uri} added to sources" end rescue URI::Error, ArgumentError say "#{source_uri} is not a URI" terminate_interaction 1 rescue Gem::RemoteFetcher::FetchError => e say "Error fetching #{source_uri}:\n\t#{e.message}" terminate_interaction 1 end end