Class: AptControl::CLI::Include

Inherits:
Object
  • Object
show all
Includes:
Common
Defined in:
lib/apt_control/cli/include.rb

Instance Method Summary collapse

Methods included from Common

#apt_site, #build_archive, #control_file, #each_package_state, #logger, #notifier, #notify, #validate_config!

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/apt_control/cli/include.rb', line 10

def run
  validate_config!

  control_file.distributions.each do |dist|
    dist.package_rules.each do |rule|
      included = apt_site.included_version(dist.name, rule.package_name)
      available = build_archive[rule.package_name]

      next unless available

      if rule.upgradeable?(included, available)
        version = rule.upgradeable_to(available).max
        if options[:noop]
          puts "I want to upgrade from #{included} to version #{version} of #{rule.package_name}"
        else
          apt_site.include!(dist.name, build_archive.changes_fname(rule.package_name, version))
        end
      end
    end
  end
end