Class: Proxy::Omaha::ReleaseProvider

Inherits:
Object
  • Object
show all
Includes:
Log, HttpShared
Defined in:
lib/smart_proxy_omaha/release_provider.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HttpShared

#connection_factory

Constructor Details

#initialize(options) ⇒ ReleaseProvider

Returns a new instance of ReleaseProvider.



12
13
14
15
16
# File 'lib/smart_proxy_omaha/release_provider.rb', line 12

def initialize(options)
  @track = options.fetch(:track)
  @architecture = options.fetch(:architecture, 'amd64-usr')
  @distribution = options.fetch(:distribution)
end

Instance Attribute Details

#architectureObject (readonly)

Returns the value of attribute architecture.



10
11
12
# File 'lib/smart_proxy_omaha/release_provider.rb', line 10

def architecture
  @architecture
end

#distributionObject (readonly)

Returns the value of attribute distribution.



10
11
12
# File 'lib/smart_proxy_omaha/release_provider.rb', line 10

def distribution
  @distribution
end

#trackObject (readonly)

Returns the value of attribute track.



10
11
12
# File 'lib/smart_proxy_omaha/release_provider.rb', line 10

def track
  @track
end

Instance Method Details

#fetch_releasesObject



22
23
24
25
26
27
28
29
# File 'lib/smart_proxy_omaha/release_provider.rb', line 22

def fetch_releases
  releases = distribution.releases(track, architecture)
  release_objects = releases.map do |version|
    Proxy::Omaha::Release.new(:distribution => distribution, :version => version, :track => track, :architecture => architecture)
  end.sort
  logger.debug "Fetched releases for #{architecture}/#{track}: #{release_objects.map(&:to_s).join(', ')}"
  release_objects
end

#releasesObject



18
19
20
# File 'lib/smart_proxy_omaha/release_provider.rb', line 18

def releases
  @releases ||= fetch_releases
end