16 Commits

Author SHA1 Message Date
Markus Reiter
2d6ae61314 Re-revert "Fix operator spacing." 2017-06-02 19:22:05 +02:00
Mike McQuaid
6693915399 rubocop --auto-correct all remaining files.
But remove some manual `.freeze`s on constants that shouldn't be
constants.
2016-09-17 16:14:13 +01:00
Mike McQuaid
72d10fff0b Use constants for LinkedKegs/PinnedKegs/Locks.
These definitions are scattered throughout the codebase which makes it
hard to refactor them later (my goal is to move them outside of
HOMEBREW_LIBRARY). Unify their definitions for clearer code and easier
movement later.
2016-09-15 18:28:42 +01:00
Xu Cheng
a8566c9848 various: eliminate the usage of any? (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)).
2016-08-05 22:01:32 +08:00
Xu Cheng
fade4af050 formula_pin: use installed_prefixes/installed_kegs 2015-11-29 20:24:30 +08:00
Xu Cheng
02d7abe2ec add Formula#pinned_version 2015-11-16 20:59:12 +08:00
Xu Cheng
b3f0b28025 FormulaPin: pin at max version 2015-11-16 20:59:12 +08:00
Jack Nagel
f222ca04fd Remove pin directory when empty 2014-06-23 22:34:41 -05:00
Jack Nagel
d9e73c9d43 Simplify picking pinned version 2014-06-21 18:32:53 -05:00
Jack Nagel
4e817eaa6c Remove FormulaPin dependency on FileUtils 2014-06-21 18:32:38 -05:00
Jack Nagel
3a0726406b Add tests for FormulaPin and simplify implementation 2013-04-16 01:58:11 -05:00
Jack Nagel
1bad199776 Avoid slow operations in FormulaPin#initialize
A FormulaPin object is created every time Formula is instantiated, so
don't do filesystem operations or Pathname concatenation eagerly.
2013-04-14 21:41:30 -05:00
Jack Nagel
b258bee44e Don't use Pathname#/ in performance-critical code
This method (well, really, #join) is *twice* as slow as simple
concatenation, and shouldn't really be used at all in non-Formula code.
2013-04-14 20:09:20 -05:00
Jack Nagel
ae9060fc54 Remove circular require 2013-04-04 10:53:01 -05:00
Simon Sigurdhsson
4cd95652ea brew-pin: Fix bug in FormulaPin#pinned?
Since `pinned?` was using `File#exists?`, broken symlinks left by force-upgraded
formulae made `pinned?` return false while `pin` returned with an error because
it could not overwrite the broken link. This is fixed by using `File#symlink?`
instead, which returns true for broken symlinks and false only when they do not
exist.

Closes Homebrew/homebrew#18858.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-31 19:27:17 +01:00
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