diff --git a/Library/Homebrew/blacklist.rb b/Library/Homebrew/blacklist.rb index 4312d0bf3b..1c79da1593 100644 --- a/Library/Homebrew/blacklist.rb +++ b/Library/Homebrew/blacklist.rb @@ -16,7 +16,7 @@ def blacklisted?(name) Homebrew provides pip via: `brew install python`. However you will then have two Pythons installed on your Mac, so alternatively you can install pip via the instructions at: - https://pip.readthedocs.io/en/stable/installing/ + #{Formatter.url("https://pip.readthedocs.io/en/stable/installing/")} EOS when "pil" then <<-EOS.undent Instead of PIL, consider `pip install pillow` or `brew install Homebrew/python/pillow`. @@ -24,7 +24,7 @@ def blacklisted?(name) when "macruby" then <<-EOS.undent MacRuby is not packaged and is on an indefinite development hiatus. You can read more about it at: - https://github.com/MacRuby/MacRuby + #{Formatter.url("https://github.com/MacRuby/MacRuby")} EOS when /(lib)?lzma/ "lzma is now part of the xz formula." @@ -50,7 +50,7 @@ def blacklisted?(name) To install Clojure you should install Leiningen: brew install leiningen and then follow the tutorial: - https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md + #{Formatter.url("https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md")} EOS when "osmium" then <<-EOS.undent The creator of Osmium requests that it not be packaged and that people @@ -65,8 +65,8 @@ def blacklisted?(name) brew install typesafe-activator You can read more about this change at: - https://www.playframework.com/documentation/2.3.x/Migration23 - https://www.playframework.com/documentation/2.3.x/Highlights23 + #{Formatter.url("https://www.playframework.com/documentation/2.3.x/Migration23")} + #{Formatter.url("https://www.playframework.com/documentation/2.3.x/Highlights23")} EOS when "haskell-platform" then <<-EOS.undent We no longer package haskell-platform. Consider installing ghc diff --git a/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb b/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb index 5efd7d5621..9dd9abab1c 100644 --- a/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb +++ b/Library/Homebrew/cask/lib/hbc/dsl/caveats.rb @@ -102,12 +102,12 @@ module Hbc A report has been made to Apple about this app. Their certificate will hopefully be revoked. See the public report at - https://openradar.appspot.com/#{radar_number} + #{Formatter.url("https://openradar.appspot.com/#{radar_number}")} If this report is accurate, please duplicate it at - https://bugreport.apple.com/ + #{Formatter.url("https://bugreport.apple.com/")} If this report is a mistake, please let us know by opening an issue at - https://github.com/caskroom/homebrew-cask/issues/new + #{Formatter.url("https://github.com/caskroom/homebrew-cask/issues/new")} EOS end diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index 05a3003cc8..c8845b086e 100644 --- a/Library/Homebrew/cmd/help.rb +++ b/Library/Homebrew/cmd/help.rb @@ -78,11 +78,12 @@ module Homebrew HOMEBREW_HELP else help_lines.map do |line| - line.slice(2..-1). - sub(/^ \* /, "#{Tty.bold}brew#{Tty.reset} "). - gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}"). - gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}"). - gsub("@hide_from_man_page", "") + line.slice(2..-1) + .sub(/^ \* /, "#{Tty.bold}brew#{Tty.reset} ") + .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}") + .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) } + .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}") + .gsub("@hide_from_man_page", "") end.join.strip end end diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index c275606e28..f97191bdaf 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -288,7 +288,7 @@ module Homebrew Please try to resolve this error yourself and then run `brew update` again to complete the migration. If you need help please +1 an existing error or comment with your new error in issue: - #{Tty.em}https://github.com/Homebrew/brew/issues/987#{Tty.reset} + #{Formatter.url("https://github.com/Homebrew/brew/issues/987")} EOS $stderr.puts e.backtrace end diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index ca8ade9ff8..6546714e87 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -473,7 +473,7 @@ module Homebrew If you have trouble downloading packages with Homebrew, then maybe this is the problem? If the following command doesn't work, then try removing your curlrc: - curl https://github.com + curl #{Formatter.url("https://github.com")} EOS end @@ -610,7 +610,7 @@ module Homebrew Setting DYLD_INSERT_LIBRARIES can cause Go builds to fail. Having this set is common if you use this software: - http://asepsis.binaryage.com/ + #{Formatter.url("http://asepsis.binaryage.com/")} EOS end @@ -752,7 +752,7 @@ module Homebrew Without a correctly configured origin, Homebrew won't update properly. You can solve this by adding the Homebrew remote: cd #{HOMEBREW_REPOSITORY} - git remote add origin https://github.com/Homebrew/brew.git + git remote add origin #{Formatter.url("https://github.com/Homebrew/brew.git")} EOS elsif origin !~ %r{Homebrew/brew(\.git)?$} <<-EOS.undent @@ -764,7 +764,7 @@ module Homebrew Unless you have compelling reasons, consider setting the origin remote to point at the main repository, located at: - https://github.com/Homebrew/brew.git + #{Formatter.url("https://github.com/Homebrew/brew.git")} EOS end end @@ -956,8 +956,8 @@ module Homebrew <<-EOS.undent A .pydistutils.cfg file was found in $HOME, which may cause Python builds to fail. See: - https://bugs.python.org/issue6138 - https://bugs.python.org/issue4655 + #{Formatter.url("https://bugs.python.org/issue6138")} + #{Formatter.url("https://bugs.python.org/issue4655")} EOS end diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index 601bde5285..e01a60c758 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -318,7 +318,7 @@ class BuildError < RuntimeError def dump if !ARGV.verbose? puts - puts Formatter.error("READ THIS: #{Formatter.url(OS::ISSUES_URL)}") + puts Formatter.error(Formatter.url(OS::ISSUES_URL), label: "READ THIS") if formula.tap case formula.tap.name when "homebrew/boneyard" @@ -327,7 +327,7 @@ class BuildError < RuntimeError else if issues_url = formula.tap.issues_url puts "If reporting this issue please do so at (not Homebrew/brew):" - puts " #{issues_url}" + puts " #{Formatter.url(issues_url)}" end end end diff --git a/Library/Homebrew/requirements.rb b/Library/Homebrew/requirements.rb index 274ba5c9b8..87b315cb76 100644 --- a/Library/Homebrew/requirements.rb +++ b/Library/Homebrew/requirements.rb @@ -44,7 +44,7 @@ class XcodeRequirement < Requirement EOS else message + <<-EOS.undent - Xcode can be installed from https://developer.apple.com/xcode/downloads/ + Xcode can be installed from #{Formatter.url("https://developer.apple.com/xcode/downloads/")} EOS end end diff --git a/Library/Homebrew/utils/github.rb b/Library/Homebrew/utils/github.rb index 1443a93361..5611f9aadd 100644 --- a/Library/Homebrew/utils/github.rb +++ b/Library/Homebrew/utils/github.rb @@ -106,14 +106,14 @@ module GitHub onoe <<-EOS.undent Your macOS keychain GitHub credentials do not have sufficient scope! Scopes they have: #{credentials_scopes} - Create a personal access token: https://github.com/settings/tokens + Create a personal access token: #{Formatter.url("https://github.com/settings/tokens")} and then set HOMEBREW_GITHUB_API_TOKEN as the authentication method instead. EOS when :environment onoe <<-EOS.undent Your HOMEBREW_GITHUB_API_TOKEN does not have sufficient scope! Scopes it has: #{credentials_scopes} - Create a new personal access token: https://github.com/settings/tokens + Create a new personal access token: #{Formatter.url("https://github.com/settings/tokens")} and then set the new HOMEBREW_GITHUB_API_TOKEN as the authentication method instead. EOS end