Class: AutomateIt::AddressManager::BSD

Inherits:
BaseDriver show all
Defined in:
lib/automateit/address_manager/bsd.rb

Overview

AddressManager::BSD

An AddressManager driver for operating systems using a BSD-like ifconfig. Driver provides querying addresses and interfaces.

Constant Summary

Constants inherited from Plugin::Driver

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 Plugin::Driver

#manager

Attributes inherited from Common

#interpreter

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseDriver

#has?, #hostnames, #hostnames_for

Methods inherited from Plugin::Driver

abstract_driver, #available?, base_driver, base_driver?, depends_on, inherited, manager_token, #setup

Methods inherited from Plugin::Base

#setup, #token

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

Class Method Details

.tokenObject



6
7
8
# File 'lib/automateit/address_manager/bsd.rb', line 6

def self.token
  :bsd
end

Instance Method Details

#addressesObject

See AddressManager#addresses



24
25
26
27
# File 'lib/automateit/address_manager/bsd.rb', line 24

def addresses()
  _raise_unless_available
  return `ifconfig -a`.scan(/\s+inet\s+([^\s]+)\s+/).flatten
end

#interfacesObject

See AddressManager#interfaces



18
19
20
21
# File 'lib/automateit/address_manager/bsd.rb', line 18

def interfaces()
  _raise_unless_available
  return `ifconfig -a`.scan(/^([^\s]+):\s+/s).flatten
end

#suitability(method, *args) ⇒ Object

:nodoc:



13
14
15
# File 'lib/automateit/address_manager/bsd.rb', line 13

def suitability(method, *args) # :nodoc:
  available? ? 2 : 0
end