Pass repository path into the updater

This commit is contained in:
Jack Nagel 2014-06-23 18:41:50 -05:00
parent 61e633426a
commit 8d12684efe
2 changed files with 10 additions and 6 deletions

View File

@ -25,7 +25,7 @@ module Homebrew
unlink_tap_formula(tapped_formulae) unlink_tap_formula(tapped_formulae)
report = Report.new report = Report.new
master_updater = Updater.new master_updater = Updater.new(HOMEBREW_REPOSITORY)
begin begin
master_updater.pull! master_updater.pull!
ensure ensure
@ -39,7 +39,7 @@ module Homebrew
each_tap do |user, repo| each_tap do |user, repo|
repo.cd do repo.cd do
updater = Updater.new updater = Updater.new(repo)
begin begin
updater.pull! updater.pull!
@ -135,7 +135,11 @@ module Homebrew
end end
class Updater class Updater
attr_reader :initial_revision, :current_revision attr_reader :initial_revision, :current_revision, :repository
def initialize(repository)
@repository = repository
end
def pull! def pull!
safe_system "git", "checkout", "-q", "master" safe_system "git", "checkout", "-q", "master"
@ -178,7 +182,7 @@ class Updater
when :R then $3 when :R then $3
else $2 else $2
end end
map[status] << Pathname.pwd.join(path) map[status] << repository.join(path)
end end
end end

View File

@ -4,7 +4,7 @@ require 'yaml'
class UpdaterTests < Homebrew::TestCase class UpdaterTests < Homebrew::TestCase
class UpdaterMock < ::Updater class UpdaterMock < ::Updater
def initialize(*args) def initialize(*)
super super
@outputs = Hash.new { |h, k| h[k] = [] } @outputs = Hash.new { |h, k| h[k] = [] }
@expected = [] @expected = []
@ -42,7 +42,7 @@ class UpdaterTests < Homebrew::TestCase
end end
def setup def setup
@updater = UpdaterMock.new @updater = UpdaterMock.new(HOMEBREW_REPOSITORY)
@report = Report.new @report = Report.new
end end