Merge pull request #14368 from Kentzo/fix-cask-backup
cask: fix writability check backing up an artifact
This commit is contained in:
commit
344d32bf7f
@ -117,7 +117,7 @@ module Cask
|
|||||||
source.dirname.mkpath
|
source.dirname.mkpath
|
||||||
|
|
||||||
# We need to preserve extended attributes between copies.
|
# We need to preserve extended attributes between copies.
|
||||||
command.run!("/bin/cp", args: ["-pR", target, source], sudo: !target.parent.writable?)
|
command.run!("/bin/cp", args: ["-pR", target, source], sudo: !source.parent.writable?)
|
||||||
|
|
||||||
delete(target, force: force, command: command, **options)
|
delete(target, force: force, command: command, **options)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -263,6 +263,11 @@ describe Cask::Artifact::App, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "uninstall_phase" do
|
describe "uninstall_phase" do
|
||||||
|
after do
|
||||||
|
FileUtils.chmod 0755, target_path if target_path.exist?
|
||||||
|
FileUtils.chmod 0755, source_path if source_path.exist?
|
||||||
|
end
|
||||||
|
|
||||||
it "deletes managed apps" do
|
it "deletes managed apps" do
|
||||||
install_phase
|
install_phase
|
||||||
|
|
||||||
@ -272,6 +277,16 @@ describe Cask::Artifact::App, :cask do
|
|||||||
|
|
||||||
expect(target_path).not_to exist
|
expect(target_path).not_to exist
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "backs up read-only managed apps" do
|
||||||
|
install_phase
|
||||||
|
|
||||||
|
FileUtils.chmod 0544, target_path
|
||||||
|
|
||||||
|
expect { uninstall_phase }.to raise_error(Errno::ENOTEMPTY)
|
||||||
|
|
||||||
|
expect(source_path).to be_a_directory
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "summary" do
|
describe "summary" do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user