Class: Wright::Provider::File
- Inherits:
-
Wright::Provider
- Object
- Wright::Provider
- Wright::Provider::File
- Defined in:
- lib/wright/provider/file.rb
Overview
File provider. Used as a provider for Resource::File.
Constant Summary
Constants inherited from Wright::Provider
Instance Method Summary collapse
-
#create ⇒ void
Creates or updates the file.
-
#remove ⇒ void
Removes the file.
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 file.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wright/provider/file.rb', line 19 def create fail_if_directory = unless_uptodate(:create, "file already created: '#{file_name}'") do unless_dry_run("create file: '#{file_name}'") do write_content_to_file .update unless .uptodate? end end end |
#remove ⇒ void
This method returns an undefined value.
Removes the file.
35 36 37 38 39 40 41 42 |
# File 'lib/wright/provider/file.rb', line 35 def remove fail_if_directory unless_uptodate(:remove, "file already removed: '#{file_name}'") do unless_dry_run("remove file: '#{file_name}'") do FileUtils.rm() end end end |