Module: Akaer::ApplicationMethods::General

Extended by:
ActiveSupport::Concern
Defined in:
lib/akaer/application.rb

Overview

General methods.

Instance Method Summary collapse

Instance Method Details

#is_osx?Boolean

Checks if we are running on MacOS X.

System services are only available on that platform.

Returns:

  • (Boolean)

    true if the current platform is MacOS X, false otherwise.



20
21
22
# File 'lib/akaer/application.rb', line 20

def is_osx?
  !(::RbConfig::CONFIG['host_os'] =~ /^darwin/).nil?
end

#manage(type, address) ⇒ Boolean

Adds or removes an alias from the interface.

Parameters:

  • type (Symbol)

    The operation to execute. Can be :add or :remove.

  • address (String)

    The address to manage.

Returns:

  • (Boolean)

    true if operation succeeded, false otherwise.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/akaer/application.rb', line 29

def manage(type, address)
  locale = i18n
  config = self.config
  quiet = config.quiet
  rv, command, prefix = setup_management(type, address)

  # Now execute
  if rv then
    if !config.dry_run then
      execute_manage(command, prefix, type, address, config, quiet)
    else
      log_management(:dry_run, prefix, type, locale.remove, locale.add, address, config, quiet)
    end
  end

  rv
end