Use GitRepositoryExtension for HOMEBREW_REPOSITORY
This commit is contained in:
parent
6cdc6b1460
commit
77dd9d56ff
@ -805,7 +805,7 @@ module Homebrew
|
|||||||
def check_git_origin
|
def check_git_origin
|
||||||
return if !Utils.git_available? || !(HOMEBREW_REPOSITORY/".git").exist?
|
return if !Utils.git_available? || !(HOMEBREW_REPOSITORY/".git").exist?
|
||||||
|
|
||||||
origin = Homebrew.git_origin
|
origin = HOMEBREW_REPOSITORY.git_origin
|
||||||
|
|
||||||
if origin.nil?
|
if origin.nil?
|
||||||
<<-EOS.undent
|
<<-EOS.undent
|
||||||
|
@ -761,7 +761,7 @@ class FormulaInstaller
|
|||||||
tab.tap = formula.tap
|
tab.tap = formula.tap
|
||||||
tab.poured_from_bottle = true
|
tab.poured_from_bottle = true
|
||||||
tab.time = Time.now.to_i
|
tab.time = Time.now.to_i
|
||||||
tab.head = Homebrew.git_head
|
tab.head = HOMEBREW_REPOSITORY.git_head
|
||||||
tab.write
|
tab.write
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,6 +20,8 @@ HOMEBREW_WWW = "http://brew.sh"
|
|||||||
|
|
||||||
require "config"
|
require "config"
|
||||||
|
|
||||||
|
HOMEBREW_REPOSITORY.extend(GitRepositoryExtension)
|
||||||
|
|
||||||
if RbConfig.respond_to?(:ruby)
|
if RbConfig.respond_to?(:ruby)
|
||||||
RUBY_PATH = Pathname.new(RbConfig.ruby)
|
RUBY_PATH = Pathname.new(RbConfig.ruby)
|
||||||
else
|
else
|
||||||
|
@ -23,15 +23,15 @@ class SystemConfig
|
|||||||
end
|
end
|
||||||
|
|
||||||
def head
|
def head
|
||||||
Homebrew.git_head || "(none)"
|
HOMEBREW_REPOSITORY.git_head || "(none)"
|
||||||
end
|
end
|
||||||
|
|
||||||
def last_commit
|
def last_commit
|
||||||
Homebrew.git_last_commit || "never"
|
HOMEBREW_REPOSITORY.git_last_commit || "never"
|
||||||
end
|
end
|
||||||
|
|
||||||
def origin
|
def origin
|
||||||
Homebrew.git_origin || "(none)"
|
HOMEBREW_REPOSITORY.git_origin || "(none)"
|
||||||
end
|
end
|
||||||
|
|
||||||
def core_tap_head
|
def core_tap_head
|
||||||
|
@ -24,7 +24,7 @@ class Tab < OpenStruct
|
|||||||
"poured_from_bottle" => false,
|
"poured_from_bottle" => false,
|
||||||
"time" => Time.now.to_i,
|
"time" => Time.now.to_i,
|
||||||
"source_modified_time" => source_modified_time.to_i,
|
"source_modified_time" => source_modified_time.to_i,
|
||||||
"HEAD" => Homebrew.git_head,
|
"HEAD" => HOMEBREW_REPOSITORY.git_head,
|
||||||
"compiler" => compiler,
|
"compiler" => compiler,
|
||||||
"stdlib" => stdlib,
|
"stdlib" => stdlib,
|
||||||
"source" => {
|
"source" => {
|
||||||
|
@ -198,34 +198,9 @@ module Homebrew
|
|||||||
_system(cmd, *args)
|
_system(cmd, *args)
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.git_origin
|
|
||||||
return unless Utils.git_available?
|
|
||||||
HOMEBREW_REPOSITORY.cd { `git config --get remote.origin.url 2>/dev/null`.chuzzle }
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.git_head
|
|
||||||
return unless Utils.git_available?
|
|
||||||
HOMEBREW_REPOSITORY.cd { `git rev-parse --verify -q HEAD 2>/dev/null`.chuzzle }
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.git_short_head
|
|
||||||
return unless Utils.git_available?
|
|
||||||
HOMEBREW_REPOSITORY.cd { `git rev-parse --short=4 --verify -q HEAD 2>/dev/null`.chuzzle }
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.git_last_commit
|
|
||||||
return unless Utils.git_available?
|
|
||||||
HOMEBREW_REPOSITORY.cd { `git show -s --format="%cr" HEAD 2>/dev/null`.chuzzle }
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.git_last_commit_date
|
|
||||||
return unless Utils.git_available?
|
|
||||||
HOMEBREW_REPOSITORY.cd { `git show -s --format="%cd" --date=short HEAD 2>/dev/null`.chuzzle }
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.homebrew_version_string
|
def self.homebrew_version_string
|
||||||
if pretty_revision = git_short_head
|
if pretty_revision = HOMEBREW_REPOSITORY.git_short_head
|
||||||
last_commit = git_last_commit_date
|
last_commit = HOMEBREW_REPOSITORY.git_last_commit_date
|
||||||
"#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})"
|
"#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})"
|
||||||
else
|
else
|
||||||
"#{HOMEBREW_VERSION} (no git repository)"
|
"#{HOMEBREW_VERSION} (no git repository)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user