Class: Plat4m::Sniffer::Darwin::MacPkgManager

Inherits:
PkgManager
  • Object
show all
Defined in:
lib/plat4m/sniff/darwin.rb

Defined Under Namespace

Classes: Homebrew, MacPorts

Instance Method Summary collapse

Methods inherited from PkgManager

#has_sudo?, #install, #select_available, #select_uninstalled, #uninstall

Constructor Details

#initializeMacPkgManager

Returns a new instance of MacPkgManager.



65
66
67
68
69
70
# File 'lib/plat4m/sniff/darwin.rb', line 65

def initialize
  super
  @has_sudo = system('command -v sudo > /dev/null')
  @has_macports = system('command -v port>/dev/null')
  @has_homebrew = system('command -v brew>/dev/null')
end

Instance Method Details

#available?(pkg) ⇒ Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/plat4m/sniff/darwin.rb', line 76

def available?(pkg)
  pkg_manager.available?(pkg)
end

#homebrew?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/plat4m/sniff/darwin.rb', line 92

def homebrew?
  Homebrew === pkg_manager
end

#installed?(pkg) ⇒ Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/plat4m/sniff/darwin.rb', line 72

def installed?(pkg)
  pkg_manager.installed?(pkg)
end

#macports?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/plat4m/sniff/darwin.rb', line 88

def macports?
  MacPorts === pkg_manager
end

#make_install_command(*pkgs) ⇒ Object



80
81
82
# File 'lib/plat4m/sniff/darwin.rb', line 80

def make_install_command(*pkgs)
  pkg_manager.make_install_command(*pkgs)
end

#make_uninstall_command(*pkgs) ⇒ Object



84
85
86
# File 'lib/plat4m/sniff/darwin.rb', line 84

def make_uninstall_command(*pkgs)
  pkg_manager.make_uninstall_command(*pkgs)
end