lib/beaker/host/mac/exec.rb in beaker-4.21.0 vs lib/beaker/host/mac/exec.rb in beaker-4.22.0
- old
+ new
@@ -33,6 +33,15 @@
# @return [Boolean] false
def selinux_enabled?()
false
end
+ # Update ModifiedDate on a file
+ # @param [String] file Path to the file
+ # @param [String] timestamp Timestamp to set
+ def modified_at(file, timestamp = nil)
+ require 'date'
+ time = timestamp ? DateTime.parse("#{timestamp}") : DateTime.now
+ timestamp = time.strftime('%Y%m%d%H%M')
+ execute("touch -mt #{timestamp} #{file}")
+ end
end