Class: AutomateIt::PackageManager::PEAR
- Inherits:
-
BaseDriver
- Object
- Common
- AutomateIt::Plugin::Base
- AutomateIt::Plugin::Driver
- BaseDriver
- AutomateIt::PackageManager::PEAR
- Defined in:
- lib/automateit/package_manager/pear.rb
Overview
PackageManager::PEAR
A PackageManager driver for PEAR (PHP Extension and Application Repository), manages software packages using the pear
command.
Using specific channels
To install a package from the default PEAR channel, just specify it’s name, e.g. HTML_QuickForm
.
To install a package from another channel, you must specify the name prefixed with the channel’s URL, e.g. pear.symfony-project.com/symfony
, so that the channel can be automatically added as needed.
IMPORTANT: DO NOT specify a remote channel’s alias, e.g. symfony/symfony
, because this provides no way to discover the channel.
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
IMPORTANT: See documentation at the top of this file for how to correctly install packages from a specific channel.
-
#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
IMPORTANT: See documentation at the top of this file for how to correctly install packages from a specific channel.
Options:
-
:force – Force installation, needed when installing unstable packages
See AutomateIt::PackageManager#install
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/automateit/package_manager/pear.rb', line 67 def install(*packages) return _install_helper(*packages) do |list, opts| # pear options: # -a install all required dependencies # -f force installation cmd = "(pear config-set auto_discover 1; " cmd << "pear 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?
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/automateit/package_manager/pear.rb', line 41 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?
56 57 58 |
# File 'lib/automateit/package_manager/pear.rb', line 56 def not_installed?(*packages) return _not_installed_helper?(*packages) end |
#suitability(method, *args) ⇒ Object
:nodoc:
21 22 23 24 |
# File 'lib/automateit/package_manager/pear.rb', line 21 def suitability(method, *args) # :nodoc: # Never select as default driver return 0 end |
#uninstall(*packages) ⇒ Object
See AutomateIt::PackageManager#uninstall
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/automateit/package_manager/pear.rb', line 85 def uninstall(*packages) return _uninstall_helper(*packages) do |list, opts| cmd = "pear uninstall "+list.join(" ")+" < /dev/null" cmd << " > /dev/null" if opts[:quiet] cmd << " 2>&1" interpreter.sh(cmd) end end |