Class: Wright::Provider::Directory
- Inherits:
-
Wright::Provider
- Object
- Wright::Provider
- Wright::Provider::Directory
- Defined in:
- lib/wright/provider/directory.rb
Overview
Directory provider. Used as a provider for Resource::Directory.
Constant Summary
Constants inherited from Wright::Provider
Instance Method Summary collapse
-
#create ⇒ void
Creates or updates the directory.
-
#remove ⇒ void
Removes the directory.
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 directory.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/wright/provider/directory.rb', line 14 def create fail Errno::EEXIST, if regular_file? = unless_uptodate(:create, "directory already created: '#{dir_name}'") do unless_dry_run("create directory: '#{dir_name}'") do FileUtils.mkdir_p() .update unless .uptodate? end end end |
#remove ⇒ void
This method returns an undefined value.
Removes the directory.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/wright/provider/directory.rb', line 29 def remove if ::File.exist?() && !::File.directory?() fail "'#{}' exists but is not a directory" end unless_uptodate(:remove, "directory already removed: '#{dir_name}'") do unless_dry_run("remove directory: '#{dir_name}'") do FileUtils.rmdir() end end end |