Class: ConfigCurator::Component

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

Overview

A component is a folder that should be copied. The Unit#destination will become a mirror of the Unit#source. The contents of the Unit#destination_path is completely replaced by the contents of the Unit#source_path.

Constant Summary

Constants inherited from Unit

Unit::DEFAULT_OPTIONS

Instance Attribute Summary collapse

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 Attribute Details

#backendObject

Returns the value of attribute backend.



9
10
11
# File 'lib/config_curator/units/component.rb', line 9

def backend
  @backend
end

#dmodeObject

Returns the value of attribute dmode.



9
10
11
# File 'lib/config_curator/units/component.rb', line 9

def dmode
  @dmode
end

#fmodeObject

Returns the value of attribute fmode.



9
10
11
# File 'lib/config_curator/units/component.rb', line 9

def fmode
  @fmode
end

#groupObject

Returns the value of attribute group.



9
10
11
# File 'lib/config_curator/units/component.rb', line 9

def group
  @group
end

#ownerObject

Returns the value of attribute owner.



9
10
11
# File 'lib/config_curator/units/component.rb', line 9

def owner
  @owner
end

Instance Method Details

#installBoolean

Installs the unit.

Returns:

  • (Boolean)

    if the unit was installed



20
21
22
23
24
25
26
27
# File 'lib/config_curator/units/component.rb', line 20

def install
  s = super
  return s unless s
  install_component
  set_mode
  set_owner
  true
end

#install?Boolean

Checks if the unit should be installed.

Returns:

  • (Boolean)

    if the unit should be installed



30
31
32
33
34
35
36
37
# File 'lib/config_curator/units/component.rb', line 30

def install?
  s = super
  return s unless s
  fail InstallFailed, 'No component source path specified.' if source_path.nil?
  fail InstallFailed, 'No component install path specified.' if destination_path.nil?
  fail InstallFailed, "Source path does not exist: #{source}" unless Dir.exist? source_path
  true
end

#uninstall(*args) ⇒ Boolean

Uninstalls the unit.

Returns:

  • (Boolean)

    if the unit was uninstalled



12
13
14
15
16
17
# File 'lib/config_curator/units/component.rb', line 12

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