Class: InchCI::RepoURL

Inherits:
Object
  • Object
show all
Defined in:
lib/inch_ci/repo_url.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ RepoURL


5
6
7
8
9
10
# File 'lib/inch_ci/repo_url.rb', line 5

def initialize(url)
  @url = url.to_s.gsub(/(\/)\Z/, '')
  [@url, @url + '.git'].each do |_url|
    @service ||= Repomen::Repo::Service.for(_url)
  end
end

Instance Attribute Details

#serviceObject (readonly)

Returns the value of attribute service


3
4
5
# File 'lib/inch_ci/repo_url.rb', line 3

def service
  @service
end

#urlObject (readonly)

Returns the value of attribute url


3
4
5
# File 'lib/inch_ci/repo_url.rb', line 3

def url
  @url
end

Instance Method Details

#project_uidObject


12
13
14
15
# File 'lib/inch_ci/repo_url.rb', line 12

def project_uid
  return if service.nil?
  "#{service.name}:#{service.user_name}/#{service.repo_name}"
end

#repo_urlObject


17
18
19
20
21
22
23
24
# File 'lib/inch_ci/repo_url.rb', line 17

def repo_url
  return if service.nil?
  if service.name.to_s == 'github'
    "https://github.com/#{service.user_name}/#{service.repo_name}.git"
  else
    url
  end
end