This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consequence: you can no longer install when something is already installed, you must upgrade it. This doesn't apply if the formula in question was unlinked. You can still --force installs though. Rationale: the old way of installing over the top would leave symlinks to multiple versions in /usr/local if the old version had a file the newer version didn't. The new upgrade command handles everything properly.
- Loading branch information
Showing
7 changed files
with
295 additions
and
221 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
require 'cmd/outdated' | ||
require 'cmd/install' | ||
|
||
class Fixnum | ||
def plural_s | ||
if self > 1 then "s" else "" end | ||
end | ||
end | ||
|
||
module Homebrew extend self | ||
def upgrade | ||
Homebrew.perform_preinstall_checks | ||
|
||
outdated = if ARGV.named.empty? | ||
Homebrew.outdated_brews | ||
else | ||
ARGV.formulae.map{ |f| [f.prefix.parent, f.name, f.version] } | ||
end | ||
|
||
if outdated.count > 1 | ||
oh1 "Upgrading #{outdated.count} outdated package#{outdated.count.plural_s}, with result:" | ||
puts outdated.map{ |_, name, version| "#{name} #{version}" } * ", " | ||
end | ||
|
||
outdated.each do |rack, name, version| | ||
installer = FormulaInstaller.new(Formula.factory(name)) | ||
installer.show_header = false | ||
oh1 "Upgrading #{name}" | ||
installer.install | ||
Keg.new("#{rack}/#{version}").unlink | ||
installer.caveats | ||
installer.finish # includes link step | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.