mirror of
https://github.com/wavetermdev/homebrew-cask.git
synced 2026-08-05 13:43:24 -07:00
Merge pull request #2566 from rolandwalker/full_paths
always use full path to external utilities
This commit is contained in:
+3
-3
@@ -45,11 +45,11 @@ class Cask
|
||||
ohai "We'll set permissions properly so we won't need sudo in the future"
|
||||
current_user = ENV['USER']
|
||||
if caskroom.parent.writable?
|
||||
system "mkdir #{caskroom}"
|
||||
system "/bin/mkdir #{caskroom}"
|
||||
else
|
||||
# sudo in system is rude.
|
||||
system "sudo mkdir -p #{caskroom}"
|
||||
system "sudo chown -R #{current_user}:staff #{caskroom.parent}"
|
||||
system "/usr/bin/sudo /bin/mkdir -p #{caskroom}"
|
||||
system "/usr/bin/sudo /usr/sbin/chown -R #{current_user}:staff #{caskroom.parent}"
|
||||
end
|
||||
end
|
||||
appdir.mkpath unless appdir.exist?
|
||||
|
||||
@@ -3,7 +3,7 @@ module Cask::CLI::Home
|
||||
raise CaskUnspecifiedError if cask_names.empty?
|
||||
cask_names.each do |cask_name|
|
||||
cask = Cask.load(cask_name)
|
||||
system "open", cask.homepage
|
||||
system "/usr/bin/open", cask.homepage
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Cask::SystemCommand
|
||||
|
||||
def self._process_options(command, options)
|
||||
if options[:sudo]
|
||||
command = "sudo -E #{_quote(command)}"
|
||||
command = "/usr/bin/sudo -E #{_quote(command)}"
|
||||
end
|
||||
if options[:args]
|
||||
command = "#{command} #{options[:args].map { |arg| _quote(arg) }.join(' ')}"
|
||||
|
||||
@@ -12,7 +12,7 @@ describe Cask::Artifact::Pkg do
|
||||
it 'runs the system installer on the specified pkgs' do
|
||||
pkg = Cask::Artifact::Pkg.new(@cask, Cask::FakeSystemCommand)
|
||||
|
||||
expected_command = "sudo -E '/usr/sbin/installer' '-pkg' '#{@cask.destination_path/'MyFancyPkg'/'Fancy.pkg'}' '-target' '/' 2>&1"
|
||||
expected_command = "/usr/bin/sudo -E '/usr/sbin/installer' '-pkg' '#{@cask.destination_path/'MyFancyPkg'/'Fancy.pkg'}' '-target' '/' 2>&1"
|
||||
Cask::FakeSystemCommand.stubs_command(expected_command)
|
||||
|
||||
shutup do
|
||||
@@ -27,10 +27,10 @@ describe Cask::Artifact::Pkg do
|
||||
it 'runs the specified uninstaller for the cask' do
|
||||
pkg = Cask::Artifact::Pkg.new(@cask, Cask::FakeSystemCommand)
|
||||
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(sudo -E '/usr/bin/osascript' '-e' 'tell application "System Events" to count processes whose bundle identifier is "my.fancy.package.app"' 2>&1), '1')
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(sudo -E '/usr/bin/osascript' '-e' 'tell application id "my.fancy.package.app" to quit' 2>&1))
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(/usr/bin/sudo -E '/usr/bin/osascript' '-e' 'tell application "System Events" to count processes whose bundle identifier is "my.fancy.package.app"' 2>&1), '1')
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(/usr/bin/sudo -E '/usr/bin/osascript' '-e' 'tell application id "my.fancy.package.app" to quit' 2>&1))
|
||||
|
||||
expected_command = "sudo -E '#{@cask.destination_path/'MyFancyPkg'/'FancyUninstaller.tool'}' '--please' 2>&1"
|
||||
expected_command = "/usr/bin/sudo -E '#{@cask.destination_path/'MyFancyPkg'/'FancyUninstaller.tool'}' '--please' 2>&1"
|
||||
Cask::FakeSystemCommand.stubs_command(expected_command)
|
||||
|
||||
shutup do
|
||||
@@ -82,9 +82,9 @@ describe Cask::Artifact::Pkg do
|
||||
</plist>
|
||||
PLIST
|
||||
)
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(sudo -E '/usr/sbin/kextstat' '-l' '-b' 'my.fancy.package.kernelextension' 2>&1), 'loaded')
|
||||
Cask::FakeSystemCommand.expects_command(%Q(sudo -E '/sbin/kextunload' '-b' 'my.fancy.package.kernelextension' 2>&1))
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(sudo -E '/usr/sbin/pkgutil' '--forget' 'my.fancy.package.main' 2>&1))
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(/usr/bin/sudo -E '/usr/sbin/kextstat' '-l' '-b' 'my.fancy.package.kernelextension' 2>&1), 'loaded')
|
||||
Cask::FakeSystemCommand.expects_command(%Q(/usr/bin/sudo -E '/sbin/kextunload' '-b' 'my.fancy.package.kernelextension' 2>&1))
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(/usr/bin/sudo -E '/usr/sbin/pkgutil' '--forget' 'my.fancy.package.main' 2>&1))
|
||||
|
||||
Cask::FakeSystemCommand.stubs_command(
|
||||
%Q(/usr/sbin/pkgutil '--only-files' '--files' 'my.fancy.package.agent' 2>&1),
|
||||
@@ -123,13 +123,13 @@ describe Cask::Artifact::Pkg do
|
||||
/tmp/fancy/bin
|
||||
/tmp/fancy/var
|
||||
].each do |dir|
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(sudo -E '/bin/chmod' '777' '#{dir}' 2>&1))
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(/usr/bin/sudo -E '/bin/chmod' '777' '#{dir}' 2>&1))
|
||||
end
|
||||
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(sudo -E '/usr/sbin/pkgutil' '--forget' 'my.fancy.package.agent' 2>&1))
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(/usr/bin/sudo -E '/usr/sbin/pkgutil' '--forget' 'my.fancy.package.agent' 2>&1))
|
||||
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(sudo -E '/bin/rm' '-f' '/tmp/fancy/bin/fancy.exe' '/tmp/fancy/var/fancy.data' 2>&1))
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(sudo -E '/bin/rm' '-f' '/tmp/fancy/agent/fancy-agent.exe' '/tmp/fancy/agent/fancy-agent.pid' '/tmp/fancy/agent/fancy-agent.log' 2>&1))
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(/usr/bin/sudo -E '/bin/rm' '-f' '/tmp/fancy/bin/fancy.exe' '/tmp/fancy/var/fancy.data' 2>&1))
|
||||
Cask::FakeSystemCommand.stubs_command(%Q(/usr/bin/sudo -E '/bin/rm' '-f' '/tmp/fancy/agent/fancy-agent.exe' '/tmp/fancy/agent/fancy-agent.pid' '/tmp/fancy/agent/fancy-agent.log' 2>&1))
|
||||
|
||||
# No assertions after call since all assertions are implicit from the interactions setup above.
|
||||
# TODO: verify rmdir commands (requires setting up actual file tree or faking out .exists?
|
||||
|
||||
@@ -26,15 +26,15 @@ describe Cask::CLI::Home do
|
||||
it 'opens the homepage for the specified cask' do
|
||||
Cask::CLI::Home.run('alfred')
|
||||
Cask::CLI::Home.system_commands.must_equal [
|
||||
['open', 'http://www.alfredapp.com/']
|
||||
['/usr/bin/open', 'http://www.alfredapp.com/']
|
||||
]
|
||||
end
|
||||
|
||||
it 'works for multiple casks' do
|
||||
Cask::CLI::Home.run('alfred', 'adium')
|
||||
Cask::CLI::Home.system_commands.must_equal [
|
||||
['open', 'http://www.alfredapp.com/'],
|
||||
['open', 'https://www.adium.im/']
|
||||
['/usr/bin/open', 'http://www.alfredapp.com/'],
|
||||
['/usr/bin/open', 'https://www.adium.im/']
|
||||
]
|
||||
end
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ describe Cask::Pkg do
|
||||
)
|
||||
|
||||
Cask::FakeSystemCommand.expects_command(
|
||||
%q(sudo -E '/usr/sbin/pkgutil' '--forget' 'my.fake.pkg' 2>&1)
|
||||
%q(/usr/bin/sudo -E '/usr/sbin/pkgutil' '--forget' 'my.fake.pkg' 2>&1)
|
||||
)
|
||||
|
||||
pkg.uninstall
|
||||
|
||||
Reference in New Issue
Block a user