diff options
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cask.rb | 1 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/installer.rb | 17 |
2 files changed, 8 insertions, 10 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb index 52dd676b4..975d69d07 100644 --- a/Library/Homebrew/cask/lib/hbc/cask.rb +++ b/Library/Homebrew/cask/lib/hbc/cask.rb @@ -32,7 +32,6 @@ module Hbc end def metadata_path(timestamp = :latest, create = false) - return nil unless metadata_versioned_container_path.respond_to?(:join) if create && timestamp == :latest raise CaskError, "Cannot create metadata path when timestamp is :latest" end diff --git a/Library/Homebrew/cask/lib/hbc/installer.rb b/Library/Homebrew/cask/lib/hbc/installer.rb index b86f3264d..94d270946 100644 --- a/Library/Homebrew/cask/lib/hbc/installer.rb +++ b/Library/Homebrew/cask/lib/hbc/installer.rb @@ -295,16 +295,15 @@ module Hbc end def save_caskfile - timestamp = :now - create = true - savedir = @cask.metadata_subdir("Casks", timestamp, create) - if Dir.entries(savedir).size > 2 - # should not happen - raise CaskAlreadyInstalledError, @cask unless force - savedir.rmtree - FileUtils.mkdir_p savedir + unless (old_savedirs = Pathname.glob(@cask.metadata_path("*"))).empty? + old_savedirs.each(&:rmtree) end - FileUtils.copy(@cask.sourcefile_path, savedir) if @cask.sourcefile_path + + return unless @cask.sourcefile_path + + savedir = @cask.metadata_subdir("Casks", :now, true) + savedir.mkpath + FileUtils.copy @cask.sourcefile_path, savedir end def uninstall |
