-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying pkg
target:
#14393
Allow specifying pkg
target:
#14393
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,4 +77,52 @@ | |
pkg.install_phase(command: fake_system_command) | ||
end | ||
end | ||
|
||
describe "target" do | ||
describe "with volume target" do | ||
let(:cask) { Cask::CaskLoader.load(cask_path("with-pkg-target")) } | ||
|
||
it "runs the system installer on the specified pkgs with the specified target" do | ||
pkg = cask.artifacts.find { |a| a.is_a?(described_class) } | ||
|
||
expect(fake_system_command).to receive(:run!).with( | ||
"/usr/sbin/installer", | ||
args: ["-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), | ||
"-target", "/Volumes/Macintosh HD2"], | ||
sudo: true, | ||
print_stdout: true, | ||
env: { | ||
"LOGNAME" => ENV.fetch("USER"), | ||
"USER" => ENV.fetch("USER"), | ||
"USERNAME" => ENV.fetch("USER"), | ||
}, | ||
) | ||
|
||
pkg.install_phase(command: fake_system_command) | ||
end | ||
end | ||
|
||
describe "with CurrentUserHomeDirectory target" do | ||
let(:cask) { Cask::CaskLoader.load(cask_path("with-pkg-target-current-user-home-directory")) } | ||
|
||
it "runs the system installer on the specified pkgs with the specified target" do | ||
pkg = cask.artifacts.find { |a| a.is_a?(described_class) } | ||
|
||
expect(fake_system_command).to receive(:run!).with( | ||
"/usr/sbin/installer", | ||
args: ["-pkg", cask.staged_path.join("MyFancyPkg", "Fancy.pkg"), | ||
"-target", "CurrentUserHomeDirectory"], | ||
sudo: false, | ||
Comment on lines
+114
to
+115
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm making an assumption here, but I feel like it's reasonable. If we're installing in the home directory, isn't it an error if |
||
print_stdout: true, | ||
env: { | ||
"LOGNAME" => ENV.fetch("USER"), | ||
"USER" => ENV.fetch("USER"), | ||
"USERNAME" => ENV.fetch("USER"), | ||
}, | ||
) | ||
|
||
pkg.install_phase(command: fake_system_command) | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cask "with-pkg-target-current-user-home-directory" do | ||
version "1.2.3" | ||
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" | ||
|
||
url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" | ||
homepage "https://brew.sh/fancy-pkg" | ||
|
||
pkg "MyFancyPkg/Fancy.pkg", target: "CurrentUserHomeDirectory" | ||
|
||
uninstall pkgutil: "my.fancy.package" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I copied both these fixtures from the |
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cask "with-pkg-target" do | ||
version "1.2.3" | ||
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b" | ||
|
||
url "file://#{TEST_FIXTURE_DIR}/cask/MyFancyPkg.zip" | ||
homepage "https://brew.sh/fancy-pkg" | ||
|
||
pkg "MyFancyPkg/Fancy.pkg", target: "/Volumes/Macintosh HD2" | ||
|
||
uninstall pkgutil: "my.fancy.package" | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we expect the cask to pass paths as strings, but special values like
CurrentUserHomeDirectory
as aSymbol
?