Skip to content

Commit

Permalink
Merge pull request #4264 from rolandwalker/retire_sha1
Browse files Browse the repository at this point in the history
Retire support for `sha1` stanza.
  • Loading branch information
rolandwalker committed May 8, 2014
2 parents e10f8b9 + 34df530 commit cfc6ae7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
5 changes: 2 additions & 3 deletions doc/CASK_LANGUAGE_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ and slated for retirement.

| name | multiple occurrences allowed? | meaning |
| ------------------ |------------------------------ | ----------- |
| `sha1` | No | an obsolete alternative to `sha256`
| `no_checksum` | No | an obsolete alternative to `sha256 :no_check`


Expand Down Expand Up @@ -170,8 +169,8 @@ And the following methods may be useful for interpolation:

## Checksum Stanza Details

Older Casks may still use `sha1` checksums. This is OK, but new
Casks and updates should adopt `sha256`.
Older Casks may still use `no_checksum` stanzas. This is OK, but new
Casks and updates should adopt `sha256 :no_check`.


## URL Stanza Details
Expand Down
13 changes: 0 additions & 13 deletions lib/cask/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,6 @@ def hash_name(hash_type)
hash_type.to_s == 'sha2' ? 'sha256' : hash_type.to_s
end

# @@@ todo remove support for sha1 stanza
def sha1(sha1=nil)
if @sums == :no_check
raise CaskInvalidError.new(self.title, "'no_checksum' stanza conflicts with 'sha1'")
end
if sha1 == :no_check
@sums = sha1
else
@sums ||= []
@sums << Checksum.new(:sha1, sha1) unless sha1.nil?
end
end

def sha256(sha2=nil)
# @@@ todo remove this after deleting support for legacy no_checksum stanza
if @sums == :no_check
Expand Down
4 changes: 1 addition & 3 deletions test/cask/dsl_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
test_cask.version.must_equal '1.2.3'
end

it "lets you set checksum via sha1 and/or sha256" do
it "lets you set checksum via sha256" do
ChecksumCask = Class.new(Cask)
ChecksumCask.class_eval do
sha1 'imasha1'
sha256 'imasha2'
end
instance = ChecksumCask.new
instance.sums.must_equal [
Checksum.new(:sha1, 'imasha1'),
Checksum.new(:sha2, 'imasha2')
]
end
Expand Down

0 comments on commit cfc6ae7

Please sign in to comment.