From 71e340881f1aca4911a35ddafd519fb0e29e6544 Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Mon, 3 Mar 2025 20:52:13 -0700 Subject: [PATCH] [rubygems/rubygems] Switch inject to use shorthand hash syntax https://github.com/rubygems/rubygems/commit/ba5a62fd04 --- lib/bundler/cli/inject.rb | 4 ++-- spec/bundler/commands/inject_spec.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/bundler/cli/inject.rb b/lib/bundler/cli/inject.rb index 4838aba671..a09d5c6bda 100644 --- a/lib/bundler/cli/inject.rb +++ b/lib/bundler/cli/inject.rb @@ -35,8 +35,8 @@ module Bundler Bundler.ui.confirm(added.map do |d| name = "'#{d.name}'" requirement = ", '#{d.requirement}'" - group = ", :group => #{d.groups.inspect}" if d.groups != Array(:default) - source = ", :source => '#{d.source}'" unless d.source.nil? + group = ", group: #{d.groups.inspect}" if d.groups != Array(:default) + source = ", source: '#{d.source}'" unless d.source.nil? %(gem #{name}#{requirement}#{group}#{source}) end.join("\n")) else diff --git a/spec/bundler/commands/inject_spec.rb b/spec/bundler/commands/inject_spec.rb index 193806a02a..4998b6e89d 100644 --- a/spec/bundler/commands/inject_spec.rb +++ b/spec/bundler/commands/inject_spec.rb @@ -55,7 +55,7 @@ Usage: "bundle inject GEM VERSION" it "add gem with source option in gemfile" do bundle "inject 'foo' '>0' --source https://gem.repo1" gemfile = bundled_app_gemfile.read - str = "gem \"foo\", \"> 0\", :source => \"https://gem.repo1\"" + str = "gem \"foo\", \"> 0\", source: \"https://gem.repo1\"" expect(gemfile).to include str end end @@ -64,14 +64,14 @@ Usage: "bundle inject GEM VERSION" it "add gem with group option in gemfile" do bundle "inject 'myrack-obama' '>0' --group=development" gemfile = bundled_app_gemfile.read - str = "gem \"myrack-obama\", \"> 0\", :group => :development" + str = "gem \"myrack-obama\", \"> 0\", group: :development" expect(gemfile).to include str end it "add gem with multiple groups in gemfile" do bundle "inject 'myrack-obama' '>0' --group=development,test" gemfile = bundled_app_gemfile.read - str = "gem \"myrack-obama\", \"> 0\", :groups => [:development, :test]" + str = "gem \"myrack-obama\", \"> 0\", groups: [:development, :test]" expect(gemfile).to include str end end