require 'fileutils' module RCM class File attr_accessor :path, :owner, :group, :mode, :state, :src_path, :changed PRESENT = 'present'.freeze ABSENT = 'absent'.freeze def ==(other) return false unless other.is_a?(RCM::File) # Paths are same and status is absent for both return true if @state == ABSENT && other.state == ABSENT && @path == other.path @owner == other.owner && @group == other.group && @mode == other.mode && @state == other.state && ::FileUtils.compare_file(@path, other.path) end def initialize(path, owner, group, mode, src_path, state) @path = path @owner = owner @group = group @mode = mode @src_path = src_path @state = state @changed = false end def to_s "Path = #{@path}\n" + "Owner = #{@owner}\n" + "Group = #{@group}\n" + "Mode = #{@mode}\n" + "Source Path = #{src_path}\n" + "Changed = #{@changed}" end end end