class ConfigCurator::Symlink
A symlink is a symbolic link that should be created. The {#destination_path} will be a link that points to the {#source_path}.
Public Instance Methods
install()
click to toggle source
(see Unit#install
)
Calls superclass method
ConfigCurator::Unit#install
# File lib/config_curator/units/symlink.rb, line 15 def install s = super return s unless s install_symlink true end
install?()
click to toggle source
(see Unit#install?
)
Calls superclass method
ConfigCurator::Unit#install?
# 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)
click to toggle source
(see Unit#uninstall
)
Calls superclass method
ConfigCurator::Unit#uninstall
# File lib/config_curator/units/symlink.rb, line 7 def uninstall(*args) s = super(*args) return s unless s uninstall_symlink true end
Private Instance Methods
install_symlink()
click to toggle source
Recursively creates the necessary directories and make the symlink.
# File lib/config_curator/units/symlink.rb, line 39 def install_symlink FileUtils.mkdir_p File.dirname(destination_path) FileUtils.symlink source_path, destination_path, force: true end
uninstall_symlink()
click to toggle source
Uninstalls the symlink by removing it.
# File lib/config_curator/units/symlink.rb, line 34 def uninstall_symlink FileUtils.remove_entry_secure destination_path if File.exist? destination_path end