tab: add source modified time metadata
This commit is contained in:
parent
5bc1e0b83a
commit
fab16b83e9
@ -15,7 +15,7 @@ class Tab < OpenStruct
|
|||||||
CACHE.clear
|
CACHE.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.create(formula, compiler, stdlib, build)
|
def self.create(formula, compiler, stdlib, build, source_modified_time)
|
||||||
attributes = {
|
attributes = {
|
||||||
"used_options" => build.used_options.as_flags,
|
"used_options" => build.used_options.as_flags,
|
||||||
"unused_options" => build.unused_options.as_flags,
|
"unused_options" => build.unused_options.as_flags,
|
||||||
@ -23,6 +23,7 @@ class Tab < OpenStruct
|
|||||||
"built_as_bottle" => build.bottle?,
|
"built_as_bottle" => build.bottle?,
|
||||||
"poured_from_bottle" => false,
|
"poured_from_bottle" => false,
|
||||||
"time" => Time.now.to_i,
|
"time" => Time.now.to_i,
|
||||||
|
"source_modified_time" => source_modified_time.to_i,
|
||||||
"HEAD" => Homebrew.git_head,
|
"HEAD" => Homebrew.git_head,
|
||||||
"compiler" => compiler,
|
"compiler" => compiler,
|
||||||
"stdlib" => stdlib,
|
"stdlib" => stdlib,
|
||||||
@ -43,6 +44,7 @@ class Tab < OpenStruct
|
|||||||
def self.from_file_content(content, path)
|
def self.from_file_content(content, path)
|
||||||
attributes = Utils::JSON.load(content)
|
attributes = Utils::JSON.load(content)
|
||||||
attributes["tabfile"] = path
|
attributes["tabfile"] = path
|
||||||
|
attributes["source_modified_time"] ||= 0
|
||||||
attributes["source"] ||= {}
|
attributes["source"] ||= {}
|
||||||
|
|
||||||
tapped_from = attributes["tapped_from"]
|
tapped_from = attributes["tapped_from"]
|
||||||
@ -133,6 +135,7 @@ class Tab < OpenStruct
|
|||||||
"built_as_bottle" => false,
|
"built_as_bottle" => false,
|
||||||
"poured_from_bottle" => false,
|
"poured_from_bottle" => false,
|
||||||
"time" => nil,
|
"time" => nil,
|
||||||
|
"source_modified_time" => 0,
|
||||||
"HEAD" => nil,
|
"HEAD" => nil,
|
||||||
"stdlib" => nil,
|
"stdlib" => nil,
|
||||||
"compiler" => "clang",
|
"compiler" => "clang",
|
||||||
@ -214,6 +217,10 @@ class Tab < OpenStruct
|
|||||||
source["spec"].to_sym
|
source["spec"].to_sym
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def source_modified_time
|
||||||
|
Time.at(super)
|
||||||
|
end
|
||||||
|
|
||||||
def to_json
|
def to_json
|
||||||
attributes = {
|
attributes = {
|
||||||
"used_options" => used_options.as_flags,
|
"used_options" => used_options.as_flags,
|
||||||
@ -221,6 +228,7 @@ class Tab < OpenStruct
|
|||||||
"built_as_bottle" => built_as_bottle,
|
"built_as_bottle" => built_as_bottle,
|
||||||
"poured_from_bottle" => poured_from_bottle,
|
"poured_from_bottle" => poured_from_bottle,
|
||||||
"time" => time,
|
"time" => time,
|
||||||
|
"source_modified_time" => source_modified_time.to_i,
|
||||||
"HEAD" => self.HEAD,
|
"HEAD" => self.HEAD,
|
||||||
"stdlib" => (stdlib.to_s if stdlib),
|
"stdlib" => (stdlib.to_s if stdlib),
|
||||||
"compiler" => (compiler.to_s if compiler),
|
"compiler" => (compiler.to_s if compiler),
|
||||||
|
@ -7,15 +7,16 @@ class TabTests < Homebrew::TestCase
|
|||||||
@used = Options.create(%w[--with-foo --without-bar])
|
@used = Options.create(%w[--with-foo --without-bar])
|
||||||
@unused = Options.create(%w[--with-baz --without-qux])
|
@unused = Options.create(%w[--with-baz --without-qux])
|
||||||
|
|
||||||
@tab = Tab.new("used_options" => @used.as_flags,
|
@tab = Tab.new("used_options" => @used.as_flags,
|
||||||
"unused_options" => @unused.as_flags,
|
"unused_options" => @unused.as_flags,
|
||||||
"built_as_bottle" => false,
|
"built_as_bottle" => false,
|
||||||
"poured_from_bottle" => true,
|
"poured_from_bottle" => true,
|
||||||
"time" => nil,
|
"time" => nil,
|
||||||
"HEAD" => TEST_SHA1,
|
"source_modified_time" => 0,
|
||||||
"compiler" => "clang",
|
"HEAD" => TEST_SHA1,
|
||||||
"stdlib" => "libcxx",
|
"compiler" => "clang",
|
||||||
"source" => {
|
"stdlib" => "libcxx",
|
||||||
|
"source" => {
|
||||||
"tap" => "Homebrew/homebrew",
|
"tap" => "Homebrew/homebrew",
|
||||||
"path" => nil,
|
"path" => nil,
|
||||||
"spec" => "stable"
|
"spec" => "stable"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user