Skip to content
Snippets Groups Projects
Commit c2c21eda authored by Jonas Pfenniger's avatar Jonas Pfenniger Committed by Adam Vandenberg
Browse files

brew up: star installed formulae


When running `brew up`, if a mentioned formulae is also installed,
it will get a wildcard start at the end.
It makes it easier to see if any installed formulae is impacted.

Signed-off-by: default avatarAdam Vandenberg <flangy@gmail.com>
parent 163c1c52
No related branches found
No related tags found
No related merge requests found
......@@ -29,11 +29,12 @@ class RefreshBrew
UPDATED_EXAMPLE = %r{^\s+#{example_regexp}}
DELETED_EXAMPLE = %r{^\s+delete mode \d+ #{example_regexp}$}
attr_reader :added_formulae, :updated_formulae, :deleted_formulae, :initial_revision
attr_reader :added_formulae, :updated_formulae, :deleted_formulae, :installed_formulae
attr_reader :added_examples, :updated_examples, :deleted_examples
attr_reader :initial_revision
def initialize
@added_formulae, @updated_formulae, @deleted_formulae = [], [], []
@added_formulae, @updated_formulae, @deleted_formulae, @installed_formulae = [], [], [], []
@added_examples, @updated_examples, @deleted_examples = [], [], []
@initial_revision = self.current_revision
end
......@@ -73,6 +74,9 @@ class RefreshBrew
@added_examples.sort!
@updated_examples.sort!
@deleted_examples.sort!
@installed_formulae = HOMEBREW_CELLAR.children.
select{ |pn| pn.directory? }.
map{ |pn| pn.basename.to_s }.sort
output.strip != GIT_UP_TO_DATE
end
......@@ -117,12 +121,12 @@ class RefreshBrew
## Deleted Formulae
if deleted_formulae?
ohai "The following formulae were removed:"
puts_columns deleted_formulae
puts_columns deleted_formulae, installed_formulae
end
## Updated Formulae
if pending_formulae_changes?
ohai "The following formulae were updated:"
puts_columns updated_formulae
puts_columns updated_formulae, installed_formulae
else
puts "No formulae were updated."
end
......
......@@ -97,9 +97,13 @@ def curl *args
safe_system '/usr/bin/curl', '-f#LA', HOMEBREW_USER_AGENT, *args unless args.empty?
end
def puts_columns items
def puts_columns items, star_items=[]
return if items.empty?
if star_items && star_items.any?
items = items.map{|item| star_items.include?(item) ? "#{item}*" : item}
end
if $stdout.tty?
# determine the best width to display for different console sizes
console_width = `/bin/stty size`.chomp.split(" ").last.to_i
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment