aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Library/Homebrew/tab.rb10
-rw-r--r--Library/Homebrew/test/test_tab.rb19
2 files changed, 19 insertions, 10 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),
diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb
index f8c36fd4e..91d70e705 100644
--- a/Library/Homebrew/test/test_tab.rb
+++ b/Library/Homebrew/test/test_tab.rb
@@ -7,15 +7,16 @@ class TabTests < Homebrew::TestCase
@used = Options.create(%w[--with-foo --without-bar])
@unused = Options.create(%w[--with-baz --without-qux])
- @tab = Tab.new("used_options" => @used.as_flags,
- "unused_options" => @unused.as_flags,
- "built_as_bottle" => false,
- "poured_from_bottle" => true,
- "time" => nil,
- "HEAD" => TEST_SHA1,
- "compiler" => "clang",
- "stdlib" => "libcxx",
- "source" => {
+ @tab = Tab.new("used_options" => @used.as_flags,
+ "unused_options" => @unused.as_flags,
+ "built_as_bottle" => false,
+ "poured_from_bottle" => true,
+ "time" => nil,
+ "source_modified_time" => 0,
+ "HEAD" => TEST_SHA1,
+ "compiler" => "clang",
+ "stdlib" => "libcxx",
+ "source" => {
"tap" => "Homebrew/homebrew",
"path" => nil,
"spec" => "stable"