# File common/lib/symbiosis/config_file.rb, line 205 def changed? # # Read the snippet # snippet = File.readlines(self.filename) # # Set the managed parameter # @managed = false # # We expect the checksum to be the last line of the file # if snippet.last.is_a?(String) and snippet.last.chomp =~ /^#{self.comment_char} Checksum MD5 ([a-f0-9]{32,32})$/ # # OK we've found the checksum # supposed_checksum = $1 # # This file must have been managed at some point # @managed = true # # Pop off the last line, as this isn't part of the checksum # snippet.pop # # And compare to the calculated checksum of the rest of the snippet # return Digest::MD5.new.hexdigest(snippet.join) != supposed_checksum # # If the file has a big warning in it, we ignore changes # elsif snippet.any?{|l| l.is_a?(String) and self.comment_char+" DO NOT EDIT THIS FILE - CHANGES WILL BE OVERWRITTEN" == l.chomp} # # This file must have been managed at some point # @managed = true # # So return false # return false end # # Assume the file has been edited. # puts "\tCould not find checksum or big warning." if $VERBOSE true end