aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMartin Afanasjew2016-07-02 09:44:48 +0200
committerMartin Afanasjew2016-07-07 01:46:58 +0200
commit77dd9d56ff39f77391d2f429a9ff25e65a362ba2 (patch)
treefbd0d51ffa31677ebfc34e6ee05daa5ccc4eebea /Library/Homebrew
parent6cdc6b1460c2d81d514f03afa3447c81b75ef801 (diff)
downloadbrew-77dd9d56ff39f77391d2f429a9ff25e65a362ba2.tar.bz2
Use GitRepositoryExtension for HOMEBREW_REPOSITORY
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/diagnostic.rb2
-rw-r--r--Library/Homebrew/formula_installer.rb2
-rw-r--r--Library/Homebrew/global.rb2
-rw-r--r--Library/Homebrew/system_config.rb6
-rw-r--r--Library/Homebrew/tab.rb2
-rw-r--r--Library/Homebrew/utils.rb29
6 files changed, 10 insertions, 33 deletions
diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb
index 020be9053..733d368d9 100644
--- a/Library/Homebrew/diagnostic.rb
+++ b/Library/Homebrew/diagnostic.rb
@@ -805,7 +805,7 @@ module Homebrew
def check_git_origin
return if !Utils.git_available? || !(HOMEBREW_REPOSITORY/".git").exist?
- origin = Homebrew.git_origin
+ origin = HOMEBREW_REPOSITORY.git_origin
if origin.nil?
<<-EOS.undent
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index da626da4c..ae594d9f7 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -761,7 +761,7 @@ class FormulaInstaller
tab.tap = formula.tap
tab.poured_from_bottle = true
tab.time = Time.now.to_i
- tab.head = Homebrew.git_head
+ tab.head = HOMEBREW_REPOSITORY.git_head
tab.write
end
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index ab6bd9d5c..25f2d42f0 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -20,6 +20,8 @@ HOMEBREW_WWW = "http://brew.sh"
require "config"
+HOMEBREW_REPOSITORY.extend(GitRepositoryExtension)
+
if RbConfig.respond_to?(:ruby)
RUBY_PATH = Pathname.new(RbConfig.ruby)
else
diff --git a/Library/Homebrew/system_config.rb b/Library/Homebrew/system_config.rb
index 71d5065ad..26a0c27ab 100644
--- a/Library/Homebrew/system_config.rb
+++ b/Library/Homebrew/system_config.rb
@@ -23,15 +23,15 @@ class SystemConfig
end
def head
- Homebrew.git_head || "(none)"
+ HOMEBREW_REPOSITORY.git_head || "(none)"
end
def last_commit
- Homebrew.git_last_commit || "never"
+ HOMEBREW_REPOSITORY.git_last_commit || "never"
end
def origin
- Homebrew.git_origin || "(none)"
+ HOMEBREW_REPOSITORY.git_origin || "(none)"
end
def core_tap_head
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index a72a3c0cc..a407496bb 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -24,7 +24,7 @@ class Tab < OpenStruct
"poured_from_bottle" => false,
"time" => Time.now.to_i,
"source_modified_time" => source_modified_time.to_i,
- "HEAD" => Homebrew.git_head,
+ "HEAD" => HOMEBREW_REPOSITORY.git_head,
"compiler" => compiler,
"stdlib" => stdlib,
"source" => {
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index f94477f50..61d286da5 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -198,34 +198,9 @@ module Homebrew
_system(cmd, *args)
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
- if pretty_revision = git_short_head
- last_commit = git_last_commit_date
+ if pretty_revision = HOMEBREW_REPOSITORY.git_short_head
+ last_commit = HOMEBREW_REPOSITORY.git_last_commit_date
"#{HOMEBREW_VERSION} (git revision #{pretty_revision}; last commit #{last_commit})"
else
"#{HOMEBREW_VERSION} (no git repository)"