diff options
| author | commitay | 2018-02-21 07:47:43 +1000 | 
|---|---|---|
| committer | GitHub | 2018-02-21 07:47:43 +1000 | 
| commit | bab4bb68ee8299692a91640750e75fc5ad8049da (patch) | |
| tree | e9a4af288448c5f11b74ca5638a7eccf6a9b6d19 | |
| parent | 2c84c04bd4eefc050f400659ff7e9dd1aba3cfb9 (diff) | |
| parent | b864ae7b408741338f0016d686857fc0fe545fe2 (diff) | |
| download | brew-bab4bb68ee8299692a91640750e75fc5ad8049da.tar.bz2 | |
Merge pull request #3715 from commitay/moved
cask move_back: copy / delete
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/artifact/moved.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/reinstall_spec.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/uninstall_spec.rb | 3 | 
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..31cede71a 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 "Backing #{self.class.english_name} '#{target.basename}' up 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..f2d1322ad 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'. +      ==> Backing App 'Caffeine.app' up 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..38ee1bb73 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'. +      ==> Backing App 'Caffeine.app' up to '.*Caffeine.app'. +      ==> Removing App '.*Caffeine.app'.        ==> Purging files for version 1.2.3 of Cask local-caffeine      EOS | 
