Class: Wright::Provider::Symlink
- Inherits:
-
Wright::Provider
- Object
- Wright::Provider
- Wright::Provider::Symlink
- Defined in:
- lib/wright/provider/symlink.rb
Overview
Symlink provider. Used as a provider for Resource::Symlink.
Constant Summary
Constants inherited from Wright::Provider
Instance Method Summary collapse
-
#create ⇒ void
Creates or updates the symlink.
-
#remove ⇒ void
Removes the symlink.
Methods inherited from Wright::Provider
Constructor Details
This class inherits a constructor from Wright::Provider
Instance Method Details
#create ⇒ void
This method returns an undefined value.
Creates or updates the symlink.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/wright/provider/symlink.rb', line 12 def create fail Errno::EEXIST, if regular_file? symlink = symlink_to_s unless_uptodate(:create, "symlink already created: #{symlink}") do unless_dry_run("create symlink: #{symlink}") do Wright::Util::File.ln_sfn(, ) end end end |
#remove ⇒ void
This method returns an undefined value.
Removes the symlink.
26 27 28 29 30 31 32 33 34 |
# File 'lib/wright/provider/symlink.rb', line 26 def remove fail "'#{}' is not a symlink" if regular_file? unless_uptodate(:remove, "symlink already removed: '#{link_name}'") do unless_dry_run("remove symlink: '#{link_name}'") do FileUtils.rm() end end end |