Class: Wright::Resource::File
- Inherits:
-
Wright::Resource
- Object
- Wright::Resource
- Wright::Resource::File
- Defined in:
- lib/wright/resource/file.rb
Overview
Public: Symlink resource, represents a symlink.
Examples
file = Wright::Resource::File.new('/tmp/foo')
file.content = 'bar'
file.create
Instance Attribute Summary collapse
-
#content ⇒ Object
Public: Get/Set the file’s content.
-
#group ⇒ Object
Public: Get/Set the file’s group.
-
#mode ⇒ Object
Public: Get/Set the file’s mode.
-
#owner ⇒ Object
Public: Get the file’s owner.
Attributes inherited from Wright::Resource
#action, #ignore_failure, #name, #resource_name
Instance Method Summary collapse
-
#create ⇒ Object
Public: Create or update the File.
-
#initialize(name) ⇒ File
constructor
Public: Initialize a File.
-
#remove ⇒ Object
Public: Remove the File.
Methods inherited from Wright::Resource
Constructor Details
#initialize(name) ⇒ File
Public: Initialize a File.
name - The file’s name.
29 30 31 32 33 34 35 36 |
# File 'lib/wright/resource/file.rb', line 29 def initialize(name) super @content = nil @mode = nil @owner = nil @group = nil @action = :create end |
Instance Attribute Details
#content ⇒ Object
Public: Get/Set the file’s content.
15 16 17 |
# File 'lib/wright/resource/file.rb', line 15 def content @content end |
#group ⇒ Object
Public: Get/Set the file’s group.
18 19 20 |
# File 'lib/wright/resource/file.rb', line 18 def group @group end |
#mode ⇒ Object
Public: Get/Set the file’s mode.
21 22 23 |
# File 'lib/wright/resource/file.rb', line 21 def mode @mode end |
#owner ⇒ Object
Public: Get the file’s owner.
24 25 26 |
# File 'lib/wright/resource/file.rb', line 24 def owner @owner end |
Instance Method Details
#create ⇒ Object
Public: Create or update the File.
Returns true if the file was updated and false otherwise.
49 50 51 52 53 |
# File 'lib/wright/resource/file.rb', line 49 def create might_update_resource do @provider.create end end |
#remove ⇒ Object
Public: Remove the File.
Returns true if the file was updated and false otherwise.
58 59 60 61 62 |
# File 'lib/wright/resource/file.rb', line 58 def remove might_update_resource do @provider.remove end end |