Class: Wright::Resource::Directory
- Inherits:
-
Wright::Resource
- Object
- Wright::Resource
- Wright::Resource::Directory
- Extended by:
- Forwardable
- Defined in:
- lib/wright/resource/directory.rb
Overview
Directory resource, represents a directory.
Instance Attribute Summary collapse
-
#group ⇒ String, Integer
The directory’s intended group.
-
#mode ⇒ String, Integer
The directory’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 directory.
-
#initialize(name, args = {}) ⇒ Directory
constructor
Initializes a Directory.
-
#remove ⇒ Bool
Removes the directory.
Methods inherited from Wright::Resource
Constructor Details
#initialize(name, args = {}) ⇒ Directory
Initializes a Directory.
25 26 27 28 29 30 31 32 |
# File 'lib/wright/resource/directory.rb', line 25 def initialize(name, args = {}) super @action = args.fetch(:action, :create) @mode = args.fetch(:mode, nil) owner = args.fetch(:owner, nil) group = args.fetch(:group, nil) @dir_owner = Wright::Util::FileOwner.new(owner, group) end |
Instance Attribute Details
#group ⇒ String, Integer
Returns the directory’s intended group.
48 |
# File 'lib/wright/resource/directory.rb', line 48 def_delegator :dir_owner, :group |
#mode ⇒ String, Integer
Returns the directory’s intended mode.
35 36 37 |
# File 'lib/wright/resource/directory.rb', line 35 def mode @mode end |
#owner ⇒ String, Integer
Returns the directory’s intended owner.
41 |
# File 'lib/wright/resource/directory.rb', line 41 def_delegator :dir_owner, :user_and_group=, :owner= |
Instance Method Details
#create ⇒ Bool
Creates or updates the directory.
55 56 57 58 59 |
# File 'lib/wright/resource/directory.rb', line 55 def create might_update_resource do provider.create end end |
#remove ⇒ Bool
Removes the directory.
65 66 67 68 69 |
# File 'lib/wright/resource/directory.rb', line 65 def remove might_update_resource do provider.remove end end |