aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/tab.rb
diff options
context:
space:
mode:
authorXu Cheng2016-01-14 18:55:47 +0800
committerXu Cheng2016-01-15 16:26:04 +0800
commitfab16b83e94cb38d9f90834c87b7f1604f19f14e (patch)
treeb0be20659dfcd657afe685147884278a1e0bcb83 /Library/Homebrew/tab.rb
parent5bc1e0b83a002ed32443058143756670f9a1bcf7 (diff)
downloadbrew-fab16b83e94cb38d9f90834c87b7f1604f19f14e.tar.bz2
tab: add source modified time metadata
Diffstat (limited to 'Library/Homebrew/tab.rb')
-rw-r--r--Library/Homebrew/tab.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index 975e2a610..41697abb8 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -15,7 +15,7 @@ class Tab < OpenStruct
CACHE.clear
end
- def self.create(formula, compiler, stdlib, build)
+ def self.create(formula, compiler, stdlib, build, source_modified_time)
attributes = {
"used_options" => build.used_options.as_flags,
"unused_options" => build.unused_options.as_flags,
@@ -23,6 +23,7 @@ class Tab < OpenStruct
"built_as_bottle" => build.bottle?,
"poured_from_bottle" => false,
"time" => Time.now.to_i,
+ "source_modified_time" => source_modified_time.to_i,
"HEAD" => Homebrew.git_head,
"compiler" => compiler,
"stdlib" => stdlib,
@@ -43,6 +44,7 @@ class Tab < OpenStruct
def self.from_file_content(content, path)
attributes = Utils::JSON.load(content)
attributes["tabfile"] = path
+ attributes["source_modified_time"] ||= 0
attributes["source"] ||= {}
tapped_from = attributes["tapped_from"]
@@ -133,6 +135,7 @@ class Tab < OpenStruct
"built_as_bottle" => false,
"poured_from_bottle" => false,
"time" => nil,
+ "source_modified_time" => 0,
"HEAD" => nil,
"stdlib" => nil,
"compiler" => "clang",
@@ -214,6 +217,10 @@ class Tab < OpenStruct
source["spec"].to_sym
end
+ def source_modified_time
+ Time.at(super)
+ end
+
def to_json
attributes = {
"used_options" => used_options.as_flags,
@@ -221,6 +228,7 @@ class Tab < OpenStruct
"built_as_bottle" => built_as_bottle,
"poured_from_bottle" => poured_from_bottle,
"time" => time,
+ "source_modified_time" => source_modified_time.to_i,
"HEAD" => self.HEAD,
"stdlib" => (stdlib.to_s if stdlib),
"compiler" => (compiler.to_s if compiler),