Merge pull request #2520 from reitermarkus/pkgutil-plist

Partly revert “Fix `uninstall :pkgutil` leaving empty `.app` directories.”.
This commit is contained in:
Markus Reiter 2017-04-21 17:37:42 +02:00 committed by GitHub
commit 75ceed39e6
2 changed files with 12 additions and 4 deletions

View File

@ -63,7 +63,10 @@ module Hbc
end end
def pkgutil_bom_all def pkgutil_bom_all
@pkgutil_bom_all ||= info.fetch("paths").keys.map { |p| root.join(p) } @pkgutil_bom_all ||= @command.run!("/usr/sbin/pkgutil", args: ["--files", package_id])
.stdout
.split("\n")
.map { |path| root.join(path) }
end end
def root def root
@ -71,7 +74,7 @@ module Hbc
end end
def info def info
@info ||= @command.run!("/usr/sbin/pkgutil", args: ["--export-plist", package_id]) @info ||= @command.run!("/usr/sbin/pkgutil", args: ["--pkg-info-plist", package_id])
.plist .plist
end end

View File

@ -36,7 +36,12 @@ describe Hbc::Pkg, :cask do
it "forgets the pkg" do it "forgets the pkg" do
allow(fake_system_command).to receive(:run!).with( allow(fake_system_command).to receive(:run!).with(
"/usr/sbin/pkgutil", "/usr/sbin/pkgutil",
args: ["--export-plist", "my.fake.pkg"], args: ["--pkg-info-plist", "my.fake.pkg"],
).and_return(empty_response)
expect(fake_system_command).to receive(:run!).with(
"/usr/sbin/pkgutil",
args: ["--files", "my.fake.pkg"],
).and_return(empty_response) ).and_return(empty_response)
expect(fake_system_command).to receive(:run!).with( expect(fake_system_command).to receive(:run!).with(
@ -139,7 +144,7 @@ describe Hbc::Pkg, :cask do
expect(fake_system_command).to receive(:run!).with( expect(fake_system_command).to receive(:run!).with(
"/usr/sbin/pkgutil", "/usr/sbin/pkgutil",
args: ["--export-plist", pkg_id], args: ["--pkg-info-plist", pkg_id],
).and_return( ).and_return(
Hbc::SystemCommand::Result.new(nil, pkg_info_plist, nil, 0), Hbc::SystemCommand::Result.new(nil, pkg_info_plist, nil, 0),
) )