tab: add built_on & arch information

This commit is contained in:
Bo Anderson 2020-04-06 13:04:48 +01:00
parent c61427db7c
commit b338398a8c
4 changed files with 22 additions and 1 deletions

View File

@ -99,6 +99,15 @@ class DevelopmentTools
def subversion_handles_most_https_certificates? def subversion_handles_most_https_certificates?
true true
end end
def build_system_info
{
"os" => ENV["HOMEBREW_SYSTEM"],
"os_version" => OS_VERSION,
"cpu_family" => Hardware::CPU.family,
}
end
alias generic_build_system_info build_system_info
end end
end end

View File

@ -56,5 +56,13 @@ class DevelopmentTools
brew install gcc brew install gcc
EOS EOS
end end
def build_system_info
build_info = {
"xcode" => MacOS::Xcode.version.to_s.presence,
"clt" => MacOS::CLT.version.to_s.presence,
}
generic_build_system_info.merge build_info
end
end end
end end

View File

@ -36,6 +36,7 @@ class Tab < OpenStruct
"stdlib" => stdlib, "stdlib" => stdlib,
"aliases" => formula.aliases, "aliases" => formula.aliases,
"runtime_dependencies" => Tab.runtime_deps_hash(runtime_deps), "runtime_dependencies" => Tab.runtime_deps_hash(runtime_deps),
"arch" => Hardware::CPU.arch,
"source" => { "source" => {
"path" => formula.specified_path.to_s, "path" => formula.specified_path.to_s,
"tap" => formula.tap&.name, "tap" => formula.tap&.name,
@ -47,6 +48,7 @@ class Tab < OpenStruct
"version_scheme" => formula.version_scheme, "version_scheme" => formula.version_scheme,
}, },
}, },
"built_on" => DevelopmentTools.build_system_info,
} }
new(attributes) new(attributes)
@ -198,6 +200,7 @@ class Tab < OpenStruct
"version_scheme" => 0, "version_scheme" => 0,
}, },
}, },
"built_on" => DevelopmentTools.generic_build_system_info,
} }
new(attributes) new(attributes)
@ -344,6 +347,7 @@ class Tab < OpenStruct
"aliases" => aliases, "aliases" => aliases,
"runtime_dependencies" => runtime_dependencies, "runtime_dependencies" => runtime_dependencies,
"source" => source, "source" => source,
"built_on" => built_on,
} }
JSON.generate(attributes, options) JSON.generate(attributes, options)

View File

@ -120,7 +120,7 @@ describe Caveats do
"plist_test.plist" "plist_test.plist"
end end
end end
allow(ENV).to receive(:[]).with("TMUX").and_return(true) ENV["TMUX"] = "1"
allow(Homebrew).to receive(:_system).with("/usr/bin/pbpaste").and_return(false) allow(Homebrew).to receive(:_system).with("/usr/bin/pbpaste").and_return(false)
caveats = described_class.new(f).caveats caveats = described_class.new(f).caveats