From 011f2b91987727ceabf73659fa4cb6563b275254 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Sun, 8 Feb 2015 07:20:41 -0600 Subject: [PATCH 1/3] [WIP] brew cask outdated --- lib/hbc/cli.rb | 1 + lib/hbc/cli/outdated.rb | 9 +++++++++ lib/hbc/scopes.rb | 10 ++++------ spec/cask/cli/outdated_spec.rb | 27 +++++++++++++++++++++++++++ spec/cask/scopes_spec.rb | 14 ++++++++++++++ 5 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 lib/hbc/cli/outdated.rb create mode 100644 spec/cask/cli/outdated_spec.rb diff --git a/lib/hbc/cli.rb b/lib/hbc/cli.rb index 91aaa03b348bb..83542f3d04424 100644 --- a/lib/hbc/cli.rb +++ b/lib/hbc/cli.rb @@ -16,6 +16,7 @@ class Hbc::CLI; end require 'hbc/cli/info' require 'hbc/cli/install' require 'hbc/cli/list' +require 'hbc/cli/outdated' require 'hbc/cli/search' require 'hbc/cli/uninstall' require 'hbc/cli/update' diff --git a/lib/hbc/cli/outdated.rb b/lib/hbc/cli/outdated.rb new file mode 100644 index 0000000000000..ea49796a46db6 --- /dev/null +++ b/lib/hbc/cli/outdated.rb @@ -0,0 +1,9 @@ +class Hbc::CLI::Outdated < Hbc::CLI::Base + def self.help + 'lists installed casks that have an upgraded version available' + end + + def self.run(*args) + puts Hbc.outdated.map(&:to_s) + end +end diff --git a/lib/hbc/scopes.rb b/lib/hbc/scopes.rb index d0489738fb1fc..ab0c1b33a1f7e 100644 --- a/lib/hbc/scopes.rb +++ b/lib/hbc/scopes.rb @@ -20,12 +20,6 @@ def all_tapped_cask_dirs @all_tapped_cask_dirs end - def reset_all_tapped_cask_dirs - # The memoized value should be reset when a Tap is added/removed - # (which is a rare event in our codebase). - @all_tapped_cask_dirs = nil - end - def all_tokens cask_tokens = all_tapped_cask_dirs.map { |d| Dir.glob d.join('*.rb') }.flatten cask_tokens.map { |c| @@ -58,5 +52,9 @@ def installed end end end + + def outdated + installed.select(&:outdated?) + end end end diff --git a/spec/cask/cli/outdated_spec.rb b/spec/cask/cli/outdated_spec.rb new file mode 100644 index 0000000000000..8f7380d23a9d0 --- /dev/null +++ b/spec/cask/cli/outdated_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +describe Hbc::CLI::Outdated do + describe '.help' do + it 'describes outdated properly' do + expect(described_class.help).to eq('lists installed casks that have an upgraded version available') + end + end + + describe '.run' do + let(:outdated_casks) {[ + double('Cask', to_s: 'pretty-old'), + double('Cask', to_s: 'cask-needs-upgrade-badly'), + ]} + before do + allow(Hbc).to receive(:outdated) { outdated_casks } + end + it 'lists the outdated casks' do + expect { + described_class.run + }.to output(<<-OUTPUT.gsub(/ */, '')).to_stdout + pretty-old + cask-needs-upgrade-badly + OUTPUT + end + end +end diff --git a/spec/cask/scopes_spec.rb b/spec/cask/scopes_spec.rb index 602a6d79e5d32..db30a1ea35e81 100644 --- a/spec/cask/scopes_spec.rb +++ b/spec/cask/scopes_spec.rb @@ -41,4 +41,18 @@ expect(Hbc).to have_received(:load).with(absolute_path_to_cask) end end + + describe 'outdated' do + let(:installed_casks) {[ + double('Cask', name: 'up-to-date', outdated?: false), + double('Cask', name: 'pretty-old', outdated?: true), + ]} + before do + allow(Hbc).to receive(:installed) { installed_casks } + end + + it 'returns the list of casks whose installed version does not match the latest available version' do + expect(Hbc.outdated.map(&:name)).to eq(%w[pretty-old]) + end + end end From 324cebbdfd45903de9d00018805460f6625cedc3 Mon Sep 17 00:00:00 2001 From: ehloj Date: Tue, 17 Mar 2015 22:17:08 +0000 Subject: [PATCH 2/3] Update Google Adwords Editor to 11.0.3 --- Casks/google-adwords-editor.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Casks/google-adwords-editor.rb b/Casks/google-adwords-editor.rb index 749b52559d044..3f46b7c4311dd 100644 --- a/Casks/google-adwords-editor.rb +++ b/Casks/google-adwords-editor.rb @@ -1,6 +1,6 @@ cask :v1 => 'google-adwords-editor' do - version '11.0.0' - sha256 '112bd8ba1789208da8c3200875d8719ec832d2533c299d3221a190cb98b4f7e7' + version '11.0.3' + sha256 '0294ef3fceff0cad0bc954c24afb20af36c01f8cbd4cc15e9aee43565dbb44bf' url "https://dl.google.com/adwords_editor/#{version}/Google_AdWords_Editor.dmg" name 'Google AdWords Editor' From 4ee381db61b9a38af684f9867a54830cffbe7d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Galv=C3=A3o?= Date: Wed, 18 Mar 2015 00:40:06 +0100 Subject: [PATCH 3/3] Revert "Update Google Adwords Editor to 11.0.3" --- Casks/google-adwords-editor.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Casks/google-adwords-editor.rb b/Casks/google-adwords-editor.rb index 3f46b7c4311dd..749b52559d044 100644 --- a/Casks/google-adwords-editor.rb +++ b/Casks/google-adwords-editor.rb @@ -1,6 +1,6 @@ cask :v1 => 'google-adwords-editor' do - version '11.0.3' - sha256 '0294ef3fceff0cad0bc954c24afb20af36c01f8cbd4cc15e9aee43565dbb44bf' + version '11.0.0' + sha256 '112bd8ba1789208da8c3200875d8719ec832d2533c299d3221a190cb98b4f7e7' url "https://dl.google.com/adwords_editor/#{version}/Google_AdWords_Editor.dmg" name 'Google AdWords Editor'