method
add_source
ruby latest stable - Class:
Gem::Commands::SourcesCommand
add_source(source_uri)public
No documentation available.
# File lib/rubygems/commands/sources_command.rb, line 41
def add_source source_uri # :nodoc:
check_rubygems_https source_uri
source = Gem::Source.new source_uri
begin
if Gem.sources.include? source then
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