Class: Proxy::Omaha::ReleaseRepository

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ReleaseRepository

Returns a new instance of ReleaseRepository.



8
9
10
11
# File 'lib/smart_proxy_omaha/release_repository.rb', line 8

def initialize(options)
  @contentpath = options.fetch(:contentpath)
  @distribution = options.fetch(:distribution)
end

Instance Attribute Details

#contentpathObject (readonly)

Returns the value of attribute contentpath.



6
7
8
# File 'lib/smart_proxy_omaha/release_repository.rb', line 6

def contentpath
  @contentpath
end

#distributionObject (readonly)

Returns the value of attribute distribution.



6
7
8
# File 'lib/smart_proxy_omaha/release_repository.rb', line 6

def distribution
  @distribution
end

Instance Method Details

#architectures(track) ⇒ Object



30
31
32
# File 'lib/smart_proxy_omaha/release_repository.rb', line 30

def architectures(track)
  Dir.glob(File.join(contentpath, track, '*')).select {|f| File.directory? f }.map { |f| File.basename(f) }
end

#latest_os(track, architecture) ⇒ Object



34
35
36
# File 'lib/smart_proxy_omaha/release_repository.rb', line 34

def latest_os(track, architecture)
  releases(track, architecture).max
end

#releases(track, architecture) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/smart_proxy_omaha/release_repository.rb', line 13

def releases(track, architecture)
  Dir.glob(File.join(contentpath, track, architecture, '*')).select do |f|
    File.directory?(f) && ! File.symlink?(f)
  end.map do |f|
    Proxy::Omaha::Release.new(
      :distribution => distribution,
      :track => track,
      :architecture => architecture,
      :version => File.basename(f)
    )
  end
end

#tracksObject



26
27
28
# File 'lib/smart_proxy_omaha/release_repository.rb', line 26

def tracks
  Dir.glob(File.join(contentpath, '*')).select {|f| File.directory? f }.map { |f| File.basename(f) }
end