diff --git a/Library/Homebrew/cask/lib/hbc/cli/info.rb b/Library/Homebrew/cask/lib/hbc/cli/info.rb index 991f0534ae..5339742d13 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/info.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/info.rb @@ -18,7 +18,7 @@ module Hbc end def self.info(cask) - puts "#{cask.token}: #{cask.version}" + title_info(cask) puts Formatter.url(cask.homepage) if cask.homepage installation_info(cask) repo_info(cask) @@ -28,6 +28,12 @@ module Hbc Installer.print_caveats(cask) end + def self.title_info(cask) + title = "#{cask.token}: #{cask.version}" + title += " (auto_updates)" if cask.auto_updates + puts title + end + def self.formatted_url(url) "#{Tty.underline}#{url}#{Tty.reset}" end diff --git a/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb b/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb index 392b87575b..fc4f24ac09 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb @@ -26,6 +26,7 @@ module Hbc return end + ohai "Casks with `auto_updates` or `version :latest` will not be upgraded" if args.empty? oh1 "Upgrading #{Formatter.pluralize(outdated_casks.length, "outdated package")}, with result:" puts outdated_casks.map { |f| "#{f.full_name} #{f.version}" } * ", " diff --git a/Library/Homebrew/test/cask/cli/info_spec.rb b/Library/Homebrew/test/cask/cli/info_spec.rb index e3ece577ab..e2f82ec24f 100644 --- a/Library/Homebrew/test/cask/cli/info_spec.rb +++ b/Library/Homebrew/test/cask/cli/info_spec.rb @@ -20,6 +20,21 @@ describe Hbc::CLI::Info, :cask do EOS end + it "it prints auto_updates if the Cask has `auto_updates true`" do + expect { + described_class.run("with-auto-updates") + }.to output(<<~EOS).to_stdout + with-auto-updates: 1.0 (auto_updates) + http://example.com/autoupdates + Not installed + From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/with-auto-updates.rb + ==> Name + AutoUpdates + ==> Artifacts + AutoUpdates.app (App) + EOS + end + describe "given multiple Casks" do let(:expected_output) { <<~EOS diff --git a/Library/Homebrew/test/support/fixtures/cask/Casks/with-auto-updates.rb b/Library/Homebrew/test/support/fixtures/cask/Casks/with-auto-updates.rb new file mode 100644 index 0000000000..7bffbe6d77 --- /dev/null +++ b/Library/Homebrew/test/support/fixtures/cask/Casks/with-auto-updates.rb @@ -0,0 +1,12 @@ +cask 'with-auto-updates' do + version '1.0' + sha256 'e5be907a51cd0d5b128532284afe1c913608c584936a5e55d94c75a9f48c4322' + + url "https://example.com/autoupdates_#{version}.zip" + name 'AutoUpdates' + homepage 'http://example.com/autoupdates' + + auto_updates true + + app 'AutoUpdates.app' +end