Class: ConfigCurator::ConfigFile
- Defined in:
- lib/config_curator/units/config_file.rb
Overview
A config file is a file that should be copied.
Constant Summary
Constants inherited from Unit
Instance Attribute Summary collapse
-
#fmode ⇒ Object
Returns the value of attribute fmode.
-
#group ⇒ Object
Returns the value of attribute group.
-
#owner ⇒ Object
Returns the value of attribute owner.
Attributes inherited from Unit
Instance Method Summary collapse
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#install ⇒ Object
Installs the unit.
-
#install? ⇒ Boolean
Checks if the unit should be installed.
-
#source ⇒ Object
Will use files of the form
filename.hostname.extif found.
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
#fmode ⇒ Object
Returns the value of attribute fmode.
6 7 8 |
# File 'lib/config_curator/units/config_file.rb', line 6 def fmode @fmode end |
#group ⇒ Object
Returns the value of attribute group.
6 7 8 |
# File 'lib/config_curator/units/config_file.rb', line 6 def group @group end |
#owner ⇒ Object
Returns the value of attribute owner.
6 7 8 |
# File 'lib/config_curator/units/config_file.rb', line 6 def owner @owner end |
Instance Method Details
#destination ⇒ Object
Use #source by default.
Returns the value of attribute destination.
18 19 20 21 |
# File 'lib/config_curator/units/config_file.rb', line 18 def destination super @destination ||= source end |
#install ⇒ Object
Installs the unit.
24 25 26 27 28 29 30 31 |
# File 'lib/config_curator/units/config_file.rb', line 24 def install s = super return s unless s install_file set_mode set_owner true end |
#install? ⇒ Boolean
Checks if the unit should be installed.
34 35 36 37 38 39 40 |
# File 'lib/config_curator/units/config_file.rb', line 34 def install? s = super return s unless s fail InstallFailed, "No file source path specified." if source_path.nil? fail InstallFailed, "Source path does not exist: #{source}" unless File.exists? source_path true end |
#source ⇒ Object
Will use files of the form filename.hostname.ext if found.
(see Unit#source)
10 11 12 13 14 |
# File 'lib/config_curator/units/config_file.rb', line 10 def source path = super host_specific_file = search_for_host_specific_file path if path if host_specific_file then return host_specific_file else return path end end |