Class: TagFetcher

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

Direct Known Subclasses

GitTagFetcher, HgTagFetcher, SvnTagFetcher

Instance Method Summary collapse

Constructor Details

#initialize(urls) ⇒ TagFetcher

Returns a new instance of TagFetcher.



5
6
7
# File 'lib/tag_fetcher.rb', line 5

def initialize urls
  @urls = urls
end

Instance Method Details

#fetchObject

process a list of urls



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/tag_fetcher.rb', line 10

def fetch
  new_cache = {}

  @urls.each do |url|
    begin
	raw_tags = fetch_tags url
    rescue TagFetchError
	puts "Failed to retrieve repo tags from : #{url}"
	new_cache[url] = [:failed]
    else
	new_cache[url] = clean_tags raw_tags
    end
  end

  # return a dictionary with {"<url>": ["<tags>"]}
  # set "<tags>" to :failed in case of failure to retrieve tags
  new_cache
end