Class: Podrpt::VersionFetcher

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

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ VersionFetcher

Returns a new instance of VersionFetcher.



3
4
5
6
# File 'lib/podrpt/version_fetcher.rb', line 3

def initialize(options)
  @options = options
  @sources_manager = Pod::Config.instance.sources_manager
end

Instance Method Details

#fetch_latest_versions_in_bulk(pod_names) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/podrpt/version_fetcher.rb', line 8

def fetch_latest_versions_in_bulk(pod_names)
  return {} if pod_names.empty?
  puts "Discovering the latest version for #{pod_names.length} pods..."
  results = Concurrent::Map.new
  pool = Concurrent::ThreadPoolExecutor.new(max_threads: @options.trunk_workers)
  pod_names.each { |name| pool.post { results[name] = find_latest_version(name) } }
  pool.shutdown
  pool.wait_for_termination
  Hash[results.each_pair.to_a]
end