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 ⇒ Boolean
Installs the unit.
-
#install? ⇒ Boolean
Checks if the unit should be installed.
-
#source ⇒ Object
Will use files of the form
filename.hostname.ext
if found. -
#uninstall(*args) ⇒ Boolean
Uninstalls the unit.
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
#fmode ⇒ Object
Returns the value of attribute fmode.
4 5 6 |
# File 'lib/config_curator/units/config_file.rb', line 4 def fmode @fmode end |
#group ⇒ Object
Returns the value of attribute group.
4 5 6 |
# File 'lib/config_curator/units/config_file.rb', line 4 def group @group end |
#owner ⇒ Object
Returns the value of attribute owner.
4 5 6 |
# File 'lib/config_curator/units/config_file.rb', line 4 def owner @owner end |
Instance Method Details
#destination ⇒ Object
Use Unit#source by default.
Returns the value of attribute destination.
21 22 23 24 |
# File 'lib/config_curator/units/config_file.rb', line 21 def destination super @destination ||= @source end |
#install ⇒ Boolean
Installs the unit.
35 36 37 38 39 40 41 42 |
# File 'lib/config_curator/units/config_file.rb', line 35 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.
45 46 47 48 49 50 51 |
# File 'lib/config_curator/units/config_file.rb', line 45 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.exist? source_path true end |
#source ⇒ Object
Will use files of the form filename.hostname.ext
if found.
(see Unit#source)
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/config_curator/units/config_file.rb', line 8 def source path = super host_specific_file = search_for_host_specific_file path if path if host_specific_file return host_specific_file else return path end end |
#uninstall(*args) ⇒ Boolean
Uninstalls the unit.
27 28 29 30 31 32 |
# File 'lib/config_curator/units/config_file.rb', line 27 def uninstall(*args) s = super(*args) return s unless s uninstall_file true end |