Class: Bundler::Alive::SourceCodeRepositoryUrl

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/alive/source_code_repository_url.rb

Overview

Represents a source code repository

Defined Under Namespace

Classes: UnSupportedUrl

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, name) ⇒ SourceCodeRepositoryUrl

Creates a SourceCodeRepositoryUrl

Parameters:

  • url (String)
  • name (String)

Raises:



63
64
65
66
67
68
69
# File 'lib/bundler/alive/source_code_repository_url.rb', line 63

def initialize(url, name)
  raise UnSupportedUrl.new(url: url, name: name) if url.nil?

  @url = url
  @service_name = service(url: url, name: name)
  @gem_name = name
end

Instance Attribute Details

#gem_nameObject (readonly)

Returns the value of attribute gem_name.



53
54
55
# File 'lib/bundler/alive/source_code_repository_url.rb', line 53

def gem_name
  @gem_name
end

#service_nameObject (readonly)

Returns the value of attribute service_name.



53
54
55
# File 'lib/bundler/alive/source_code_repository_url.rb', line 53

def service_name
  @service_name
end

#urlObject (readonly)

Returns the value of attribute url.



53
54
55
# File 'lib/bundler/alive/source_code_repository_url.rb', line 53

def url
  @url
end

Class Method Details

.support_url?(url) ⇒ Boolean

Judge supported url or not

Parameters:

  • url (String)

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
# File 'lib/bundler/alive/source_code_repository_url.rb', line 23

def self.support_url?(url)
  return false if url.nil?

  uri = URI.parse(url)
  host = uri.host

  DOMAIN_WITH_SERVICES.key?(host)
end