aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorXu Cheng2015-11-16 19:23:48 +0800
committerXu Cheng2015-11-16 20:59:12 +0800
commit02d7abe2ec9491c6c56b6f59749d5ff911ba69ed (patch)
treefc9c2ef4ab7406eab2eb56671b065442f2fed0d5 /Library
parentb3f0b280254e8fb3499080e7b84623ae54c87c85 (diff)
downloadbrew-02d7abe2ec9491c6c56b6f59749d5ff911ba69ed.tar.bz2
add Formula#pinned_version
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb5
-rw-r--r--Library/Homebrew/formula_pin.rb4
2 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 9543f3ad4..50200e804 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -937,6 +937,11 @@ class Formula
end
# @private
+ def pinned_version
+ @pin.pinned_version
+ end
+
+ # @private
def pin
@pin.pin
end
diff --git a/Library/Homebrew/formula_pin.rb b/Library/Homebrew/formula_pin.rb
index 9a9aa4ced..7ecad9d7b 100644
--- a/Library/Homebrew/formula_pin.rb
+++ b/Library/Homebrew/formula_pin.rb
@@ -33,4 +33,8 @@ class FormulaPin
def pinnable?
@f.rack.exist? && @f.rack.subdirs.length > 0
end
+
+ def pinned_version
+ Keg.new(path.resolved_path).version if pinned?
+ end
end