From 1ddec7128d3ed9b97dbff077fd8fee1e0845e114 Mon Sep 17 00:00:00 2001 From: Roland Walker Date: Mon, 15 Sep 2014 11:01:44 -0400 Subject: [PATCH] add uninstall :rmdir per discussion at https://github.com/caskroom/homebrew-cask/pull/6174#discussion-diff-17516171 refs: #6174 This PR is large because of some test-suite refactoring. --- doc/CASK_LANGUAGE_REFERENCE.md | 12 ++++++----- doc/cask_language_deltas.md | 1 + lib/cask/artifact/uninstall_base.rb | 20 ++++++++++++++++++- test/cask/artifact/alt_target_test.rb | 2 +- test/cask/artifact/app_test.rb | 2 +- test/cask/artifact/two_apps_correct_test.rb | 2 +- test/cask/artifact/uninstall_test.rb | 2 ++ test/support/Casks/adobe-air-container.rb | 2 +- test/support/Casks/bad-checksum.rb | 2 +- test/support/Casks/bzipped-asset.rb | 2 +- test/support/Casks/cab-container.rb | 2 +- test/support/Casks/gzipped-asset.rb | 2 +- .../Casks/invalid/invalid-appcast-format.rb | 2 +- .../Casks/invalid/invalid-appcast-multiple.rb | 2 +- .../Casks/invalid/invalid-appcast-url.rb | 2 +- .../invalid/invalid-conflicts-with-key.rb | 2 +- .../Casks/invalid/invalid-depends-on-key.rb | 2 +- .../invalid/invalid-gpg-conflicting-keys.rb | 2 +- .../Casks/invalid/invalid-gpg-key-url.rb | 2 +- .../Casks/invalid/invalid-gpg-missing-key.rb | 2 +- .../invalid/invalid-gpg-multiple-stanzas.rb | 2 +- .../Casks/invalid/invalid-gpg-parameter.rb | 2 +- .../invalid/invalid-gpg-signature-url.rb | 2 +- .../support/Casks/invalid/invalid-gpg-type.rb | 2 +- .../Casks/invalid/invalid-license-multiple.rb | 2 +- .../Casks/invalid/invalid-license-value.rb | 2 +- .../support/Casks/invalid/invalid-tags-key.rb | 2 +- .../Casks/invalid/invalid-tags-multiple.rb | 2 +- .../Casks/invalid/invalid-two-homepage.rb | 2 +- test/support/Casks/invalid/invalid-two-url.rb | 2 +- .../Casks/invalid/invalid-two-version.rb | 2 +- test/support/Casks/local-caffeine.rb | 2 +- test/support/Casks/local-transmission.rb | 2 +- test/support/Casks/missing-checksum.rb | 2 +- .../support/Casks/naked-executable-dsl-one.rb | 2 +- test/support/Casks/naked-executable.rb | 2 +- test/support/Casks/naked-pkg.rb | 2 +- test/support/Casks/nested-app-dsl-one.rb | 2 +- test/support/Casks/nested-app.rb | 2 +- test/support/Casks/no-checksum.rb | 2 +- test/support/Casks/rar-container.rb | 2 +- test/support/Casks/sevenzip-container.rb | 2 +- test/support/Casks/stuffit-container.rb | 2 +- test/support/Casks/tarball.rb | 2 +- test/support/Casks/with-alt-target.rb | 2 +- test/support/Casks/with-appcast.rb | 2 +- test/support/Casks/with-binary.rb | 2 +- test/support/Casks/with-caveats.rb | 2 +- .../support/Casks/with-conditional-caveats.rb | 2 +- test/support/Casks/with-conflicts-with.rb | 2 +- test/support/Casks/with-depends-on.rb | 2 +- test/support/Casks/with-gpg-key-url.rb | 2 +- test/support/Casks/with-gpg.rb | 2 +- test/support/Casks/with-install-script.rb | 2 +- test/support/Casks/with-installable.rb | 5 +++-- test/support/Casks/with-license.rb | 2 +- test/support/Casks/with-macosx-dir.rb | 2 +- test/support/Casks/with-pkgutil-uninstall.rb | 2 +- test/support/Casks/with-pkgutil-zap.rb | 2 +- test/support/Casks/with-tags.rb | 2 +- test/support/Casks/with-two-apps-correct.rb | 2 +- test/support/Casks/with-two-apps-incorrect.rb | 2 +- test/support/Casks/with-zap.rb | 2 +- test/support/Casks/xar-container.rb | 2 +- .../binaries/empty_directory/.gitignore | 0 test/test_helper.rb | 11 ++++++---- 66 files changed, 98 insertions(+), 71 deletions(-) create mode 100644 test/support/binaries/empty_directory/.gitignore diff --git a/doc/CASK_LANGUAGE_REFERENCE.md b/doc/CASK_LANGUAGE_REFERENCE.md index cedc44360776..e5fb290efcb5 100644 --- a/doc/CASK_LANGUAGE_REFERENCE.md +++ b/doc/CASK_LANGUAGE_REFERENCE.md @@ -432,7 +432,8 @@ of the following key/value pairs as arguments to `uninstall`. - `:args` - array of arguments to the uninstall script - `:input` - array of lines of input to be sent to `stdin` of the script - `:must_succeed` - set to `false` if the script is allowed to fail -* `:files` (array) - single-quoted, absolute paths of files or directories to remove. `:files` should only be used as a last resort. `:pkgutil` is strongly preferred +* `:files` (string or array) - single-quoted, absolute paths of files or directory trees to remove. `:files` should only be used as a last resort. `:pkgutil` is strongly preferred +* `:rmdir` (string or array) - single-quoted, absolute paths of directories to remove if empty. Each `uninstall` technique is applied according to the order above. The order in which `uninstall` keys appear in the Cask file is ignored. @@ -636,11 +637,12 @@ $ brew cask zap td-toolbelt # also removes org.ruby-lang.installer The form of `zap` stanza follows the [`uninstall` stanza](#uninstall-stanza-details). All of the same directives are available. -`zap` differs from `uninstall` in the interpretation of values paired with -the `:files` key: +`zap` differs from `uninstall` in the following ways: + * The use of `:files` is not discouraged. + * The target values for `:files` and `:rmdir` accept leading tilde characters + (`~`), which will be expanded to home directories. - * Leading tilde characters (`~`) will be expanded to home directories, as - in the shell. +Example: [injection.rb](../Casks/injection.rb) ## Arbitrary Ruby Methods diff --git a/doc/cask_language_deltas.md b/doc/cask_language_deltas.md index b7a9df8b14ac..bbdefe545337 100644 --- a/doc/cask_language_deltas.md +++ b/doc/cask_language_deltas.md @@ -42,6 +42,7 @@ This notice will be removed for the final form.** * `depends_on :java` * stub - not yet functional * `zap` + * `uninstall :rmdir` ## Renames (1.0) diff --git a/lib/cask/artifact/uninstall_base.rb b/lib/cask/artifact/uninstall_base.rb index 592e3843191f..cba9cb10a232 100644 --- a/lib/cask/artifact/uninstall_base.rb +++ b/lib/cask/artifact/uninstall_base.rb @@ -37,7 +37,7 @@ def dispatch_uninstall_directives(stanza, expand_tilde=false) ohai "Running #{stanza} process for #{@cask}; your password may be necessary" directives_set.each do |directives| - unknown_keys = directives.keys - [:early_script, :launchctl, :quit, :signal, :kext, :script, :pkgutil, :files, :delete, :trash] + unknown_keys = directives.keys - [:early_script, :launchctl, :quit, :signal, :kext, :script, :pkgutil, :files, :delete, :trash, :rmdir] unless unknown_keys.empty? opoo %Q{Unknown arguments to #{stanza} -- #{unknown_keys.inspect}. Running "brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup" will likely fix it.} end @@ -172,5 +172,23 @@ def dispatch_uninstall_directives(stanza, expand_tilde=false) @command.run!('/bin/rm', :args => path_slice.unshift('-rf', '--'), :sudo => true) end end + + directives_set.select{ |h| h.key?(:rmdir) }.each do |directives| + Array(directives[:rmdir]).flatten.each do |directory| + directory = self.class.expand_path_strings([directory]).first if expand_tilde + directory = self.class.remove_relative_path_strings(:rmdir, [ directory ]).first + next unless directory.respond_to?(:length) + next unless directory.length > 0 + ohai "Removing directory if empty: #{directory.utf8_inspect}" + directory = Pathname.new(directory) + next unless directory.exist? + @command.run!('/bin/rm', :args => [ '-f', '--', directory.join('.DS_Store') ], + :sudo => true, + :stderr => :silence) + @command.run('/bin/rmdir', :args => [ '--', directory ], + :sudo => true, + :stderr => :silence) + end + end end end diff --git a/test/cask/artifact/alt_target_test.rb b/test/cask/artifact/alt_target_test.rb index ef50b0aeab7d..a03496760920 100644 --- a/test/cask/artifact/alt_target_test.rb +++ b/test/cask/artifact/alt_target_test.rb @@ -35,7 +35,7 @@ it "works with an application in a subdir" do AltSubDirCask = Class.new(Cask) AltSubDirCask.class_eval do - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/cask/artifact/app_test.rb b/test/cask/artifact/app_test.rb index e091d0ec8430..13643e898fc7 100644 --- a/test/cask/artifact/app_test.rb +++ b/test/cask/artifact/app_test.rb @@ -21,7 +21,7 @@ it "works with an application in a subdir" do SubDirCask = Class.new(Cask) SubDirCask.class_eval do - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/cask/artifact/two_apps_correct_test.rb b/test/cask/artifact/two_apps_correct_test.rb index fa6d24c726ba..1abc3087fab0 100644 --- a/test/cask/artifact/two_apps_correct_test.rb +++ b/test/cask/artifact/two_apps_correct_test.rb @@ -22,7 +22,7 @@ it "works with an application in a subdir" do AltSubDirTwoAppsCask = Class.new(Cask) AltSubDirTwoAppsCask.class_eval do - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/cask/artifact/uninstall_test.rb b/test/cask/artifact/uninstall_test.rb index d2de0a505fda..760dd4d869b0 100644 --- a/test/cask/artifact/uninstall_test.rb +++ b/test/cask/artifact/uninstall_test.rb @@ -36,6 +36,8 @@ Cask::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', @cask.destination_path/'MyFancyPkg'/'FancyUninstaller.tool', '--please']) Cask::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/rm', '-rf', '--', '/permissible/absolute/path']) + Cask::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/rm', '-f', '--', Pathname.new(TestHelper.local_binary_path('empty_directory')).join('.DS_Store')]) + Cask::FakeSystemCommand.expects_command(['/usr/bin/sudo', '-E', '--', '/bin/rmdir', '--', Pathname.new(TestHelper.local_binary_path('empty_directory'))]) shutup do uninstall_artifact.uninstall_phase diff --git a/test/support/Casks/adobe-air-container.rb b/test/support/Casks/adobe-air-container.rb index b78f657b5140..ed2926865705 100644 --- a/test/support/Casks/adobe-air-container.rb +++ b/test/support/Casks/adobe-air-container.rb @@ -1,5 +1,5 @@ class AdobeAirContainer < TestCask - url TestHelper.local_binary('GMDesk-1.01.air') + url TestHelper.local_binary_url('GMDesk-1.01.air') homepage 'http://robertnyman.com/gmdesk/' version '1.0.1' sha256 '9b6e4174afa76f2af50238364fcf87525bc4ed2287acbe62925107ab6cda5c99' diff --git a/test/support/Casks/bad-checksum.rb b/test/support/Casks/bad-checksum.rb index e35bb24fe0cc..46bab6ea20ab 100644 --- a/test/support/Casks/bad-checksum.rb +++ b/test/support/Casks/bad-checksum.rb @@ -1,5 +1,5 @@ class BadChecksum < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 'badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb' diff --git a/test/support/Casks/bzipped-asset.rb b/test/support/Casks/bzipped-asset.rb index 1decffa45ead..ffbe4627f6d0 100644 --- a/test/support/Casks/bzipped-asset.rb +++ b/test/support/Casks/bzipped-asset.rb @@ -1,5 +1,5 @@ class BzippedAsset < TestCask - url TestHelper.local_binary('bzipped_asset.bz2') + url TestHelper.local_binary_url('bzipped_asset.bz2') homepage 'http://example.com/bzipped-asset' version '1.2.3' sha256 'eaf67b3a62cb9275f96e45d05c70b94bef9ef1dae344083e93eda6b0b388a61c' diff --git a/test/support/Casks/cab-container.rb b/test/support/Casks/cab-container.rb index e8837107da7f..2b8e54738e5d 100644 --- a/test/support/Casks/cab-container.rb +++ b/test/support/Casks/cab-container.rb @@ -1,5 +1,5 @@ class CabContainer < TestCask - url TestHelper.local_binary('cabcontainer.cab') + url TestHelper.local_binary_url('cabcontainer.cab') homepage 'http://example.com/cab-container' version '1.2.3' sha256 '192d0cf6b727473f9ba0f55cec793ee2a8f7113c5cfe9d49e05a087436c5efe2' diff --git a/test/support/Casks/gzipped-asset.rb b/test/support/Casks/gzipped-asset.rb index 4c2a71cfc020..dbb0e89aaf52 100644 --- a/test/support/Casks/gzipped-asset.rb +++ b/test/support/Casks/gzipped-asset.rb @@ -1,5 +1,5 @@ class GzippedAsset < TestCask - url TestHelper.local_binary('gzipped_asset.gz') + url TestHelper.local_binary_url('gzipped_asset.gz') homepage 'http://example.com/gzipped-asset' version '1.2.3' sha256 '832506ade94b3e41ecdf2162654eb75891a0749803229e82b2e0420fd1b9e8d2' diff --git a/test/support/Casks/invalid/invalid-appcast-format.rb b/test/support/Casks/invalid/invalid-appcast-format.rb index 528a65ffd74d..cbbc01c0eb0d 100644 --- a/test/support/Casks/invalid/invalid-appcast-format.rb +++ b/test/support/Casks/invalid/invalid-appcast-format.rb @@ -1,5 +1,5 @@ class InvalidAppcastFormat < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-appcast-format' appcast 'http://example.com/appcast.xml', :sha256 => '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853', diff --git a/test/support/Casks/invalid/invalid-appcast-multiple.rb b/test/support/Casks/invalid/invalid-appcast-multiple.rb index 437c818ede35..a2b3c8a532df 100644 --- a/test/support/Casks/invalid/invalid-appcast-multiple.rb +++ b/test/support/Casks/invalid/invalid-appcast-multiple.rb @@ -1,5 +1,5 @@ class InvalidAppcastMultiple < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-appcast-multiple' appcast 'http://example.com/appcast1.xml', :sha256 => '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853', diff --git a/test/support/Casks/invalid/invalid-appcast-url.rb b/test/support/Casks/invalid/invalid-appcast-url.rb index 5a6b79d6143c..16c85ee2af7e 100644 --- a/test/support/Casks/invalid/invalid-appcast-url.rb +++ b/test/support/Casks/invalid/invalid-appcast-url.rb @@ -1,5 +1,5 @@ class InvalidAppcastUrl < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-appcast-url' appcast 1, :sha256 => '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853', diff --git a/test/support/Casks/invalid/invalid-conflicts-with-key.rb b/test/support/Casks/invalid/invalid-conflicts-with-key.rb index e2c552e770a2..5a736900fffc 100644 --- a/test/support/Casks/invalid/invalid-conflicts-with-key.rb +++ b/test/support/Casks/invalid/invalid-conflicts-with-key.rb @@ -1,5 +1,5 @@ class InvalidConflictsWithKey < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-conflicts-with-key' conflicts_with :no_such_key => 'unar' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/invalid/invalid-depends-on-key.rb b/test/support/Casks/invalid/invalid-depends-on-key.rb index 8b6d25b84f9b..049f33d5fbcf 100644 --- a/test/support/Casks/invalid/invalid-depends-on-key.rb +++ b/test/support/Casks/invalid/invalid-depends-on-key.rb @@ -1,5 +1,5 @@ class InvalidDependsOnKey < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-depends-on-key' depends_on :no_such_key => 'unar' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/invalid/invalid-gpg-conflicting-keys.rb b/test/support/Casks/invalid/invalid-gpg-conflicting-keys.rb index e57be49cf5b1..91f6622317ee 100644 --- a/test/support/Casks/invalid/invalid-gpg-conflicting-keys.rb +++ b/test/support/Casks/invalid/invalid-gpg-conflicting-keys.rb @@ -1,5 +1,5 @@ class InvalidGpgConflictingKeys < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-gpg-conflicting-keys' gpg 'http://example.com/gpg-signature.asc', :key_id => 'ID', diff --git a/test/support/Casks/invalid/invalid-gpg-key-url.rb b/test/support/Casks/invalid/invalid-gpg-key-url.rb index 5d7856be31c6..4f748d87bc0b 100644 --- a/test/support/Casks/invalid/invalid-gpg-key-url.rb +++ b/test/support/Casks/invalid/invalid-gpg-key-url.rb @@ -1,5 +1,5 @@ class InvalidGpgKeyUrl < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-gpg-key-url' gpg 'http://example.com/gpg-signature.asc', :key_url => 1 diff --git a/test/support/Casks/invalid/invalid-gpg-missing-key.rb b/test/support/Casks/invalid/invalid-gpg-missing-key.rb index 338ed98bb1d6..6a63378bb3fb 100644 --- a/test/support/Casks/invalid/invalid-gpg-missing-key.rb +++ b/test/support/Casks/invalid/invalid-gpg-missing-key.rb @@ -1,5 +1,5 @@ class InvalidGpgMissingKeys < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-gpg-missing-keys' gpg 'http://example.com/gpg-signature.asc' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/invalid/invalid-gpg-multiple-stanzas.rb b/test/support/Casks/invalid/invalid-gpg-multiple-stanzas.rb index f5d4fdf71e13..6b684dd33930 100644 --- a/test/support/Casks/invalid/invalid-gpg-multiple-stanzas.rb +++ b/test/support/Casks/invalid/invalid-gpg-multiple-stanzas.rb @@ -1,5 +1,5 @@ class InvalidGpgMultipleStanzas < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-gpg-multiple-stanzas' gpg 'http://example.com/gpg-signature.asc', :key_id => 'ID' diff --git a/test/support/Casks/invalid/invalid-gpg-parameter.rb b/test/support/Casks/invalid/invalid-gpg-parameter.rb index acdf12c79c48..66253c46e282 100644 --- a/test/support/Casks/invalid/invalid-gpg-parameter.rb +++ b/test/support/Casks/invalid/invalid-gpg-parameter.rb @@ -1,5 +1,5 @@ class InvalidGpgParameter < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-gpg-type' gpg 'http://example.com/gpg-signature.asc', :no_such_parameter => :value diff --git a/test/support/Casks/invalid/invalid-gpg-signature-url.rb b/test/support/Casks/invalid/invalid-gpg-signature-url.rb index 31e5f2baab3d..6feaa39a7c36 100644 --- a/test/support/Casks/invalid/invalid-gpg-signature-url.rb +++ b/test/support/Casks/invalid/invalid-gpg-signature-url.rb @@ -1,5 +1,5 @@ class InvalidGpgSignatureUrl < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-gpg-signature-url' gpg 1, :key_id => 'ID' diff --git a/test/support/Casks/invalid/invalid-gpg-type.rb b/test/support/Casks/invalid/invalid-gpg-type.rb index acdf12c79c48..66253c46e282 100644 --- a/test/support/Casks/invalid/invalid-gpg-type.rb +++ b/test/support/Casks/invalid/invalid-gpg-type.rb @@ -1,5 +1,5 @@ class InvalidGpgParameter < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-gpg-type' gpg 'http://example.com/gpg-signature.asc', :no_such_parameter => :value diff --git a/test/support/Casks/invalid/invalid-license-multiple.rb b/test/support/Casks/invalid/invalid-license-multiple.rb index 15d9a5bb7363..07db20281246 100644 --- a/test/support/Casks/invalid/invalid-license-multiple.rb +++ b/test/support/Casks/invalid/invalid-license-multiple.rb @@ -1,5 +1,5 @@ class InvalidLicenseMultiple < TestCask - url TestHelper.local_binary('transmission-2.61.dmg') + url TestHelper.local_binary_url('transmission-2.61.dmg') homepage 'http://example.com/invalid-license-multiple' license :gpl license :gpl diff --git a/test/support/Casks/invalid/invalid-license-value.rb b/test/support/Casks/invalid/invalid-license-value.rb index 95ea0184d328..9562bd23ac8c 100644 --- a/test/support/Casks/invalid/invalid-license-value.rb +++ b/test/support/Casks/invalid/invalid-license-value.rb @@ -1,5 +1,5 @@ class InvalidLicenseValue < TestCask - url TestHelper.local_binary('transmission-2.61.dmg') + url TestHelper.local_binary_url('transmission-2.61.dmg') homepage 'http://example.com/invalid-license-value' license :no_such_license version '2.61' diff --git a/test/support/Casks/invalid/invalid-tags-key.rb b/test/support/Casks/invalid/invalid-tags-key.rb index 7b6ba7d304ac..3b7b60e063f1 100644 --- a/test/support/Casks/invalid/invalid-tags-key.rb +++ b/test/support/Casks/invalid/invalid-tags-key.rb @@ -1,5 +1,5 @@ class InvalidTagsKey < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-tags-key' tags :no_such_key => 'ExampleSoft' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/invalid/invalid-tags-multiple.rb b/test/support/Casks/invalid/invalid-tags-multiple.rb index 170c4df22c6d..eed30e8652d5 100644 --- a/test/support/Casks/invalid/invalid-tags-multiple.rb +++ b/test/support/Casks/invalid/invalid-tags-multiple.rb @@ -1,5 +1,5 @@ class InvalidTagsMultiple < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/invalid-tags-multiple' tags :vendor => 'ExampleSoft' tags :vendor => 'ExampleSoft' diff --git a/test/support/Casks/invalid/invalid-two-homepage.rb b/test/support/Casks/invalid/invalid-two-homepage.rb index 2ed0e10a5841..aad91225118d 100644 --- a/test/support/Casks/invalid/invalid-two-homepage.rb +++ b/test/support/Casks/invalid/invalid-two-homepage.rb @@ -1,5 +1,5 @@ class InvalidTwoHomepage < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' homepage 'http://www.example.com/local-caffeine' version '1.2.3' diff --git a/test/support/Casks/invalid/invalid-two-url.rb b/test/support/Casks/invalid/invalid-two-url.rb index 1220571731cd..fdc6ad54ce78 100644 --- a/test/support/Casks/invalid/invalid-two-url.rb +++ b/test/support/Casks/invalid/invalid-two-url.rb @@ -1,5 +1,5 @@ class InvalidTwoUrl < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') url 'http://example.com/caffeine.zip' homepage 'http://example.com/local-caffeine' version '1.2.3' diff --git a/test/support/Casks/invalid/invalid-two-version.rb b/test/support/Casks/invalid/invalid-two-version.rb index 5ed1d603e1df..b49a5c2e51da 100644 --- a/test/support/Casks/invalid/invalid-two-version.rb +++ b/test/support/Casks/invalid/invalid-two-version.rb @@ -1,5 +1,5 @@ class InvalidTwoVersion < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' version '2.0' diff --git a/test/support/Casks/local-caffeine.rb b/test/support/Casks/local-caffeine.rb index 47518a897f05..0720dd0cc421 100644 --- a/test/support/Casks/local-caffeine.rb +++ b/test/support/Casks/local-caffeine.rb @@ -1,5 +1,5 @@ class LocalCaffeine < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/local-transmission.rb b/test/support/Casks/local-transmission.rb index 9576362db9c8..b4138e306305 100644 --- a/test/support/Casks/local-transmission.rb +++ b/test/support/Casks/local-transmission.rb @@ -1,5 +1,5 @@ class LocalTransmission < TestCask - url TestHelper.local_binary('transmission-2.61.dmg') + url TestHelper.local_binary_url('transmission-2.61.dmg') homepage 'http://example.com/local-transmission' version '2.61' sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f' diff --git a/test/support/Casks/missing-checksum.rb b/test/support/Casks/missing-checksum.rb index d1b08fbbcbf8..0a1c55afbf99 100644 --- a/test/support/Casks/missing-checksum.rb +++ b/test/support/Casks/missing-checksum.rb @@ -1,5 +1,5 @@ class MissingChecksum < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' app 'Caffeine.app' diff --git a/test/support/Casks/naked-executable-dsl-one.rb b/test/support/Casks/naked-executable-dsl-one.rb index 20d0a482ec74..d07bddfa7652 100644 --- a/test/support/Casks/naked-executable-dsl-one.rb +++ b/test/support/Casks/naked-executable-dsl-one.rb @@ -2,7 +2,7 @@ class NakedExecutableDslOne < TestCask # todo: This Cask can be removed after DSL 1.0 transition, # b/c the main Cask naked-executable.rb will be # adopting this syntax. - url TestHelper.local_binary('naked_executable') + url TestHelper.local_binary_url('naked_executable') homepage 'http://example.com/naked-executable' version '1.2.3' sha256 '306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb' diff --git a/test/support/Casks/naked-executable.rb b/test/support/Casks/naked-executable.rb index 13c8c74d5f6a..e6fcaa3a6b3f 100644 --- a/test/support/Casks/naked-executable.rb +++ b/test/support/Casks/naked-executable.rb @@ -1,5 +1,5 @@ class NakedExecutable < TestCask - url TestHelper.local_binary('naked_executable') + url TestHelper.local_binary_url('naked_executable') homepage 'http://example.com/naked-executable' version '1.2.3' sha256 '306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb' diff --git a/test/support/Casks/naked-pkg.rb b/test/support/Casks/naked-pkg.rb index 6a5a6059f0b8..a0dee1b86da3 100644 --- a/test/support/Casks/naked-pkg.rb +++ b/test/support/Casks/naked-pkg.rb @@ -1,5 +1,5 @@ class NakedPkg < TestCask - url TestHelper.local_binary('Naked.pkg') + url TestHelper.local_binary_url('Naked.pkg') homepage 'http://example.com/naked-pkg' version '1.2.3' sha256 '611c50c8a2a2098951d2cd0fd54787ed81b92cd97b4b08bd7cba17f1e1d8e40b' diff --git a/test/support/Casks/nested-app-dsl-one.rb b/test/support/Casks/nested-app-dsl-one.rb index 85f07dd7e24d..a2ef47dd5a50 100644 --- a/test/support/Casks/nested-app-dsl-one.rb +++ b/test/support/Casks/nested-app-dsl-one.rb @@ -2,7 +2,7 @@ class NestedAppDslOne < TestCask # todo: This Cask can be removed after DSL 1.0 transition, # b/c the main Cask nested-app.rb will be # adopting this syntax. - url TestHelper.local_binary('NestedApp.dmg.zip') + url TestHelper.local_binary_url('NestedApp.dmg.zip') homepage 'http://example.com/nested-app' version '1.2.3' sha256 '1866dfa833b123bb8fe7fa7185ebf24d28d300d0643d75798bc23730af734216' diff --git a/test/support/Casks/nested-app.rb b/test/support/Casks/nested-app.rb index f5554844c6e2..1e8080fba6e2 100644 --- a/test/support/Casks/nested-app.rb +++ b/test/support/Casks/nested-app.rb @@ -1,5 +1,5 @@ class NestedApp < TestCask - url TestHelper.local_binary('NestedApp.dmg.zip') + url TestHelper.local_binary_url('NestedApp.dmg.zip') homepage 'http://example.com/nested-app' version '1.2.3' sha256 '1866dfa833b123bb8fe7fa7185ebf24d28d300d0643d75798bc23730af734216' diff --git a/test/support/Casks/no-checksum.rb b/test/support/Casks/no-checksum.rb index 5f8638822503..c902941ac267 100644 --- a/test/support/Casks/no-checksum.rb +++ b/test/support/Casks/no-checksum.rb @@ -1,5 +1,5 @@ class NoChecksum < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 :no_check diff --git a/test/support/Casks/rar-container.rb b/test/support/Casks/rar-container.rb index 85921f8eac15..ac859653db51 100644 --- a/test/support/Casks/rar-container.rb +++ b/test/support/Casks/rar-container.rb @@ -1,5 +1,5 @@ class RarContainer < TestCask - url TestHelper.local_binary('rarcontainer.rar') + url TestHelper.local_binary_url('rarcontainer.rar') homepage 'http://example.com/rar-container' version '1.2.3' sha256 '35fb13fb13e6aefc38b60486627eff6b6b55b2f99f64bf47938530c6cf9e0a0f' diff --git a/test/support/Casks/sevenzip-container.rb b/test/support/Casks/sevenzip-container.rb index 43c1195ff9cb..32e8bc8efad8 100644 --- a/test/support/Casks/sevenzip-container.rb +++ b/test/support/Casks/sevenzip-container.rb @@ -1,5 +1,5 @@ class SevenzipContainer < TestCask - url TestHelper.local_binary('sevenzipcontainer.7z') + url TestHelper.local_binary_url('sevenzipcontainer.7z') homepage 'http://example.com/sevenzip-container' version '1.2.3' sha256 '1550701e7848fcb94f5b0085cca527083a8662ddeb8c0a7bc5af6bd145797cc1' diff --git a/test/support/Casks/stuffit-container.rb b/test/support/Casks/stuffit-container.rb index 3b0eda0571f1..91f21cc198a7 100644 --- a/test/support/Casks/stuffit-container.rb +++ b/test/support/Casks/stuffit-container.rb @@ -1,5 +1,5 @@ class StuffitContainer < TestCask - url TestHelper.local_binary('sheldonmac.sit') + url TestHelper.local_binary_url('sheldonmac.sit') homepage 'http://www.tobias-jung.de/seekingprofont/' version '1.2.3' sha256 '892b6d49a98c546381d41dec9b0bbc04267ac008d72b99755968d357099993b7' diff --git a/test/support/Casks/tarball.rb b/test/support/Casks/tarball.rb index e7a1c1fd90e1..e429255dd4ba 100644 --- a/test/support/Casks/tarball.rb +++ b/test/support/Casks/tarball.rb @@ -1,5 +1,5 @@ class Tarball < TestCask - url TestHelper.local_binary('tarball.tgz') + url TestHelper.local_binary_url('tarball.tgz') homepage 'http://example.com/tarball' version '1.2.3' sha256 :no_check diff --git a/test/support/Casks/with-alt-target.rb b/test/support/Casks/with-alt-target.rb index b6b314409980..65a252d8cced 100644 --- a/test/support/Casks/with-alt-target.rb +++ b/test/support/Casks/with-alt-target.rb @@ -1,5 +1,5 @@ class WithAltTarget < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/with-appcast.rb b/test/support/Casks/with-appcast.rb index 36fc075b5cd7..8ea83dec4a3f 100644 --- a/test/support/Casks/with-appcast.rb +++ b/test/support/Casks/with-appcast.rb @@ -1,5 +1,5 @@ class WithAppcast < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/with-appcast' appcast 'http://example.com/appcast.xml', :sha256 => '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853', diff --git a/test/support/Casks/with-binary.rb b/test/support/Casks/with-binary.rb index 4beb5531add9..40fd960663e5 100644 --- a/test/support/Casks/with-binary.rb +++ b/test/support/Casks/with-binary.rb @@ -1,5 +1,5 @@ class WithBinary < TestCask - url TestHelper.local_binary('AppWithBinary.zip') + url TestHelper.local_binary_url('AppWithBinary.zip') homepage 'http://example.com/with-binary' sha256 'd5b2dfbef7ea28c25f7a77cd7fa14d013d82b626db1d82e00e25822464ba19e2' version '1.2.3' diff --git a/test/support/Casks/with-caveats.rb b/test/support/Casks/with-caveats.rb index c2c257953b82..700de49bee35 100644 --- a/test/support/Casks/with-caveats.rb +++ b/test/support/Casks/with-caveats.rb @@ -1,5 +1,5 @@ class WithCaveats < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/with-conditional-caveats.rb b/test/support/Casks/with-conditional-caveats.rb index 1a185850f59d..38d4371001d2 100644 --- a/test/support/Casks/with-conditional-caveats.rb +++ b/test/support/Casks/with-conditional-caveats.rb @@ -1,5 +1,5 @@ class WithConditionalCaveats < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/with-conflicts-with.rb b/test/support/Casks/with-conflicts-with.rb index 0f48f9ca43bc..86c17094b3e8 100644 --- a/test/support/Casks/with-conflicts-with.rb +++ b/test/support/Casks/with-conflicts-with.rb @@ -1,5 +1,5 @@ class WithConflictsWith < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/with-conflicts-with' conflicts_with :formula => 'unar' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/with-depends-on.rb b/test/support/Casks/with-depends-on.rb index 3bbb35e87072..73fb72ea631e 100644 --- a/test/support/Casks/with-depends-on.rb +++ b/test/support/Casks/with-depends-on.rb @@ -1,5 +1,5 @@ class WithDependsOn < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/with-depends-on' depends_on :formula => 'unar' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/with-gpg-key-url.rb b/test/support/Casks/with-gpg-key-url.rb index 9e2268931d41..3e4c7618391f 100644 --- a/test/support/Casks/with-gpg-key-url.rb +++ b/test/support/Casks/with-gpg-key-url.rb @@ -1,5 +1,5 @@ class WithGpgKeyUrl < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/with-gpg-key-url' gpg 'http://example.com/gpg-signature.asc', :key_url => 'http://example.com/gpg-key-url' diff --git a/test/support/Casks/with-gpg.rb b/test/support/Casks/with-gpg.rb index 5fd560ee068e..cb5785084bc6 100644 --- a/test/support/Casks/with-gpg.rb +++ b/test/support/Casks/with-gpg.rb @@ -1,5 +1,5 @@ class WithGpg < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/with-gpg' gpg 'http://example.com/gpg-signature.asc', :key_id => 'ID' diff --git a/test/support/Casks/with-install-script.rb b/test/support/Casks/with-install-script.rb index c11415b9dc11..f8af56ea5739 100644 --- a/test/support/Casks/with-install-script.rb +++ b/test/support/Casks/with-install-script.rb @@ -1,5 +1,5 @@ class WithInstallScript < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/with-install-script' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/with-installable.rb b/test/support/Casks/with-installable.rb index 2c1dc9f7f62d..092075e4d7da 100644 --- a/test/support/Casks/with-installable.rb +++ b/test/support/Casks/with-installable.rb @@ -1,5 +1,5 @@ class WithInstallable < TestCask - url TestHelper.local_binary('MyFancyPkg.zip') + url TestHelper.local_binary_url('MyFancyPkg.zip') homepage 'http://example.com/fancy-pkg' version '1.2.3' sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' @@ -11,5 +11,6 @@ class WithInstallable < TestCask '~/impermissible/path/with/tilde', 'impermissible/relative/path', '/another/impermissible/../relative/path', - ] + ], + :rmdir => TestHelper.local_binary_path('empty_directory') end diff --git a/test/support/Casks/with-license.rb b/test/support/Casks/with-license.rb index fd24326a96ea..5db695357f53 100644 --- a/test/support/Casks/with-license.rb +++ b/test/support/Casks/with-license.rb @@ -1,5 +1,5 @@ class WithLicense < TestCask - url TestHelper.local_binary('transmission-2.61.dmg') + url TestHelper.local_binary_url('transmission-2.61.dmg') homepage 'http://example.com/with-license' license :gpl version '2.61' diff --git a/test/support/Casks/with-macosx-dir.rb b/test/support/Casks/with-macosx-dir.rb index b88f91dff793..1341217e8c76 100644 --- a/test/support/Casks/with-macosx-dir.rb +++ b/test/support/Casks/with-macosx-dir.rb @@ -1,5 +1,5 @@ class WithMacosxDir < TestCask - url TestHelper.local_binary('MyFancyApp.zip') + url TestHelper.local_binary_url('MyFancyApp.zip') homepage 'http://example.com/MyFancyApp' version '1.2.3' sha256 '5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d' diff --git a/test/support/Casks/with-pkgutil-uninstall.rb b/test/support/Casks/with-pkgutil-uninstall.rb index 0fd7cfc58c55..4832545759ee 100644 --- a/test/support/Casks/with-pkgutil-uninstall.rb +++ b/test/support/Casks/with-pkgutil-uninstall.rb @@ -1,5 +1,5 @@ class WithPkgutilUninstall < TestCask - url TestHelper.local_binary('MyFancyPkg.zip') + url TestHelper.local_binary_url('MyFancyPkg.zip') homepage 'http://example.com/fancy-pkg' version '1.2.3' sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' diff --git a/test/support/Casks/with-pkgutil-zap.rb b/test/support/Casks/with-pkgutil-zap.rb index 64f0655a9a94..85ec44f14f57 100644 --- a/test/support/Casks/with-pkgutil-zap.rb +++ b/test/support/Casks/with-pkgutil-zap.rb @@ -1,5 +1,5 @@ class WithPkgutilZap < TestCask - url TestHelper.local_binary('MyFancyPkg.zip') + url TestHelper.local_binary_url('MyFancyPkg.zip') homepage 'http://example.com/fancy-pkg' version '1.2.3' sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' diff --git a/test/support/Casks/with-tags.rb b/test/support/Casks/with-tags.rb index abb009c77531..eda707c108b1 100644 --- a/test/support/Casks/with-tags.rb +++ b/test/support/Casks/with-tags.rb @@ -1,5 +1,5 @@ class WithTags < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/with-tags' tags :vendor => 'ExampleSoft' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/with-two-apps-correct.rb b/test/support/Casks/with-two-apps-correct.rb index 6a25fb4c4b34..2eee08f3a4f0 100644 --- a/test/support/Casks/with-two-apps-correct.rb +++ b/test/support/Casks/with-two-apps-correct.rb @@ -1,5 +1,5 @@ class WithTwoAppsCorrect < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/with-two-apps-incorrect.rb b/test/support/Casks/with-two-apps-incorrect.rb index 00d48f7fb152..69226cbf7be0 100644 --- a/test/support/Casks/with-two-apps-incorrect.rb +++ b/test/support/Casks/with-two-apps-incorrect.rb @@ -1,5 +1,5 @@ class WithTwoAppsIncorrect < TestCask - url TestHelper.local_binary('caffeine.zip') + url TestHelper.local_binary_url('caffeine.zip') homepage 'http://example.com/local-caffeine' version '1.2.3' sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853' diff --git a/test/support/Casks/with-zap.rb b/test/support/Casks/with-zap.rb index d4789ee69bba..ff0a8df9a6a8 100644 --- a/test/support/Casks/with-zap.rb +++ b/test/support/Casks/with-zap.rb @@ -1,5 +1,5 @@ class WithZap < TestCask - url TestHelper.local_binary('MyFancyPkg.zip') + url TestHelper.local_binary_url('MyFancyPkg.zip') homepage 'http://example.com/fancy-pkg' version '1.2.3' sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b' diff --git a/test/support/Casks/xar-container.rb b/test/support/Casks/xar-container.rb index e7f7bf7949cd..80843d4cefba 100644 --- a/test/support/Casks/xar-container.rb +++ b/test/support/Casks/xar-container.rb @@ -1,5 +1,5 @@ class XarContainer < TestCask - url TestHelper.local_binary('xarcontainer.xar') + url TestHelper.local_binary_url('xarcontainer.xar') homepage 'http://example.com/xar-container' version '1.2.3' sha256 '1418752ac49e859f88590db245015cb2f8b459f619e0c50fd6ff87b902c72ee1' diff --git a/test/support/binaries/empty_directory/.gitignore b/test/support/binaries/empty_directory/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/test/test_helper.rb b/test/test_helper.rb index 8fa1f4d03658..5d46abd0c28e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -65,10 +65,13 @@ def shutup Cask.caskroom = HOMEBREW_PREFIX.join('TestCaskroom') class TestHelper - # helper for test casks to reference local files easily - def self.local_binary(name) - path = File.expand_path(File.join(File.dirname(__FILE__), 'support', 'binaries', name)) - "file://#{path}" + # helpers for test casks to reference local files easily + def self.local_binary_path(name) + File.expand_path(File.join(File.dirname(__FILE__), 'support', 'binaries', name)) + end + + def self.local_binary_url(name) + 'file://' + local_binary_path(name) end def self.test_cask