cask move_back: copy / delete
This commit is contained in:
parent
2a41f1359e
commit
e078becf4f
@ -62,14 +62,16 @@ module Hbc
|
|||||||
raise CaskError, "It seems the #{self.class.english_name} source '#{target}' is not there."
|
raise CaskError, "It seems the #{self.class.english_name} source '#{target}' is not there."
|
||||||
end
|
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
|
source.dirname.mkpath
|
||||||
|
|
||||||
if target.parent.writable?
|
if target.parent.writable?
|
||||||
FileUtils.move(target, source)
|
FileUtils.cp_r(target, source)
|
||||||
else
|
else
|
||||||
command.run("/bin/mv", args: [target, source], sudo: true)
|
command.run("/bin/cp", args: ["-r", target, source], sudo: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
delete(target, force: force, command: command, **options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete(target, force: false, command: nil, **_)
|
def delete(target, force: false, command: nil, **_)
|
||||||
|
@ -13,7 +13,8 @@ describe Hbc::CLI::Reinstall, :cask do
|
|||||||
Already downloaded: .*local-caffeine--1.2.3.zip
|
Already downloaded: .*local-caffeine--1.2.3.zip
|
||||||
==> Verifying checksum for Cask local-caffeine
|
==> Verifying checksum for Cask local-caffeine
|
||||||
==> Uninstalling 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
|
==> Purging files for version 1.2.3 of Cask local-caffeine
|
||||||
==> Installing Cask local-caffeine
|
==> Installing Cask local-caffeine
|
||||||
==> Moving App 'Caffeine.app' to '.*Caffeine.app'.
|
==> Moving App 'Caffeine.app' to '.*Caffeine.app'.
|
||||||
|
@ -12,7 +12,8 @@ describe Hbc::CLI::Uninstall, :cask do
|
|||||||
|
|
||||||
output = Regexp.new <<~EOS
|
output = Regexp.new <<~EOS
|
||||||
==> Uninstalling 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
|
==> Purging files for version 1.2.3 of Cask local-caffeine
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user