Fail if cask source already exists.

This commit is contained in:
Markus Reiter 2016-11-28 13:38:49 +01:00
parent 3bcf80f651
commit 9a29bd35e6
3 changed files with 4 additions and 3 deletions

View File

@ -45,8 +45,7 @@ module Hbc
if force
ohai(warning_target_exists { |s| s << "overwriting." })
else
ohai(warning_target_exists { |s| s << "not moving." })
return false
raise CaskError, warning_target_exists << "."
end
end
unless source.exist?

View File

@ -39,7 +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."
opoo "It seems there is already #{self.class.artifact_english_article} #{self.class.artifact_english_name} at '#{target}'; not linking."
return false
end
unless source.exist?

View File

@ -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