Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retire support for sha1 stanza. #4264

Merged
merged 1 commit into from
May 8, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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