Merge pull request #4343 from commitay/cask-info-updates

cask info: display `auto_updates`
This commit is contained in:
commitay 2018-07-16 09:32:17 +10:00 committed by GitHub
commit 43bfbe2060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 1 deletions

View File

@ -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

View File

@ -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}" } * ", "

View File

@ -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

View File

@ -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