Class: AutomateIt::PackageManager::PECL
- Inherits:
-
BaseDriver
- Object
- Common
- AutomateIt::Plugin::Base
- AutomateIt::Plugin::Driver
- BaseDriver
- AutomateIt::PackageManager::PECL
- Defined in:
- lib/automateit/package_manager/pecl.rb
Overview
PackageManager::PECL
A PackageManager driver for PECL (PHP Extension Community Library), manages software packages using the pecl
command.
Constant Summary
Constants inherited from AutomateIt::Plugin::Driver
AutomateIt::Plugin::Driver::BASE_DRIVER_NAME
Constants included from Constants
Constants::HELPERS_DIR, Constants::INSTALL_DIR, Constants::PERROR, Constants::PEXEC, Constants::PNOTE, Constants::WARNING_BOILERPLATE
Instance Attribute Summary
Attributes inherited from AutomateIt::Plugin::Driver
Attributes inherited from Common
Instance Method Summary collapse
-
#install(*packages) ⇒ Object
Options: * :force – Force installation, needed when installing unstable packages.
-
#installed?(*packages) ⇒ Boolean
See AutomateIt::PackageManager#installed?.
-
#not_installed?(*packages) ⇒ Boolean
See AutomateIt::PackageManager#not_installed?.
-
#suitability(method, *args) ⇒ Object
:nodoc:.
-
#uninstall(*packages) ⇒ Object
See AutomateIt::PackageManager#uninstall.
Methods inherited from AutomateIt::Plugin::Driver
abstract_driver, #available?, base_driver, base_driver?, depends_on, inherited, manager_token, #setup
Methods inherited from AutomateIt::Plugin::Base
Methods inherited from Common
#initialize, #log, #nitpick, #noop, #noop=, #noop?, #preview, #preview=, #preview?, #preview_for, #setup, #superuser?, #writing, #writing=, #writing?
Constructor Details
This class inherits a constructor from AutomateIt::Common
Instance Method Details
#install(*packages) ⇒ Object
Options:
-
:force – Force installation, needed when installing unstable packages
See AutomateIt::PackageManager#install
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/automateit/package_manager/pecl.rb', line 53 def install(*packages) return _install_helper(*packages) do |list, opts| # pecl options: # -a install all required dependencies # -f force installation cmd = "pecl install -a" cmd << " -f" if opts[:force] cmd << " "+list.join(" ")+" < /dev/null" cmd << " > /dev/null" if opts[:quiet] cmd << " 2>&1" interpreter.sh(cmd) end end |
#installed?(*packages) ⇒ Boolean
See AutomateIt::PackageManager#installed?
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/automateit/package_manager/pecl.rb', line 29 def installed?(*packages) return _installed_helper?(*packages) do |list, opts| all_installed = get_installed_packages().keys.collect {|pkg| pkg.downcase} result = [] list.each do |pkg| pkg_without_channel = pkg.gsub(%r{^[^/]+/}, '').downcase result.push pkg if all_installed.include?(pkg_without_channel) end result end end |
#not_installed?(*packages) ⇒ Boolean
See AutomateIt::PackageManager#not_installed?
45 46 47 |
# File 'lib/automateit/package_manager/pecl.rb', line 45 def not_installed?(*packages) return _not_installed_helper?(*packages) end |
#suitability(method, *args) ⇒ Object
:nodoc:
8 9 10 11 |
# File 'lib/automateit/package_manager/pecl.rb', line 8 def suitability(method, *args) # :nodoc: # Never select as default driver return 0 end |
#uninstall(*packages) ⇒ Object
See AutomateIt::PackageManager#uninstall
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/automateit/package_manager/pecl.rb', line 70 def uninstall(*packages) return _uninstall_helper(*packages) do |list, opts| cmd = "pecl uninstall "+list.join(" ")+" < /dev/null" cmd << " > /dev/null" if opts[:quiet] cmd << " 2>&1" interpreter.sh(cmd) end end |