Class: ConfigCurator::Symlink

Inherits:
Unit
  • Object
show all
Defined in:
lib/config_curator/units/symlink.rb

Overview

A symlink is a symbolic link that should be created. The Unit#destination_path will be a link that points to the Unit#source_path.

Constant Summary

Constants inherited from Unit

Unit::DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from Unit

#destination, #hosts, #logger, #packages, #source

Instance Method Summary collapse

Methods inherited from Unit

#allowed_host?, #destination_path, #initialize, #options, #package_lookup, #packages_installed?, #source_path, #uninstall?

Constructor Details

This class inherits a constructor from ConfigCurator::Unit

Instance Method Details

#installBoolean

Installs the unit.

Returns:

  • (Boolean)

    if the unit was installed



15
16
17
18
19
20
# File 'lib/config_curator/units/symlink.rb', line 15

def install
  s = super
  return s unless s
  install_symlink
  true
end

#install?Boolean

Checks if the unit should be installed.

Returns:

  • (Boolean)

    if the unit should be installed



23
24
25
26
27
28
29
# File 'lib/config_curator/units/symlink.rb', line 23

def install?
  s = super
  return s unless s
  fail InstallFailed, 'No source file specified.' if source_path.nil?
  fail InstallFailed, 'No destination specified.' if destination_path.nil?
  true
end

#uninstall(*args) ⇒ Boolean

Uninstalls the unit.

Returns:

  • (Boolean)

    if the unit was uninstalled



7
8
9
10
11
12
# File 'lib/config_curator/units/symlink.rb', line 7

def uninstall(*args)
  s = super(*args)
  return s unless s
  uninstall_symlink
  true
end