diff options
| author | Simon Sigurdhsson | 2013-03-11 16:41:08 +0100 | 
|---|---|---|
| committer | Mike McQuaid | 2013-03-30 19:50:47 +0000 | 
| commit | f8a88b5f28070b15eb31285f8ae6ffdd37e0859b (patch) | |
| tree | 73a2cf37557a5939357fb637843558a2a5ed47a3 /Library/Homebrew/cmd/unpin.rb | |
| parent | 4a52bf1c3186b75551cb37cbf721da185291c384 (diff) | |
| download | brew-f8a88b5f28070b15eb31285f8ae6ffdd37e0859b.tar.bz2 | |
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>
Diffstat (limited to 'Library/Homebrew/cmd/unpin.rb')
| -rw-r--r-- | Library/Homebrew/cmd/unpin.rb | 16 | 
1 files changed, 16 insertions, 0 deletions
| diff --git a/Library/Homebrew/cmd/unpin.rb b/Library/Homebrew/cmd/unpin.rb new file mode 100644 index 000000000..6855db4bf --- /dev/null +++ b/Library/Homebrew/cmd/unpin.rb @@ -0,0 +1,16 @@ +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 | 
