diff options
| author | Vítor Galvão | 2017-01-23 01:03:19 +0000 |
|---|---|---|
| committer | Markus Reiter | 2017-01-23 15:30:44 +0100 |
| commit | 53e232fc7e2f5f9372ba9b544e01abf99f96c99c (patch) | |
| tree | 2f6fe002cbe829f42d83d29b171ee32ad761691c /Library/Homebrew/cask/lib | |
| parent | 2de6d96a10f00f6dc828711166a53b768f97bbab (diff) | |
| download | brew-53e232fc7e2f5f9372ba9b544e01abf99f96c99c.tar.bz2 | |
Add --calculate (print current checkpoint without it)
Diffstat (limited to 'Library/Homebrew/cask/lib')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb | 15 |
1 files changed, 10 insertions, 5 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 6de76cbc7..fc2d1049f 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/internal_appcast_checkpoint.rb @@ -2,13 +2,14 @@ module Hbc class CLI class InternalAppcastCheckpoint < InternalUseBase def self.run(*args) + calculate = args.include? "--calculate" cask_tokens = cask_tokens_from(args) raise CaskUnspecifiedError if cask_tokens.empty? - appcask_checkpoint(cask_tokens) + appcask_checkpoint(cask_tokens, calculate) end - def self.appcask_checkpoint(cask_tokens) + def self.appcask_checkpoint(cask_tokens, calculate) count = 0 cask_tokens.each do |cask_token| @@ -17,9 +18,13 @@ module Hbc if cask.appcast.nil? opoo "Cask '#{cask}' is missing an `appcast` stanza." else - result = cask.appcast.calculate_checkpoint + if calculate + result = cask.appcast.calculate_checkpoint - checkpoint = result[:checkpoint] + checkpoint = result[:checkpoint] + else + checkpoint = cask.appcast.checkpoint + end if checkpoint.nil? onoe "Could not retrieve `appcast` checkpoint for cask '#{cask}': #{result[:command_result].stderr}" @@ -34,7 +39,7 @@ module Hbc end def self.help - "calculates a given Cask's appcast checkpoint" + "prints (no flag) or calculates ('--calculate') a given Cask's appcast checkpoint" end def self.needs_init? |
