Class: Sunshine::Apt
- Inherits:
-
Dependency
- Object
- Dependency
- Sunshine::Apt
- Defined in:
- lib/sunshine/package_managers/apt.rb
Overview
The Apt dependency class supports basic apt-get features:
dependency_lib.instance_eval do
apt "ruby", :version => '1.9'
end
See the Dependency class for more info.
Instance Attribute Summary
Attributes inherited from Dependency
#children, #name, #parents, #pkg
Class Method Summary collapse
-
.system_manager?(shell = nil) ⇒ Boolean
Checks if dependency type is valid for a given shell.
Instance Method Summary collapse
-
#initialize(name, options = {}, &block) ⇒ Apt
constructor
A new instance of Apt.
Methods inherited from Dependency
#add_child, #check, #check_test, #child_dependencies, #install, #install!, #install_parents!, #installed?, #missing_parents?, #parent_dependencies, #requires, sudo, sudo=, #to_s, #uninstall, #uninstall!, #uninstall_children!
Constructor Details
#initialize(name, options = {}, &block) ⇒ Apt
Returns a new instance of Apt.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sunshine/package_managers/apt.rb', line 16 def initialize(name, ={}, &block) super(name, ) do pkg_name = build_pkg_name @pkg.dup, install "apt-get install -y #{pkg_name}" uninstall "apt-get remove -y #{pkg_name}" @pkg = "#{@pkg}-#{[:version]}" if [:version] check_test "apt-cache search ^#{@pkg} | grep -c ^#{@pkg}", '-ge 1' instance_eval(&block) if block_given? end end |