Skip to content

Commit

Permalink
Ignore casks with 'auto_updates true' unless --all
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/bcu.rb
#	lib/extend/hbc.rb
  • Loading branch information
jawshooah authored and buo committed Mar 23, 2017
1 parent 6aa7e00 commit 40baf90
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Options:

```
Usage: brew cu [CASK] [options]
-a, --all Force upgrade outdated apps including the ones marked as latest
-a, --all Force upgrade outdated apps including those marked as latest and those that auto-update
--cleanup Cleans up cached downloads and tracker symlinks after updating
-y, --yes Update all outdated apps; answer yes to updating packages
--h Show this message
Expand Down
4 changes: 2 additions & 2 deletions lib/bcu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def self.find_outdated_apps
row << app[:token]
row << app[:current].join(", ")
row << app[:version]
if options.all && app[:version] == "latest"
if options.all && (app[:version] == "latest" || app[:auto_updates])
row << "forced to upgrade"
outdated.push app
elsif app[:outdated?]
Expand All @@ -92,7 +92,7 @@ def self.print_outdated_app(outdated)
row << app[:token]
row << app[:current].join(", ")
row << app[:version]
if options.all && app[:version] == "latest"
if options.all && (app[:version] == "latest" || app[:auto_updates])
row << "forced to upgrade"
elsif app[:outdated?]
row << "outdated"
Expand Down
2 changes: 1 addition & 1 deletion lib/bcu/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def self.parse!(args)
parser = OptionParser.new do |opts|
opts.banner = "Usage: brew cu [CASK] [options]"

opts.on("-a", "--all", "Force upgrade outdated apps including the ones marked as latest") do
opts.on("-a", "--all", "Force upgrade outdated apps including those marked as latest and those that auto-update") do
options.all = true
end

Expand Down
2 changes: 2 additions & 0 deletions lib/extend/hbc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def self.installed_apps
:version => cask.version.to_s,
:current => versions,
:outdated? => cask.instance_of?(Cask) && !versions.include?(cask.version.to_s),
:auto_updates => cask.auto_updates,
}
rescue Hbc::CaskUnavailableError
{
Expand All @@ -26,6 +27,7 @@ def self.installed_apps
:version => nil,
:current => versions,
:outdated? => false,
:auto_updates => false,
}
end
end
Expand Down

0 comments on commit 40baf90

Please sign in to comment.