Method: FileUtils.uptodate?
- Defined in:
- lib/fileutils.rb
.uptodate?(new, old_list) ⇒ Boolean
Returns true if the file at path new is newer than all the files at paths in array old_list; false otherwise.
Argument new and the elements of old_list should be interpretable as paths:
FileUtils.uptodate?('Rakefile', ['Gemfile', 'README.md']) # => true
FileUtils.uptodate?('Gemfile', ['Rakefile', 'README.md']) # => false
A non-existent file is considered to be infinitely old.
Related: FileUtils.touch.
265 266 267 268 269 270 271 272 273 274 |
# File 'lib/fileutils.rb', line 265 def uptodate?(new, old_list) return false unless File.exist?(new) new_time = File.mtime(new) old_list.each do |old| if File.exist?(old) return false unless new_time > File.mtime(old) end end true end |