Class: Katello::RepoDiscovery

Inherits:
Object
  • Object
show all
Defined in:
app/lib/katello/repo_discovery.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, proxy = {}, crawled = [], found = [], to_follow = []) ⇒ RepoDiscovery

Returns a new instance of RepoDiscovery.



5
6
7
8
9
10
11
12
13
# File 'app/lib/katello/repo_discovery.rb', line 5

def initialize(url, proxy = {}, crawled = [], found = [], to_follow = [])
  #add a / on the end, as directories require it or else
  #  They will get double slahes on them
  @uri = uri(url)
  @found = found
  @crawled = crawled
  @to_follow = to_follow
  @proxy = proxy
end

Instance Attribute Details

#crawledObject (readonly)

Returns the value of attribute crawled.



3
4
5
# File 'app/lib/katello/repo_discovery.rb', line 3

def crawled
  @crawled
end

#foundObject (readonly)

Returns the value of attribute found.



3
4
5
# File 'app/lib/katello/repo_discovery.rb', line 3

def found
  @found
end

#to_followObject (readonly)

Returns the value of attribute to_follow.



3
4
5
# File 'app/lib/katello/repo_discovery.rb', line 3

def to_follow
  @to_follow
end

Instance Method Details

#run(resume_point) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'app/lib/katello/repo_discovery.rb', line 20

def run(resume_point)
  if @uri.scheme == 'file'
    file_crawl(uri(resume_point))
  elsif %w(http https).include?(@uri.scheme)
    http_crawl(uri(resume_point))
  else
    fail _("Unsupported URL protocol %s.") % @uri.scheme
  end
end

#uri(url) ⇒ Object



15
16
17
18
# File 'app/lib/katello/repo_discovery.rb', line 15

def uri(url)
  url += '/' unless url.ends_with?('/')
  URI(url)
end