From 34df5309d4458c8d9178f50a7e457061ead2baa3 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Thu, 8 May 2014 10:14:04 -0400 Subject: [PATCH] Retire support for `sha1` stanza. We haven't received new submissions using `sha1` for quite some time. --- doc/CASK_LANGUAGE_REFERENCE.md | 5 ++--- lib/cask/dsl.rb | 13 ------------- test/cask/dsl_test.rb | 4 +--- 3 files changed, 3 insertions(+), 19 deletions(-) diff --git a/doc/CASK_LANGUAGE_REFERENCE.md b/doc/CASK_LANGUAGE_REFERENCE.md index a5f711574c2b4..f4478844b3008 100644 --- a/doc/CASK_LANGUAGE_REFERENCE.md +++ b/doc/CASK_LANGUAGE_REFERENCE.md @@ -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` @@ -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 diff --git a/lib/cask/dsl.rb b/lib/cask/dsl.rb index 2c159484b0192..555e1577eb358 100644 --- a/lib/cask/dsl.rb +++ b/lib/cask/dsl.rb @@ -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 diff --git a/test/cask/dsl_test.rb b/test/cask/dsl_test.rb index a9433e12a8314..438cb238c21f6 100644 --- a/test/cask/dsl_test.rb +++ b/test/cask/dsl_test.rb @@ -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