diff options
| author | Xu Cheng | 2015-07-28 15:10:40 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-07-31 19:44:00 +0800 |
| commit | 78442232d0be41c0cc42866d24113bbab25f836c (patch) | |
| tree | 9da4be54eef64b88210916d53f6de8a7c246cc34 /Library | |
| parent | 808729e7ff685d372193f9adb79f44ea7f6e9adf (diff) | |
| download | brew-78442232d0be41c0cc42866d24113bbab25f836c.tar.bz2 | |
Formula: add active_spec_sym
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index be1fdf532..f508c96dc 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -62,6 +62,11 @@ class Formula attr_reader :active_spec protected :active_spec + # A symbol to indicate currently active {SoftwareSpec}. + # It's either :stable, :devel or :head + # @see #active_spec + attr_reader :active_spec_sym + # The {PkgVersion} for this formula with version and {#revision} information. attr_reader :pkg_version @@ -105,6 +110,13 @@ class Formula set_spec :head @active_spec = determine_active_spec(spec) + @active_spec_sym = if head? + :head + elsif devel? + :devel + else + :stable + end validate_attributes! @pkg_version = PkgVersion.new(version, revision) @build = active_spec.build @@ -590,9 +602,7 @@ class Formula end def inspect - s = "#<Formula #{name} (" - s << if head? then "head" elsif devel? then "devel" else "stable" end - s << ") #{path}>" + "#<Formula #{name} (#{active_spec_sym}) #{path}>" end def file_modified? |
