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

Constructor Details

This class inherits a constructor from ConfigCurator::Unit

Instance Attribute Details

#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

#installObject

Installs the unit.


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

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.


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

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