aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula_pin.rb
diff options
context:
space:
mode:
authorMike McQuaid2016-09-15 18:28:42 +0100
committerMike McQuaid2016-09-15 18:28:42 +0100
commit72d10fff0be917df691b02b07b07dccfc8f1d760 (patch)
treec07d6946fc7aef94ff9d833c8404f0275d4211d4 /Library/Homebrew/formula_pin.rb
parent099295163412b19470c500406738c50c2fb2fc8f (diff)
downloadbrew-72d10fff0be917df691b02b07b07dccfc8f1d760.tar.bz2
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.
Diffstat (limited to 'Library/Homebrew/formula_pin.rb')
-rw-r--r--Library/Homebrew/formula_pin.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/Library/Homebrew/formula_pin.rb b/Library/Homebrew/formula_pin.rb
index 0650c806f..18352c93b 100644
--- a/Library/Homebrew/formula_pin.rb
+++ b/Library/Homebrew/formula_pin.rb
@@ -1,18 +1,16 @@
require "keg"
class FormulaPin
- PINDIR = Pathname.new("#{HOMEBREW_LIBRARY}/PinnedKegs")
-
def initialize(f)
@f = f
end
def path
- Pathname.new("#{PINDIR}/#{@f.name}")
+ HOMEBREW_PINNED_KEGS/@f.name
end
def pin_at(version)
- PINDIR.mkpath
+ HOMEBREW_PINNED_KEGS.mkpath
version_path = @f.rack.join(version)
path.make_relative_symlink(version_path) unless pinned? || !version_path.exist?
end
@@ -23,7 +21,7 @@ class FormulaPin
def unpin
path.unlink if pinned?
- PINDIR.rmdir_if_possible
+ HOMEBREW_PINNED_KEGS.rmdir_if_possible
end
def pinned?