Class: AptControl::Includer

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

Overview

Wraps the common functionality involved in including the latest includeable package in an apt site

Instance Method Summary collapse

Constructor Details

#initialize(apt_site, build_archive) ⇒ Includer

Returns a new instance of Includer.



6
7
8
9
# File 'lib/apt_control/includer.rb', line 6

def initialize(apt_site, build_archive)
  @apt_site = apt_site
  @build_archive = build_archive
end

Instance Method Details

#perform_for(state, version, noop = false) ⇒ Object



22
23
24
25
# File 'lib/apt_control/includer.rb', line 22

def perform_for(state, version, noop=false)
  changes_fname = @build_archive.changes_fname(state.package_name, version)
  @apt_site.include!(state.dist.name, changes_fname) unless noop
end

#perform_for_all(package_states, &visitor) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/apt_control/includer.rb', line 11

def perform_for_all(package_states, &visitor)
  package_states.each do |state|
    next unless state.includeable?

    version = state.includeable_to.max
    perform = (block_given? && yield(state, version)) || true

    perform_for(state, version) if perform
  end
end