[前][次][番号順一覧][スレッド一覧]

ruby-changes:60027

From: Yusuke <ko1@a...>
Date: Thu, 13 Feb 2020 10:16:24 +0900 (JST)
Subject: [ruby-changes:60027] 377c63366f (master): test/rubygems/test_gem_commands_setup_command.rb: Allow /bin/env

https://git.ruby-lang.org/ruby.git/commit/?id=377c63366f

From 377c63366f6d06236d6e846722acf84deee8026f Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Thu, 13 Feb 2020 10:15:24 +0900
Subject: test/rubygems/test_gem_commands_setup_command.rb: Allow /bin/env

Follow up of 65201c054a90c8e7beb8fe1e6d0006541ac33449

diff --git a/test/rubygems/test_gem_commands_setup_command.rb b/test/rubygems/test_gem_commands_setup_command.rb
index 9dc88d5..d2e04d7 100644
--- a/test/rubygems/test_gem_commands_setup_command.rb
+++ b/test/rubygems/test_gem_commands_setup_command.rb
@@ -184,15 +184,11 @@ class TestGemCommandsSetupCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_setup_command.rb#L184
 
     ruby_exec = sprintf Gem.default_exec_format, 'ruby'
 
-    if Gem.win_platform?
-      assert_match %r%\A#!\s*#{ruby_exec}%, File.read(default_gem_bin_path)
-      assert_match %r%\A#!\s*#{ruby_exec}%, File.read(default_bundle_bin_path)
-      assert_match %r%\A#!\s*#{ruby_exec}%, File.read(gem_bin_path)
-    else
-      assert_match %r%\A#!/usr/bin/env #{ruby_exec}%, File.read(default_gem_bin_path)
-      assert_match %r%\A#!/usr/bin/env #{ruby_exec}%, File.read(default_bundle_bin_path)
-      assert_match %r%\A#!/usr/bin/env #{ruby_exec}%, File.read(gem_bin_path)
-    end
+    bin_env = win_platform? ? "" : %w(/usr/bin/env /bin/env).find {|f| File.executable?(f) }
+
+    assert_match %r%\A#!#{bin_env}\s*#{ruby_exec}%, File.read(default_gem_bin_path)
+    assert_match %r%\A#!#{bin_env}\s*#{ruby_exec}%, File.read(default_bundle_bin_path)
+    assert_match %r%\A#!#{bin_env}\s*#{ruby_exec}%, File.read(gem_bin_path)
   end
 
   def test_pem_files_in
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]