Sha256: ffd8e2897ed8b81c232509b1ebc77f7d40ec34bc026b9fca4b2e3efb14f01206
Contents?: true
Size: 1.63 KB
Versions: 8
Compression:
Stored size: 1.63 KB
Contents
require 'forwardable' require 'wright/resource' require 'wright/dsl' require 'wright/util/file_owner' module Wright class Resource # Directory resource, represents a directory. # # @example # dir = Wright::Resource::Directory.new('/tmp/foobar') # dir.create class Directory < Wright::Resource extend Forwardable # Initializes a Directory. # # @param name [String] the directory's name def initialize(name) super @mode = nil @owner = Wright::Util::FileOwner.new @action = :create end # @return [String, Integer] the directory's intended mode attr_accessor :mode # @!attribute owner # @return [String, Integer] the directory's intended owner # @!method owner= # @see #owner def_delegator :@owner, :user_and_group=, :owner= def_delegator :@owner, :user, :owner # @!attribute group # @return [String, Integer] the directory's intended group # @!method group= # @see #group def_delegator :@owner, :group def_delegator :@owner, :group= # 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
8 entries across 8 versions & 1 rubygems