Sha256: b8eaacabff78aaef06fb9da02700cf5e1b3c77c24d242a269fb08510bdeb3998
Contents?: true
Size: 1.63 KB
Versions: 2
Compression:
Stored size: 1.63 KB
Contents
require 'wright/resource' require 'wright/dsl' module Wright class Resource # Directory resource, represents a directory. # # @example # dir = Wright::Resource::Directory.new('/tmp/foobar') # dir.create class Directory < Wright::Resource # Initializes a Directory. # # @param name [String] the directory's name def initialize(name) super @mode = nil @owner = nil @group = nil @action = :create end # @return [String, Integer] the directory's mode attr_accessor :mode # @return [String] the directory's owner attr_reader :owner # Sets the directory's owner. def owner=(owner) target_owner, target_group = Wright::Util::User.owner_to_owner_group(owner) @owner = target_owner unless target_owner.nil? @group = target_group unless target_group.nil? end # @return [String] the directory's group attr_reader :group # Sets the directory's group. def group=(group) @group = Wright::Util::User.group_to_gid(group) end # Creates or updates the directory. # # @return [Bool] true if the directory was updated and false # otherwise def create might_update_resource do @provider.create end end # Removes the directory. # # @return [Bool] true if the directory was updated and false # otherwise def remove might_update_resource do @provider.remove end end end end end Wright::DSL.register_resource(Wright::Resource::Directory)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wright-0.2.0 | lib/wright/resource/directory.rb |
wright-0.1.2 | lib/wright/resource/directory.rb |