summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gittemeier <me@a.lexg.dev>2022-02-12 01:04:13 -0600
committergit <svn-admin@ruby-lang.org>2022-03-08 03:40:30 +0900
commit943efa8ca6a5ac43e98265c0606a28d45103b393 (patch)
treef9577e3ab69d81fe94f33c559518f0f04ea33fc5
parentc445963575a8572f6b0baf7135093c128adab3b9 (diff)
[rubygems/rubygems] Add newline to validate_platforms! message when platform is missing
When I run bundle install with BUNDLE_DEPLOYMENT=true in the environment on a different platform than I usually do development, I get the following output to the console (wrapped exactly as shown): Your bundle only supports platforms ["x86_64-darwin-19"] but your local platform is x86_64-linux. Add the current platform to the lockfile with `bundle lock --add-platform x86_64-linux` and try again. Because the way the message wraps, its not as simple as copying the suggested command to the clipboard because it contains a newline: $ bundle lock Writing lockfile to [...]/Gemfile.lock $ --add-platform x86_64-linux Adding a newline right before the command forces the command in the error message to be on the same line, which facilitates copy-pasting the command in the message. https://github.com/rubygems/rubygems/commit/4cf6989b11
-rw-r--r--lib/bundler/definition.rb2
-rw-r--r--spec/bundler/commands/install_spec.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 20b5340203..09be2db68c 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -433,7 +433,7 @@ module Bundler
raise ProductionError, "Your bundle only supports platforms #{@platforms.map(&:to_s)} " \
"but your local platform is #{Bundler.local_platform}. " \
- "Add the current platform to the lockfile with `bundle lock --add-platform #{Bundler.local_platform}` and try again."
+ "Add the current platform to the lockfile with\n`bundle lock --add-platform #{Bundler.local_platform}` and try again."
end
def add_platform(platform)
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 56f657521f..9e06c51a08 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -856,7 +856,7 @@ RSpec.describe "bundle install with gem sources" do
expect(err).to eq(
"Your bundle only supports platforms [\"x86_64-darwin-19\"] but your local platform is x86_64-linux. " \
- "Add the current platform to the lockfile with `bundle lock --add-platform x86_64-linux` and try again."
+ "Add the current platform to the lockfile with\n`bundle lock --add-platform x86_64-linux` and try again."
)
end
end