--version/config: show core tap information
This commit is contained in:
		
							parent
							
								
									5bb8e8985d
								
							
						
					
					
						commit
						2bb30fc5f0
					
				@ -1,6 +1,7 @@
 | 
			
		||||
require "hardware"
 | 
			
		||||
require "software_spec"
 | 
			
		||||
require "rexml/document"
 | 
			
		||||
require "tap"
 | 
			
		||||
 | 
			
		||||
module Homebrew
 | 
			
		||||
  def config
 | 
			
		||||
@ -57,6 +58,18 @@ module Homebrew
 | 
			
		||||
    Homebrew.git_origin || "(none)"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def core_tap_head
 | 
			
		||||
    CoreTap.instance.git_head || "(none)"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def core_tap_last_commit
 | 
			
		||||
    CoreTap.instance.git_last_commit || "never"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def core_tap_origin
 | 
			
		||||
    CoreTap.instance.remote || "(none)"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def describe_path(path)
 | 
			
		||||
    return "N/A" if path.nil?
 | 
			
		||||
    realpath = path.realpath
 | 
			
		||||
@ -144,6 +157,13 @@ module Homebrew
 | 
			
		||||
    f.puts "ORIGIN: #{origin}"
 | 
			
		||||
    f.puts "HEAD: #{head}"
 | 
			
		||||
    f.puts "Last commit: #{last_commit}"
 | 
			
		||||
    if CoreTap.instance.installed?
 | 
			
		||||
      f.puts "Core tap ORIGIN: #{core_tap_origin}"
 | 
			
		||||
      f.puts "Core tap HEAD: #{core_tap_head}"
 | 
			
		||||
      f.puts "Core tap last commit: #{core_tap_last_commit}"
 | 
			
		||||
    else
 | 
			
		||||
      f.puts "Core tap: N/A"
 | 
			
		||||
    end
 | 
			
		||||
    f.puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}"
 | 
			
		||||
    f.puts "HOMEBREW_REPOSITORY: #{HOMEBREW_REPOSITORY}"
 | 
			
		||||
    f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
 | 
			
		||||
 | 
			
		||||
@ -229,6 +229,18 @@ module Homebrew
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.core_tap_version_string
 | 
			
		||||
    require "tap"
 | 
			
		||||
    tap = CoreTap.instance
 | 
			
		||||
    return "N/A" unless tap.installed?
 | 
			
		||||
    if pretty_revision = tap.git_short_head
 | 
			
		||||
      last_commit = tap.git_last_commit_date
 | 
			
		||||
      "(git revision #{pretty_revision}; last commit #{last_commit})"
 | 
			
		||||
    else
 | 
			
		||||
      "(no git repository)"
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def self.install_gem_setup_path!(gem, version = nil, executable = gem)
 | 
			
		||||
    require "rubygems"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,7 @@ require "global"
 | 
			
		||||
 | 
			
		||||
if ARGV == %w[--version] || ARGV == %w[-v]
 | 
			
		||||
  puts "Homebrew #{Homebrew.homebrew_version_string}"
 | 
			
		||||
  puts "Homebrew/homebrew-core #{Homebrew.core_tap_version_string}"
 | 
			
		||||
  exit 0
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user