Simon Sigurdhsson f8a88b5f28 brew-pin: prevent selected formulae from upgrade.
* Added `pin` et. al. to manpage.
* Added `brew pin` to `brew.1` * Added `brew unpin` to `brew.1`
* Added `brew list --pinned` to `brew.1`
* Added information about frozen formulae to `brew upgrade` in `brew.1`
* Added `pin` et.al. to completion scripts.
* Unpin formulae when uninstalling them
* Unpin and re-pin formulae when upgrading (avoids stale symlink)

References Homebrew/homebrew#18386.
Closes Homebrew/homebrew#18515.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-30 19:50:47 +00:00

17 lines
529 B
Ruby

require 'formula'
module Homebrew extend self
def unpin
if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
abort "Cowardly refusing to `sudo unpin'"
end
raise FormulaUnspecifiedError if ARGV.named.empty?
ARGV.formulae.each do |fmla|
f = Formula.factory(fmla.to_s)
onoe "Cannot unpin uninstalled formula #{f.name}!" unless f.pinable?
opoo "Formula #{f.name} already unpinned!" if f.pinable? and not f.pinned?
f.unpin if f.pinable? and f.pinned?
end
end
end