class Wright::Resource::File
Symlink
resource, represents a symlink.
@example
file = Wright::Resource::File.new('/tmp/foo', content: 'bar') file.create
Attributes
content[RW]
@return [String, to_s] the file's intended content
file_owner[R]
mode[RW]
@return [String, Integer] the file's intended mode
Public Class Methods
new(name, args = {})
click to toggle source
Initializes a File
.
@param name [String] the file's name @param args [Hash] the arguments @option args [Symbol] :action (:create) the action @option args [String, to_s] :content the file's content @option args [String, Integer] :mode the file's mode @option args [String, Integer] :owner the file's owner @option args [String, Integer] :group the file's group
Calls superclass method
Wright::Resource::new
# File lib/wright/resource/file.rb, line 46 def initialize(name, args = {}) super @action = args.fetch(:action, :create) @content = args.fetch(:content, nil) @mode = args.fetch(:mode, nil) owner = args.fetch(:owner, nil) group = args.fetch(:group, nil) @file_owner = Wright::Util::FileOwner.new(owner, group) end
Public Instance Methods
create()
click to toggle source
Creates or updates the file.
@return [Bool] true if the file was updated and false
otherwise
# File lib/wright/resource/file.rb, line 60 def create might_update_resource do provider.create end end
remove()
click to toggle source
Removes the file.
@return [Bool] true if the file was updated and false
otherwise
# File lib/wright/resource/file.rb, line 70 def remove might_update_resource do provider.remove end end