diff options
| author | Valentin VĂLCIU | 2017-02-27 22:33:34 +0200 | 
|---|---|---|
| committer | Valentin VĂLCIU | 2017-03-15 22:58:25 +0200 | 
| commit | 7532545140c1ce0da370b2b3124e488dbb11fc41 (patch) | |
| tree | d7d4862de884d9996dd30eb22c0393592863d7a1 /Library/Homebrew/cask/lib/hbc/cask.rb | |
| parent | 4d88cc4c41113be2d5bf11c11fa671c763705a64 (diff) | |
| download | brew-7532545140c1ce0da370b2b3124e488dbb11fc41.tar.bz2 | |
add command 'cask outdated'
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cask.rb')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cask.rb | 24 | 
1 files changed, 24 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cask.rb b/Library/Homebrew/cask/lib/hbc/cask.rb index 3f8da25b7..cf5f2b37a 100644 --- a/Library/Homebrew/cask/lib/hbc/cask.rb +++ b/Library/Homebrew/cask/lib/hbc/cask.rb @@ -89,6 +89,30 @@ module Hbc        metadata_master_container_path.join(*installed_version, "Casks", "#{token}.rb")      end +    def outdated?(greedy = false) +      !outdated_versions(greedy).empty? +    end + +    def outdated_versions(greedy = false) +      # special case: tap version is not available +      return [] if version.nil? + +      if greedy +        return versions if version.latest? +      elsif auto_updates +        return [] +      end + +      installed = versions +      current   = installed.last + +      # not outdated unless there is a different version on tap +      return [] if current == version + +      # collect all installed versions that are different than tap version and return them +      installed.select { |v| v != version } +    end +      def to_s        @token      end  | 
