aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib
diff options
context:
space:
mode:
authorMarkus Reiter2016-12-05 09:22:00 +0100
committerGitHub2016-12-05 09:22:00 +0100
commit5cc7acee17e0aca22d8a4c3527c9a6ac03822843 (patch)
tree4532cc7414be6e4a783533ecb0df953a238bcd04 /Library/Homebrew/cask/lib
parent88d0e8c2e6c02d07111d99250e24f2bc201c8444 (diff)
parent0a6cecbaf8697df449bf329180f929264d3af84a (diff)
downloadbrew-5cc7acee17e0aca22d8a4c3527c9a6ac03822843.tar.bz2
Merge pull request #1590 from reitermarkus/fail-if-app-source-already-exists
Fail if cask source already exists.
Diffstat (limited to 'Library/Homebrew/cask/lib')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/moved.rb8
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb3
-rw-r--r--Library/Homebrew/cask/lib/hbc/cli/install.rb2
3 files changed, 5 insertions, 8 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
index f1e542e7a..64756fd93 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/moved.rb
@@ -42,12 +42,8 @@ module Hbc
def preflight_checks
if Utils.path_occupied?(target)
- if force
- ohai(warning_target_exists { |s| s << "overwriting." })
- else
- ohai(warning_target_exists { |s| s << "not moving." })
- return false
- end
+ raise CaskError, warning_target_exists << "." unless force
+ opoo(warning_target_exists { |s| s << "overwriting." })
end
unless source.exist?
message = "It seems the #{self.class.artifact_english_name} source is not there: '#{source}'"
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb b/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb
index 32d8d6840..2cd172ad3 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/symlinked.rb
@@ -39,8 +39,7 @@ module Hbc
def preflight_checks(source, target)
if target.exist? && !self.class.islink?(target)
- ohai "It seems there is already #{self.class.artifact_english_article} #{self.class.artifact_english_name} at '#{target}'; not linking."
- return false
+ raise CaskError, "It seems there is already #{self.class.artifact_english_article} #{self.class.artifact_english_name} at '#{target}'; not linking."
end
unless source.exist?
raise CaskError, "It seems the #{self.class.link_type_english_name.downcase} source is not there: '#{source}'"
diff --git a/Library/Homebrew/cask/lib/hbc/cli/install.rb b/Library/Homebrew/cask/lib/hbc/cli/install.rb
index 3e9ce4e4f..3f4c94b6b 100644
--- a/Library/Homebrew/cask/lib/hbc/cli/install.rb
+++ b/Library/Homebrew/cask/lib/hbc/cli/install.rb
@@ -35,6 +35,8 @@ module Hbc
rescue CaskNoShasumError => e
opoo e.message
count += 1
+ rescue CaskError => e
+ onoe e.message
end
end
count.zero? ? nil : count == cask_tokens.length