Class: Wright::Resource::Directory

Inherits:
Wright::Resource show all
Defined in:
lib/wright/resource/directory.rb

Overview

Public: Directory resource, represents a directory.

Examples

dir = Wright::Resource::Directory.new('/tmp/foobar')
dir.create

Instance Attribute Summary collapse

Attributes inherited from Wright::Resource

#action, #ignore_failure, #name, #resource_name

Instance Method Summary collapse

Methods inherited from Wright::Resource

#on_update=, #run_action

Constructor Details

#initialize(name) ⇒ Directory

Public: Initialize a Directory.

name - The directory’s name.



16
17
18
19
20
21
22
# File 'lib/wright/resource/directory.rb', line 16

def initialize(name)
  super
  @mode = nil
  @owner = nil
  @group = nil
  @action = :create
end

Instance Attribute Details

#groupObject

Public: Get the directory’s group.



39
40
41
# File 'lib/wright/resource/directory.rb', line 39

def group
  @group
end

#modeObject

Public: Get/Set the directory’s mode.



25
26
27
# File 'lib/wright/resource/directory.rb', line 25

def mode
  @mode
end

#ownerObject

Public: Get the directory’s owner.



28
29
30
# File 'lib/wright/resource/directory.rb', line 28

def owner
  @owner
end

Instance Method Details

#createObject

Public: Create or update the directory.

Returns true if the directory was updated and false otherwise.



49
50
51
52
53
# File 'lib/wright/resource/directory.rb', line 49

def create
  might_update_resource do
    @provider.create
  end
end

#removeObject

Public: Remove the directory.

Returns true if the directory was updated and false otherwise.



58
59
60
61
62
# File 'lib/wright/resource/directory.rb', line 58

def remove
  might_update_resource do
    @provider.remove
  end
end