Class: Wright::Resource::File
- Inherits:
-
Wright::Resource
- Object
- Wright::Resource
- Wright::Resource::File
- Extended by:
- Forwardable
- Defined in:
- lib/wright/resource/file.rb
Overview
Symlink resource, represents a symlink.
Instance Attribute Summary collapse
-
#content ⇒ String, #to_s
The file’s intended content.
-
#group ⇒ String, Integer
The directory’s intended group.
-
#mode ⇒ String, Integer
The file’s intended mode.
-
#owner ⇒ String, Integer
The directory’s intended owner.
Attributes inherited from Wright::Resource
#action, #ignore_failure, #name, #resource_name
Instance Method Summary collapse
-
#create ⇒ Bool
Creates or updates the file.
-
#initialize(name, args = {}) ⇒ File
constructor
Initializes a File.
-
#remove ⇒ Bool
Removes the file.
Methods inherited from Wright::Resource
Constructor Details
#initialize(name, args = {}) ⇒ File
Initializes a File.
46 47 48 49 50 51 52 53 54 |
# File 'lib/wright/resource/file.rb', line 46 def initialize(name, args = {}) super @action = args.fetch(:action, :create) @content = args.fetch(:content, nil) @mode = args.fetch(:mode, nil) owner = args.fetch(:owner, nil) group = args.fetch(:group, nil) @file_owner = Wright::Util::FileOwner.new(owner, group) end |
Instance Attribute Details
#content ⇒ String, #to_s
Returns the file’s intended content.
18 19 20 |
# File 'lib/wright/resource/file.rb', line 18 def content @content end |
#group ⇒ String, Integer
Returns the directory’s intended group.
34 |
# File 'lib/wright/resource/file.rb', line 34 def_delegator :file_owner, :group= |
#mode ⇒ String, Integer
Returns the file’s intended mode.
21 22 23 |
# File 'lib/wright/resource/file.rb', line 21 def mode @mode end |
#owner ⇒ String, Integer
Returns the directory’s intended owner.
27 |
# File 'lib/wright/resource/file.rb', line 27 def_delegator :file_owner, :user_and_group=, :owner= |
Instance Method Details
#create ⇒ Bool
Creates or updates the file.
60 61 62 63 64 |
# File 'lib/wright/resource/file.rb', line 60 def create might_update_resource do provider.create end end |
#remove ⇒ Bool
Removes the file.
70 71 72 73 74 |
# File 'lib/wright/resource/file.rb', line 70 def remove might_update_resource do provider.remove end end |