Formula: add full_name variable

This commit is contained in:
Xu Cheng 2015-05-27 20:30:43 +08:00
parent 26d1683039
commit 9a90dbd275

View File

@ -28,6 +28,11 @@ class Formula
# e.g. `this-formula` # e.g. `this-formula`
attr_reader :name attr_reader :name
# The fully-qualified name of this {Formula}.
# For core formula it's the same as {#name}.
# e.g. `homebrew/tap-name/this-formula`
attr_reader :full_name
# The full path to this {Formula}. # The full path to this {Formula}.
# e.g. `/usr/local/Library/Formula/this-formula.rb` # e.g. `/usr/local/Library/Formula/this-formula.rb`
attr_reader :path attr_reader :path
@ -88,6 +93,12 @@ class Formula
@path = path @path = path
@revision = self.class.revision || 0 @revision = self.class.revision || 0
if path.to_s =~ HOMEBREW_TAP_PATH_REGEX
@full_name = "#{$1}/#{$2.gsub(/^homebrew-/, "")}/#{name}"
else
@full_name = name
end
set_spec :stable set_spec :stable
set_spec :devel set_spec :devel
set_spec :head set_spec :head
@ -714,6 +725,7 @@ class Formula
def to_hash def to_hash
hsh = { hsh = {
"name" => name, "name" => name,
"full_name" => full_name,
"desc" => desc, "desc" => desc,
"homepage" => homepage, "homepage" => homepage,
"versions" => { "versions" => {