Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

brew reinstall: Reuse options from last time

Now, we can finally stop stuggesting to
    `brew rm <foo>` and then `brew install <foo> <with-your-preferred options>

So `brew reinstall` will honor all options that have been recorded
into the INSTALL_RECEIPT.json plus if `--build-bottle` was used.
  • Loading branch information...
commit de885ecdb0889d1246eda3621cb5d89d46130b7e 1 parent 5d840c0
@samueljohn samueljohn authored
Showing with 18 additions and 2 deletions.
  1. +18 −2 Library/Homebrew/cmd/reinstall.rb
View
20 Library/Homebrew/cmd/reinstall.rb
@@ -3,7 +3,23 @@
module Homebrew extend self
def reinstall
- self.uninstall
- self.install
+ # At first save the named formulae and remove them from ARGV
+ named = ARGV.named
+ ARGV.delete_if { |arg| named.include? arg }
+ clean_ARGV = ARGV.clone
+
+ # Add the used_options for each named formula separately so
+ # that the options apply to the right formula.
+ named.each do |name|
+ ARGV.replace(clean_ARGV)
+ ARGV << name
+ tab = Tab.for_name(name)
+ tab.used_options.each { |option| ARGV << option.to_s }
+ ARGV << '--build-bottle' if tab.built_as_bottle
@mikemcquaid Owner

@samueljohn This doesn't do what you think; it means if someone has e.g. boost installed from a bottle then brew reinstall will try and build a new bottle rather than reinstalling the bottle. Fixing.

Oh, sorry. Remove this line entirely?

@mikemcquaid Owner

It's ok, fixed it in 1fd941d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ # Todo: Be as smart as upgrade to restore the old state if reinstall fails.
+ self.uninstall
+ oh1 "Reinstalling #{name} #{ARGV.options_only*' '}"
+ self.install
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.