From 21eecbf1d6cfa162b50bf0fc2dd4aed259c5d3c2 Mon Sep 17 00:00:00 2001
From: Xu Cheng <xucheng@me.com>
Date: Thu, 30 Jul 2015 16:25:21 +0800
Subject: [PATCH] Formula: add set_acitve_spec method

---
 Library/Homebrew/formula.rb | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 134b4045fd..bc698b717d 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -119,6 +119,16 @@ class Formula
     @pin = FormulaPin.new(self)
   end
 
+  # @private
+  def set_active_spec(spec_sym)
+    spec = send(spec_sym)
+    raise FormulaSpecificationError, "#{spec_sym} spec is not available for #{full_name}" unless spec
+    @active_spec = spec
+    @active_spec_sym = spec_sym
+    validate_attributes!
+    @build = active_spec.build
+  end
+
   private
 
   def set_spec(name)
-- 
GitLab