Merge pull request #4213 from reitermarkus/refactoring

Refactoring
This commit is contained in:
Mike McQuaid 2018-05-28 20:26:09 +01:00 committed by GitHub
commit 513c179e60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -122,7 +122,7 @@ module Homebrew
matches.map do |match|
filename = File.basename(match["path"], ".rb")
tap = Tap.fetch(match["repository"]["full_name"])
next if tap.installed? && !(tap.user == "Homebrew" && tap.repo.start_with?("cask"))
next if tap.installed? && !tap.name.start_with?("homebrew/cask")
"#{tap.name}/#{filename}"
end.compact
end

View File

@ -13,20 +13,17 @@ class Tap
old_name = name
old_path = path
old_remote = path.git_origin
old_remote = remote
clear_cache
super(new_user, new_repo)
@repo_var = nil
new_initial_revision_var = "HOMEBREW_UPDATE_BEFORE#{repo_var}"
new_current_revision_var = "HOMEBREW_UPDATE_AFTER#{repo_var}"
ENV[new_initial_revision_var] ||= ENV[old_initial_revision_var]
ENV[new_current_revision_var] ||= ENV[old_current_revision_var]
return unless old_path.git?
new_name = name
new_path = path
new_remote = default_remote
@ -37,6 +34,8 @@ class Tap
path.dirname.mkpath
FileUtils.mv old_path, new_path
return unless old_path.git?
puts "Changing remote from #{old_remote} to #{new_remote}..." if $stdout.tty?
new_path.git_origin = new_remote
end

View File

@ -84,6 +84,7 @@ class Tap
# clear internal cache
def clear_cache
@remote = nil
@repo_var = nil
@formula_dir = nil
@cask_dir = nil
@formula_files = nil