[rubygems/rubygems] Use indented heredoc

https://github.com/rubygems/rubygems/commit/085d2776d8
This commit is contained in:
Nobuyoshi Nakada 2023-03-21 18:57:58 +09:00 committed by git
parent 7c307e0379
commit 348412c7fa
9 changed files with 20 additions and 20 deletions

View File

@ -5,7 +5,7 @@ require "rbconfig"
module Bundler module Bundler
class CLI::Issue class CLI::Issue
def run def run
Bundler.ui.info <<-EOS.gsub(/^ {8}/, "") Bundler.ui.info <<~EOS
Did you find an issue with Bundler? Before filing a new issue, Did you find an issue with Bundler? Before filing a new issue,
be sure to check out these resources: be sure to check out these resources:

View File

@ -40,8 +40,8 @@ module Bundler
desc = " * #{s.name} (#{s.version}#{s.git_version})" desc = " * #{s.name} (#{s.version}#{s.git_version})"
if @verbose if @verbose
latest = latest_specs.find {|l| l.name == s.name } latest = latest_specs.find {|l| l.name == s.name }
Bundler.ui.info <<-END.gsub(/^ +/, "") Bundler.ui.info <<~END
#{desc} #{desc.lstrip}
\tSummary: #{s.summary || "No description available."} \tSummary: #{s.summary || "No description available."}
\tHomepage: #{s.homepage || "No website available."} \tHomepage: #{s.homepage || "No website available."}
\tStatus: #{outdated?(s, latest) ? "Outdated - #{s.version} < #{latest.version}" : "Up to date"} \tStatus: #{outdated?(s, latest) ? "Outdated - #{s.version} < #{latest.version}" : "Up to date"}

View File

@ -61,7 +61,7 @@ module Bundler
end end
def request_issue_report_for(e) def request_issue_report_for(e)
Bundler.ui.error <<-EOS.gsub(/^ {8}/, ""), nil, nil Bundler.ui.error <<~EOS, nil, nil
--- ERROR REPORT TEMPLATE ------------------------------------------------------- --- ERROR REPORT TEMPLATE -------------------------------------------------------
``` ```
@ -75,7 +75,7 @@ module Bundler
Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue." Bundler.ui.error "Unfortunately, an unexpected error occurred, and Bundler cannot continue."
Bundler.ui.error <<-EOS.gsub(/^ {8}/, ""), nil, :yellow Bundler.ui.error <<~EOS, nil, :yellow
First, try this link to see if there are any existing issue reports for this error: First, try this link to see if there are any existing issue reports for this error:
#{issues_url(e)} #{issues_url(e)}
@ -93,7 +93,7 @@ module Bundler
end end
def serialized_exception_for(e) def serialized_exception_for(e)
<<-EOS.gsub(/^ {8}/, "") <<~EOS
#{e.class}: #{e.message} #{e.class}: #{e.message}
#{e.backtrace&.join("\n ")&.chomp} #{e.backtrace&.join("\n ")&.chomp}
EOS EOS

View File

@ -71,7 +71,7 @@ RSpec.describe Bundler do
$VERBOSE = verbose $VERBOSE = verbose
File.open(app_gemspec_path, "wb") do |file| File.open(app_gemspec_path, "wb") do |file|
file.puts <<-GEMSPEC.gsub(/^\s+/, "") file.puts <<~GEMSPEC
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
Gem::Specification.new do |gem| Gem::Specification.new do |gem|
gem.author = "André the Giant" gem.author = "André the Giant"

View File

@ -697,7 +697,7 @@ RSpec.describe "bundle exec" do
context "`load`ing a ruby file instead of `exec`ing" do context "`load`ing a ruby file instead of `exec`ing" do
let(:path) { bundled_app("ruby_executable") } let(:path) { bundled_app("ruby_executable") }
let(:shebang) { "#!/usr/bin/env ruby" } let(:shebang) { "#!/usr/bin/env ruby" }
let(:executable) { <<-RUBY.gsub(/^ */, "").strip } let(:executable) { <<~RUBY.strip }
#{shebang} #{shebang}
require "rack" require "rack"

View File

