aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorcommitay2018-01-21 19:10:30 +1000
committercommitay2018-02-14 07:39:44 +1000
commite078becf4f3b7beaedea35e664a8c3562331ab3e (patch)
tree79f4eba84f7cc948a635e779267296a66b0df6b4 /Library
parent2a41f1359e81a52082f93c109beb3506bced2250 (diff)
downloadbrew-e078becf4f3b7beaedea35e664a8c3562331ab3e.tar.bz2
cask move_back: copy / delete
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/moved.rb8
-rw-r--r--Library/Homebrew/test/cask/cli/reinstall_spec.rb3
-rw-r--r--Library/Homebrew/test/cask/cli/uninstall_spec.rb3
3 files changed, 9 insertions, 5 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
index 856ab2766..5a7483543 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
@@ -62,14 +62,16 @@ module Hbc
raise CaskError, "It seems the #{self.class.english_name} source '#{target}' is not there."
end
- ohai "Moving #{self.class.english_name} '#{target.basename}' back to '#{source}'."
+ ohai "Copying #{self.class.english_name} '#{target.basename}' back to '#{source}'."
source.dirname.mkpath
if target.parent.writable?
- FileUtils.move(target, source)
+ FileUtils.cp_r(target, source)
else
- command.run("/bin/mv", args: [target, source], sudo: true)
+ command.run("/bin/cp", args: ["-r", target, source], sudo: true)
end
+
+ delete(target, force: force, command: command, **options)
end
def delete(target, force: false, command: nil, **_)
diff --git a/Library/Homebrew/test/cask/cli/reinstall_spec.rb b/Library/Homebrew/test/cask/cli/reinstall_spec.rb
index 3737a7a70..f56ed986d 100644
--- a/Library/Homebrew/test/cask/cli/reinstall_spec.rb
+++ b/Library/Homebrew/test/cask/cli/reinstall_spec.rb
@@ -13,7 +13,8 @@ describe Hbc::CLI::Reinstall, :cask do
Already downloaded: .*local-caffeine--1.2.3.zip
==> Verifying checksum for Cask local-caffeine
==> Uninstalling Cask local-caffeine
- ==> Moving App 'Caffeine.app' back to '.*Caffeine.app'.
+ ==> Copying App 'Caffeine.app' back to '.*Caffeine.app'.
+ ==> Removing App '.*Caffeine.app'.
==> Purging files for version 1.2.3 of Cask local-caffeine
==> Installing Cask local-caffeine
==> Moving App 'Caffeine.app' to '.*Caffeine.app'.
diff --git a/Library/Homebrew/test/cask/cli/uninstall_spec.rb b/Library/Homebrew/test/cask/cli/uninstall_spec.rb
index 322394de4..2cac42211 100644
--- a/Library/Homebrew/test/cask/cli/uninstall_spec.rb
+++ b/Library/Homebrew/test/cask/cli/uninstall_spec.rb
@@ -12,7 +12,8 @@ describe Hbc::CLI::Uninstall, :cask do
output = Regexp.new <<~EOS
==> Uninstalling Cask local-caffeine
- ==> Moving App 'Caffeine.app' back to '.*Caffeine.app'.
+ ==> Copying App 'Caffeine.app' back to '.*Caffeine.app'.
+ ==> Removing App '.*Caffeine.app'.
==> Purging files for version 1.2.3 of Cask local-caffeine
EOS