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: Adam Vandenberg <flangy@gmail.com>
This commit is contained in:
parent
163c1c52d0
commit
c2c21edae4
@ -29,11 +29,12 @@ class RefreshBrew
|
|||||||
UPDATED_EXAMPLE = %r{^\s+#{example_regexp}}
|
UPDATED_EXAMPLE = %r{^\s+#{example_regexp}}
|
||||||
DELETED_EXAMPLE = %r{^\s+delete mode \d+ #{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 :added_examples, :updated_examples, :deleted_examples
|
||||||
|
attr_reader :initial_revision
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@added_formulae, @updated_formulae, @deleted_formulae = [], [], []
|
@added_formulae, @updated_formulae, @deleted_formulae, @installed_formulae = [], [], [], []
|
||||||
@added_examples, @updated_examples, @deleted_examples = [], [], []
|
@added_examples, @updated_examples, @deleted_examples = [], [], []
|
||||||
@initial_revision = self.current_revision
|
@initial_revision = self.current_revision
|
||||||
end
|
end
|
||||||
@ -73,6 +74,9 @@ class RefreshBrew
|
|||||||
@added_examples.sort!
|
@added_examples.sort!
|
||||||
@updated_examples.sort!
|
@updated_examples.sort!
|
||||||
@deleted_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
|
output.strip != GIT_UP_TO_DATE
|
||||||
end
|
end
|
||||||
@ -117,12 +121,12 @@ class RefreshBrew
|
|||||||
## Deleted Formulae
|
## Deleted Formulae
|
||||||
if deleted_formulae?
|
if deleted_formulae?
|
||||||
ohai "The following formulae were removed:"
|
ohai "The following formulae were removed:"
|
||||||
puts_columns deleted_formulae
|
puts_columns deleted_formulae, installed_formulae
|
||||||
end
|
end
|
||||||
## Updated Formulae
|
## Updated Formulae
|
||||||
if pending_formulae_changes?
|
if pending_formulae_changes?
|
||||||
ohai "The following formulae were updated:"
|
ohai "The following formulae were updated:"
|
||||||
puts_columns updated_formulae
|
puts_columns updated_formulae, installed_formulae
|
||||||
else
|
else
|
||||||
puts "No formulae were updated."
|
puts "No formulae were updated."
|
||||||
end
|
end
|
||||||
|
|||||||
@ -97,9 +97,13 @@ def curl *args
|
|||||||
safe_system '/usr/bin/curl', '-f#LA', HOMEBREW_USER_AGENT, *args unless args.empty?
|
safe_system '/usr/bin/curl', '-f#LA', HOMEBREW_USER_AGENT, *args unless args.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def puts_columns items
|
def puts_columns items, star_items=[]
|
||||||
return if items.empty?
|
return if items.empty?
|
||||||
|
|
||||||
|
if star_items && star_items.any?
|
||||||
|
items = items.map{|item| star_items.include?(item) ? "#{item}*" : item}
|
||||||
|
end
|
||||||
|
|
||||||
if $stdout.tty?
|
if $stdout.tty?
|
||||||
# determine the best width to display for different console sizes
|
# determine the best width to display for different console sizes
|
||||||
console_width = `/bin/stty size`.chomp.split(" ").last.to_i
|
console_width = `/bin/stty size`.chomp.split(" ").last.to_i
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user