@ -36,7 +36,7 @@ RSpec.describe "bundle install" do
gem "bundler", "0.9.1" gem "bundler", "0.9.1"
G G
nice_error = <<-E.strip.gsub(/^ {8}/, "") nice_error = <<~E.strip
Could not find compatible versions Could not find compatible versions
Because the current Bundler version (#{Bundler::VERSION}) does not satisfy bundler = 0.9.1 Because the current Bundler version (#{Bundler::VERSION}) does not satisfy bundler = 0.9.1
@ -56,7 +56,7 @@ RSpec.describe "bundle install" do
gem "bundler", "~> 0.8" gem "bundler", "~> 0.8"
G G
nice_error = <<-E.strip.gsub(/^ {8}/, "") nice_error = <<~E.strip
Could not find compatible versions Could not find compatible versions
Because rails >= 3.0 depends on bundler >= 0.9.0.pre Because rails >= 3.0 depends on bundler >= 0.9.0.pre
@ -79,7 +79,7 @@ RSpec.describe "bundle install" do
gem "bundler", "0.9.2" gem "bundler", "0.9.2"
G G
nice_error = <<-E.strip.gsub(/^ {8}/, "") nice_error = <<~E.strip
Could not find compatible versions Could not find compatible versions
Because the current Bundler version (#{Bundler::VERSION}) does not satisfy bundler = 0.9.2 Because the current Bundler version (#{Bundler::VERSION}) does not satisfy bundler = 0.9.2
@ -149,7 +149,7 @@ RSpec.describe "bundle install" do
gem "rails_pinned_to_old_activesupport" gem "rails_pinned_to_old_activesupport"
G G
nice_error = <<-E.strip.gsub(/^ {8}/, "") nice_error = <<~E.strip
Could not find compatible versions Could not find compatible versions
Because every version of rails_pinned_to_old_activesupport depends on activesupport = 1.2.3 Because every version of rails_pinned_to_old_activesupport depends on activesupport = 1.2.3
@ -177,7 +177,7 @@ RSpec.describe "bundle install" do
gem "activesupport", "2.3.5" gem "activesupport", "2.3.5"
G G
nice_error = <<-E.strip.gsub(/^ {8}/, "") nice_error = <<~E.strip
Could not find compatible versions Could not find compatible versions
Because every version of rails_pinned_to_old_activesupport depends on activesupport = 1.2.3 Because every version of rails_pinned_to_old_activesupport depends on activesupport = 1.2.3

View File

@ -193,7 +193,7 @@ RSpec.describe "bundle flex_install" do
it "discards the locked gems when the Gemfile requires different versions than the lock" do it "discards the locked gems when the Gemfile requires different versions than the lock" do
bundle "config set force_ruby_platform true" bundle "config set force_ruby_platform true"
nice_error = <<-E.strip.gsub(/^ {8}/, "") nice_error = <<~E.strip
Could not find compatible versions Could not find compatible versions
Because rack-obama >= 2.0 depends on rack = 1.2 Because rack-obama >= 2.0 depends on rack = 1.2
@ -210,7 +210,7 @@ RSpec.describe "bundle flex_install" do
it "does not include conflicts with a single requirement tree, because that can't possibly be a conflict" do it "does not include conflicts with a single requirement tree, because that can't possibly be a conflict" do
bundle "config set force_ruby_platform true" bundle "config set force_ruby_platform true"
bad_error = <<-E.strip.gsub(/^ {8}/, "") bad_error = <<~E.strip
Bundler could not find compatible versions for gem "rack-obama": Bundler could not find compatible versions for gem "rack-obama":
In Gemfile: In Gemfile:
rack-obama (= 2.0) rack-obama (= 2.0)

View File

@ -635,7 +635,7 @@ module Spec
end end
end end
TEST_CERT = <<-CERT.gsub(/^\s*/, "") TEST_CERT = <<~CERT
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIDMjCCAhqgAwIBAgIBATANBgkqhkiG9w0BAQUFADAnMQwwCgYDVQQDDAN5b3Ux MIIDMjCCAhqgAwIBAgIBATANBgkqhkiG9w0BAQUFADAnMQwwCgYDVQQDDAN5b3Ux
FzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMB4XDTE1MDIwODAwMTIyM1oXDTQyMDYy FzAVBgoJkiaJk/IsZAEZFgdleGFtcGxlMB4XDTE1MDIwODAwMTIyM1oXDTQyMDYy
@ -658,7 +658,7 @@ module Spec
-----END CERTIFICATE----- -----END CERTIFICATE-----
CERT CERT
TEST_PKEY = <<-PKEY.gsub(/^\s*/, "") TEST_PKEY = <<~PKEY
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
MIIEowIBAAKCAQEA2W8V2k3jdzgMxL0mjTqbRruTdtDcdZDXKtiFkyLvsXUXvc2k MIIEowIBAAKCAQEA2W8V2k3jdzgMxL0mjTqbRruTdtDcdZDXKtiFkyLvsXUXvc2k
GSdgcjMOS1CkafqGz/hAUlPibjM0QEXjtQuMdTmdMrmuORLeeIZhSO+HdkTNV6j3 GSdgcjMOS1CkafqGz/hAUlPibjM0QEXjtQuMdTmdMrmuORLeeIZhSO+HdkTNV6j3

View File

@ -366,7 +366,7 @@ class TestGem < Gem::TestCase
install_specs bundler_latest, bundler_previous install_specs bundler_latest, bundler_previous
File.open("Gemfile.lock", "w") do |f| File.open("Gemfile.lock", "w") do |f|
f.write <<-L.gsub(/ {8}/, "") f.write <<~L
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
@ -400,7 +400,7 @@ class TestGem < Gem::TestCase
install_specs bundler_latest, bundler_previous install_specs bundler_latest, bundler_previous
File.open("Gemfile.lock", "w") do |f| File.open("Gemfile.lock", "w") do |f|
f.write <<-L.gsub(/ {8}/, "") f.write <<~L
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
@ -424,7 +424,7 @@ class TestGem < Gem::TestCase
def test_activate_bin_path_gives_proper_error_for_bundler_when_underscore_selection_given def test_activate_bin_path_gives_proper_error_for_bundler_when_underscore_selection_given
File.open("Gemfile.lock", "w") do |f| File.open("Gemfile.lock", "w") do |f|
f.write <<-L.gsub(/ {8}/, "") f.write <<~L
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs: