This commit is contained in:
Rylan Polster 2024-07-04 11:18:30 -04:00
parent 3a732460e9
commit e176159b23
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
3 changed files with 7 additions and 2 deletions

View File

@ -15,6 +15,7 @@ module Cask
tab.uninstall_flight_blocks = cask.uninstall_flight_blocks?
tab.runtime_dependencies = Tab.runtime_deps_hash(cask, cask.depends_on)
tab.source["version"] = cask.version.to_s
tab.source["path"] = cask.sourcefile_path.to_s
tab.uninstall_artifacts = cask.artifacts_list(uninstall_only: true)
tab

View File

@ -40,7 +40,6 @@ class AbstractTab
"time" => Time.now.to_i,
"arch" => Hardware::CPU.arch,
"source" => {
"path" => formula_or_cask.sourcefile_path.to_s,
"tap" => formula_or_cask.tap&.name,
"tap_git_head" => (formula_or_cask.tap&.installed? ? formula_or_cask.tap.git_head : nil),
},
@ -147,6 +146,7 @@ class Tab < AbstractTab
tab.aliases = formula.aliases
tab.runtime_dependencies = Tab.runtime_deps_hash(formula, runtime_deps)
tab.source["spec"] = formula.active_spec_sym.to_s
tab.source["path"] = formula.specified_path.to_s
tab.source["versions"] = {
"stable" => formula.stable&.version&.to_s,
"head" => formula.head&.version&.to_s,

View File

@ -212,6 +212,10 @@ RSpec.describe Cask::Tab, :cask do
describe "::create" do
it "creates a cask Tab" do
cask = Cask::CaskLoader.load("local-caffeine")
expected_artifacts = [
{ app: ["Caffeine.app"] },
{ zap: [{ trash: "#{TEST_FIXTURE_DIR}/cask/caffeine/org.example.caffeine.plist" }] },
]
tab = described_class.create(cask)
expect(tab).not_to be_loaded_from_api
@ -225,7 +229,7 @@ RSpec.describe Cask::Tab, :cask do
"version" => "1.2.3",
})
expect(tab.runtime_dependencies).to eq({})
expect(tab.uninstall_artifacts).to eq([{ app: ["Caffeine.app"] }])
expect(tab.uninstall_artifacts).to eq(expected_artifacts)
end
end