Skip to content

Commit

Permalink
Merge pull request #7504 from rolandwalker/enforce_latest_as_symbol
Browse files Browse the repository at this point in the history
enforce version `:latest` as a symbol
  • Loading branch information
ndr committed Nov 21, 2014
2 parents 9999ac2 + 7559c83 commit 626042c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/cask/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ def initialize(cask)

def run!(download = false)
_check_required_fields
# todo: enable this test before 0.50.0
# _check_no_string_version_latest
_check_no_string_version_latest
_check_checksums
_check_sha256_no_check_if_latest
_check_sha256_if_versioned
Expand Down Expand Up @@ -49,16 +48,14 @@ def _check_no_string_version_latest

def _check_sha256_no_check_if_latest
odebug "Verifying sha256 :no_check with version :latest"
# todo: remove this string test before 0.50.0
if ((cask.version == 'latest' or cask.version == :latest) and cask.sums.is_a?(Array))
if cask.version == :latest and cask.sums.is_a?(Array)
add_error "you should use sha256 :no_check when version is :latest"
end
end

def _check_sha256_if_versioned
odebug "Verifying a sha256 is present when versioned"
# todo: remove this string test before 0.50.0
if ((cask.version != 'latest' and cask.version != :latest) and cask.sums == :no_check)
if cask.version != :latest and cask.sums == :no_check
add_error "you must include a sha256 when version is not :latest"
end
end
Expand Down

0 comments on commit 626042c

Please sign in to comment.