Merge pull request #13842 from Rylan12/api-in-tab
Include `loaded_from_api` key in `Tab`
This commit is contained in:
commit
6eaa510615
@ -2704,6 +2704,10 @@ class Formula
|
||||
super
|
||||
end
|
||||
|
||||
# Whether this formula was loaded using the formulae.brew.sh API
|
||||
# @private
|
||||
attr_accessor :loaded_from_api
|
||||
|
||||
# Whether this formula contains OS/arch-specific blocks
|
||||
# (e.g. `on_macos`, `on_arm`, `on_monterey :or_older`, `on_system :linux, macos: :big_sur_or_newer`).
|
||||
# @private
|
||||
|
@ -1202,6 +1202,7 @@ class FormulaInstaller
|
||||
tab.unused_options = []
|
||||
tab.built_as_bottle = true
|
||||
tab.poured_from_bottle = true
|
||||
tab.loaded_from_api = formula.class.loaded_from_api
|
||||
tab.installed_as_dependency = installed_as_dependency?
|
||||
tab.installed_on_request = installed_on_request?
|
||||
tab.time = Time.now.to_i
|
||||
|
@ -217,6 +217,7 @@ module Formulary
|
||||
end
|
||||
end
|
||||
|
||||
klass.loaded_from_api = true
|
||||
mod.const_set(class_s, klass)
|
||||
|
||||
cache[:api] ||= {}
|
||||
|
@ -31,6 +31,7 @@ class Tab < OpenStruct
|
||||
"installed_as_dependency" => false,
|
||||
"installed_on_request" => false,
|
||||
"poured_from_bottle" => false,
|
||||
"loaded_from_api" => false,
|
||||
"time" => Time.now.to_i,
|
||||
"source_modified_time" => formula.source_modified_time.to_i,
|
||||
"compiler" => compiler,
|
||||
@ -189,6 +190,7 @@ class Tab < OpenStruct
|
||||
"installed_as_dependency" => false,
|
||||
"installed_on_request" => false,
|
||||
"poured_from_bottle" => false,
|
||||
"loaded_from_api" => false,
|
||||
"time" => nil,
|
||||
"source_modified_time" => 0,
|
||||
"stdlib" => nil,
|
||||
@ -332,6 +334,7 @@ class Tab < OpenStruct
|
||||
"unused_options" => unused_options.as_flags,
|
||||
"built_as_bottle" => built_as_bottle,
|
||||
"poured_from_bottle" => poured_from_bottle,
|
||||
"loaded_from_api" => loaded_from_api,
|
||||
"installed_as_dependency" => installed_as_dependency,
|
||||
"installed_on_request" => installed_on_request,
|
||||
"changed_files" => changed_files&.map(&:to_s),
|
||||
@ -384,6 +387,7 @@ class Tab < OpenStruct
|
||||
"Built from source"
|
||||
end
|
||||
|
||||
s << "using the formulae.brew.sh API" if loaded_from_api
|
||||
s << Time.at(time).strftime("on %Y-%m-%d at %H:%M:%S") if time
|
||||
|
||||
unless used_options.empty?
|
||||
|
Loading…
x
Reference in New Issue
Block a user