mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Move repo_var
method to Tap
class.
This commit is contained in:
parent
8895acf059
commit
54834ccbe3
@ -327,11 +327,11 @@ class Reporter
|
|||||||
def initialize(tap)
|
def initialize(tap)
|
||||||
@tap = tap
|
@tap = tap
|
||||||
|
|
||||||
initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{repo_var}"
|
initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{tap.repo_var}"
|
||||||
@initial_revision = ENV[initial_revision_var].to_s
|
@initial_revision = ENV[initial_revision_var].to_s
|
||||||
raise ReporterRevisionUnsetError, initial_revision_var if @initial_revision.empty?
|
raise ReporterRevisionUnsetError, initial_revision_var if @initial_revision.empty?
|
||||||
|
|
||||||
current_revision_var = "HOMEBREW_UPDATE_AFTER#{repo_var}"
|
current_revision_var = "HOMEBREW_UPDATE_AFTER#{tap.repo_var}"
|
||||||
@current_revision = ENV[current_revision_var].to_s
|
@current_revision = ENV[current_revision_var].to_s
|
||||||
raise ReporterRevisionUnsetError, current_revision_var if @current_revision.empty?
|
raise ReporterRevisionUnsetError, current_revision_var if @current_revision.empty?
|
||||||
end
|
end
|
||||||
@ -531,13 +531,6 @@ class Reporter
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def repo_var
|
|
||||||
@repo_var ||= tap.path.to_s
|
|
||||||
.strip_prefix(Tap::TAP_DIRECTORY.to_s)
|
|
||||||
.tr("^A-Za-z0-9", "_")
|
|
||||||
.upcase
|
|
||||||
end
|
|
||||||
|
|
||||||
def diff
|
def diff
|
||||||
Utils.popen_read(
|
Utils.popen_read(
|
||||||
"git", "-C", tap.path, "diff-tree", "-r", "--name-status", "--diff-filter=AMDR",
|
"git", "-C", tap.path, "diff-tree", "-r", "--name-status", "--diff-filter=AMDR",
|
||||||
|
@ -111,6 +111,13 @@ class Tap
|
|||||||
"https://github.com/#{full_name}"
|
"https://github.com/#{full_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def repo_var
|
||||||
|
@repo_var ||= path.to_s
|
||||||
|
.strip_prefix(TAP_DIRECTORY.to_s)
|
||||||
|
.tr("^A-Za-z0-9", "_")
|
||||||
|
.upcase
|
||||||
|
end
|
||||||
|
|
||||||
# True if this {Tap} is a git repository.
|
# True if this {Tap} is a git repository.
|
||||||
def git?
|
def git?
|
||||||
path.git?
|
path.git?
|
||||||
|
@ -20,8 +20,8 @@ describe Reporter do
|
|||||||
def initialize(tap)
|
def initialize(tap)
|
||||||
@tap = tap
|
@tap = tap
|
||||||
|
|
||||||
ENV["HOMEBREW_UPDATE_BEFORE#{repo_var}"] = "12345678"
|
ENV["HOMEBREW_UPDATE_BEFORE#{tap.repo_var}"] = "12345678"
|
||||||
ENV["HOMEBREW_UPDATE_AFTER#{repo_var}"] = "abcdef00"
|
ENV["HOMEBREW_UPDATE_AFTER#{tap.repo_var}"] = "abcdef00"
|
||||||
|
|
||||||
super(tap)
|
super(tap)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user