diff options
| author | Markus Reiter | 2017-01-23 09:22:51 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-01-23 15:48:20 +0100 |
| commit | 2d5b659b0e4ba396f133156d368afc4fa1b8373c (patch) | |
| tree | b4aedf2b47d442f42a69bfcd5be868d838a29482 /Library | |
| parent | 53e232fc7e2f5f9372ba9b544e01abf99f96c99c (diff) | |
| download | brew-2d5b659b0e4ba396f133156d368afc4fa1b8373c.tar.bz2 | |
Add support for calculating appcast checkpoint from URLs.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb index fc2d1049f..915ec314b 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb @@ -6,7 +6,18 @@ module Hbc cask_tokens = cask_tokens_from(args) raise CaskUnspecifiedError if cask_tokens.empty? - appcask_checkpoint(cask_tokens, calculate) + if cask_tokens.all? { |t| t =~ %r{^https?://} && t !~ /\.rb$/ } + appcask_checkpoint_for_url(cask_tokens) + else + appcask_checkpoint(cask_tokens, calculate) + end + end + + def self.appcask_checkpoint_for_url(urls) + urls.each do |url| + appcast = DSL::Appcast.new(url) + puts appcast.calculate_checkpoint[:checkpoint] + end end def self.appcask_checkpoint(cask_tokens, calculate) @@ -39,7 +50,7 @@ module Hbc end def self.help - "prints (no flag) or calculates ('--calculate') a given Cask's appcast checkpoint" + "prints (no flag) or calculates ('--calculate') a given Cask's (or URL's) appcast checkpoint" end def self.needs_init? |
