cask info: display auto_updates

This commit is contained in:
commitay 2018-06-15 16:16:55 +10:00
parent b7e849799f
commit 6d1f99fa5f
3 changed files with 34 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

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