class Wright::Resource::Directory
Directory
resource, represents a directory.
@example
dir = Wright::Resource::Directory.new('/tmp/foobar') dir.create
Attributes
dir_owner[R]
mode[RW]
@return [String, Integer] the directory's intended mode
Public Class Methods
new(name, args = {})
click to toggle source
Initializes a Directory
.
@param name [String] the directory's name @param args [Hash] the arguments @option args [Symbol] :action (:create) the action @option args [String, Integer] :mode the directory's mode @option args [String, Integer] :owner the directory's owner @option args [String, Integer] :group the directory's group
Calls superclass method
Wright::Resource::new
# 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
Public Instance Methods
create()
click to toggle source
Creates or updates the directory.
@return [Bool] true if the directory was updated and false
otherwise
# File lib/wright/resource/directory.rb, line 55 def create might_update_resource do provider.create end end
remove()
click to toggle source
Removes the directory.
@return [Bool] true if the directory was updated and false
otherwise
# File lib/wright/resource/directory.rb, line 65 def remove might_update_resource do provider.remove end end