aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2016-01-14 18:57:31 +0800
committerXu Cheng2016-01-15 16:26:04 +0800
commitb24f1743255efe631a1d8fdd1357c5a4f475fa0e (patch)
treebdb25c879797e98d1fc703525f69ab16a11eb7d9 /Library
parentfab16b83e94cb38d9f90834c87b7f1604f19f14e (diff)
downloadbrew-b24f1743255efe631a1d8fdd1357c5a4f475fa0e.tar.bz2
download_strategy: add source_modified_time
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 77ec788b9..6eaa7be71 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -26,6 +26,12 @@ class AbstractDownloadStrategy
def cached_location
end
+ # @!attribute [r]
+ # return most recent modified time for all files in the current working directory after stage.
+ def source_modified_time
+ Pathname.pwd.to_enum(:find).select(&:file?).map(&:mtime).max
+ end
+
# Remove {#cached_location} and any other files associated with the resource
# from the cache.
def clear_cache
@@ -555,6 +561,10 @@ class GitDownloadStrategy < VCSDownloadStrategy
cp_r File.join(cached_location, "."), Dir.pwd
end
+ def source_modified_time
+ Time.parse Utils.popen_read("git", "--git-dir", git_dir, "show", "-s", "--format=%cD")
+ end
+
private
def cache_tag