Class: AptControl::Commands::Include
- Inherits:
-
Object
- Object
- AptControl::Commands::Include
- Defined in:
- lib/apt_control/commands/include.rb
Instance Method Summary collapse
-
#initialize(dependencies) ⇒ Include
constructor
A new instance of Include.
- #perform_for(state, version, noop = false) ⇒ Object
- #run(package_states, &visitor) ⇒ Object
Constructor Details
#initialize(dependencies) ⇒ Include
Returns a new instance of Include.
4 5 6 7 |
# File 'lib/apt_control/commands/include.rb', line 4 def initialize(dependencies) @apt_site = dependencies.fetch(:apt_site) @build_archive = dependencies.fetch(:build_archive) end |
Instance Method Details
#perform_for(state, version, noop = false) ⇒ Object
20 21 22 23 |
# File 'lib/apt_control/commands/include.rb', line 20 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 |
#run(package_states, &visitor) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/apt_control/commands/include.rb', line 9 def run(package_states, &visitor) package_states.map do |state| next unless state.includeable? version = state.includeable_to.max perform = (block_given? && yield(state, version)) || true perform_for(state, version) && [state, version] if perform end.compact end |