method

add_source

Importance_0
v2_2_9 - Show latest stable - 0 notes - Class: SourcesCommand
add_source(source_uri) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rubygems/commands/sources_command.rb, line 40
  def add_source source_uri # :nodoc:
    check_rubygems_https source_uri

    source = Gem::Source.new source_uri

    begin
      if Gem.sources.include? source_uri 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
Register or log in to add new notes.