Class: AptControl::AptSite
- Inherits:
-
Object
- Object
- AptControl::AptSite
- Includes:
- Exec::Helpers
- Defined in:
- lib/apt_control/apt_site.rb
Overview
represents the reprepro apt site that we query and include packages in to
Instance Method Summary collapse
-
#include!(distribution_name, changes_fname) ⇒ Object
include a particular version in to a distribution.
-
#included_version(distribution_name, package_name) ⇒ Object
query the apt site for which version of a package is installed for a particular distribution.
-
#initialize(apt_site_dir, logger) ⇒ AptSite
constructor
A new instance of AptSite.
- #reprepro_cmd ⇒ Object
Methods included from Exec::Helpers
Constructor Details
#initialize(apt_site_dir, logger) ⇒ AptSite
Returns a new instance of AptSite.
6 7 8 9 |
# File 'lib/apt_control/apt_site.rb', line 6 def initialize(apt_site_dir, logger) @apt_site_dir = apt_site_dir @logger = logger end |
Instance Method Details
#include!(distribution_name, changes_fname) ⇒ Object
include a particular version in to a distribution. Will likely fail for a myriad number of reasons, so spits out error messages to sdterr
26 27 28 29 |
# File 'lib/apt_control/apt_site.rb', line 26 def include!(distribution_name, changes_fname) command = "#{reprepro_cmd} --ignore=wrongdistribution include #{distribution_name} #{changes_fname}" exec(command, :name => 'reprepro') end |
#included_version(distribution_name, package_name) ⇒ Object
query the apt site for which version of a package is installed for a particular distribution
17 18 19 20 21 22 |
# File 'lib/apt_control/apt_site.rb', line 17 def included_version(distribution_name, package_name) command = "#{reprepro_cmd} -Tdsc list #{distribution_name} #{package_name}" output = exec(command, :name => 'reprepro') version_string = output.split(' ').last version_string && Version.parse(version_string) end |
#reprepro_cmd ⇒ Object
11 12 13 |
# File 'lib/apt_control/apt_site.rb', line 11 def reprepro_cmd "reprepro -b #{@apt_site_dir}" end |