Apply suggestions from code review
These are just a few style improvements. Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
96f0441178
commit
457de40117
@ -172,8 +172,7 @@ class Keg
|
|||||||
end
|
end
|
||||||
relocation.add_replacement_pair(:perl, PERL_PLACEHOLDER, perl_path)
|
relocation.add_replacement_pair(:perl, PERL_PLACEHOLDER, perl_path)
|
||||||
|
|
||||||
openjdk = openjdk_dep_name_if_applicable
|
if (openjdk = openjdk_dep_name_if_applicable)
|
||||||
if openjdk
|
|
||||||
openjdk_path = HOMEBREW_PREFIX/"opt"/openjdk/"libexec/openjdk.jdk/Contents/Home"
|
openjdk_path = HOMEBREW_PREFIX/"opt"/openjdk/"libexec/openjdk.jdk/Contents/Home"
|
||||||
relocation.add_replacement_pair(:java, JAVA_PLACEHOLDER, openjdk_path.to_s)
|
relocation.add_replacement_pair(:java, JAVA_PLACEHOLDER, openjdk_path.to_s)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -116,8 +116,9 @@ class Keg
|
|||||||
relocation.add_replacement_pair(:repository, REPOSITORY_PLACEHOLDER, HOMEBREW_REPOSITORY.to_s)
|
relocation.add_replacement_pair(:repository, REPOSITORY_PLACEHOLDER, HOMEBREW_REPOSITORY.to_s)
|
||||||
relocation.add_replacement_pair(:library, LIBRARY_PLACEHOLDER, HOMEBREW_LIBRARY.to_s)
|
relocation.add_replacement_pair(:library, LIBRARY_PLACEHOLDER, HOMEBREW_LIBRARY.to_s)
|
||||||
relocation.add_replacement_pair(:perl, PERL_PLACEHOLDER, "#{HOMEBREW_PREFIX}/opt/perl/bin/perl")
|
relocation.add_replacement_pair(:perl, PERL_PLACEHOLDER, "#{HOMEBREW_PREFIX}/opt/perl/bin/perl")
|
||||||
openjdk = openjdk_dep_name_if_applicable
|
if (openjdk = openjdk_dep_name_if_applicable)
|
||||||
relocation.add_replacement_pair(:java, JAVA_PLACEHOLDER, "#{HOMEBREW_PREFIX}/opt/#{openjdk}/libexec") if openjdk
|
relocation.add_replacement_pair(:java, JAVA_PLACEHOLDER, "#{HOMEBREW_PREFIX}/opt/#{openjdk}/libexec")
|
||||||
|
end
|
||||||
|
|
||||||
relocation
|
relocation
|
||||||
end
|
end
|
||||||
@ -130,9 +131,11 @@ class Keg
|
|||||||
end
|
end
|
||||||
|
|
||||||
def openjdk_dep_name_if_applicable
|
def openjdk_dep_name_if_applicable
|
||||||
runtime_dependencies&.find do |dep|
|
deps = runtime_dependencies
|
||||||
dep["full_name"].match? Version.formula_optionally_versioned_regex(:openjdk)
|
return if deps.blank?
|
||||||
end&.fetch("full_name")
|
|
||||||
|
dep_names = deps.map { |d| d["full_name"] }
|
||||||
|
dep_names.find { |d| d.match? Version.formula_optionally_versioned_regex(:openjdk) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def replace_text_in_files(relocation, files: nil)
|
def replace_text_in_files(relocation, files: nil)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user