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

ruby-changes:56638

From: Nobuyoshi <ko1@a...>
Date: Wed, 24 Jul 2019 19:16:27 +0900 (JST)
Subject: [ruby-changes:56638] Nobuyoshi Nakada: 99fb637c41 (master): [rubygems/rubygems] Make `@@project_dir` constants per files

https://git.ruby-lang.org/ruby.git/commit/?id=99fb637c41

From 99fb637c41c6301286042afbc9edaea71cd7643b Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 24 Jul 2019 13:57:59 +0900
Subject: [rubygems/rubygems] Make `@@project_dir` constants per files

https://github.com/rubygems/rubygems/commit/955174658f

diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index a08a86d..86ad90c 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -17,7 +17,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L17
 
   PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant
 
-  @@project_dir = File.expand_path('../../..', __FILE__).untaint
+  PROJECT_DIR = File.expand_path('../../..', __FILE__).untaint
 
   def setup
     super
@@ -632,7 +632,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L632
   end
 
   def test_self_find_files
-    cwd = File.expand_path("test/rubygems", @@project_dir)
+    cwd = File.expand_path("test/rubygems", PROJECT_DIR)
     $LOAD_PATH.unshift cwd
 
     discover_path = File.join 'lib', 'sff', 'discover.rb'
@@ -652,7 +652,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L652
     Gem.refresh
 
     expected = [
-      File.expand_path('test/rubygems/sff/discover.rb', @@project_dir),
+      File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
       File.join(foo2.full_gem_path, discover_path),
       File.join(foo1.full_gem_path, discover_path),
     ]
@@ -664,7 +664,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L664
   end
 
   def test_self_find_files_with_gemfile
-    cwd = File.expand_path("test/rubygems", @@project_dir)
+    cwd = File.expand_path("test/rubygems", PROJECT_DIR)
     actual_load_path = $LOAD_PATH.unshift(cwd).dup
 
     discover_path = File.join 'lib', 'sff', 'discover.rb'
@@ -689,7 +689,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L689
     Gem.use_gemdeps(File.join Dir.pwd, 'Gemfile')
 
     expected = [
-      File.expand_path('test/rubygems/sff/discover.rb', @@project_dir),
+      File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
       File.join(foo1.full_gem_path, discover_path)
     ].sort
 
@@ -700,7 +700,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L700
   end
 
   def test_self_find_latest_files
-    cwd = File.expand_path("test/rubygems", @@project_dir)
+    cwd = File.expand_path("test/rubygems", PROJECT_DIR)
     $LOAD_PATH.unshift cwd
 
     discover_path = File.join 'lib', 'sff', 'discover.rb'
@@ -720,7 +720,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L720
     Gem.refresh
 
     expected = [
-      File.expand_path('test/rubygems/sff/discover.rb', @@project_dir),
+      File.expand_path('test/rubygems/sff/discover.rb', PROJECT_DIR),
       File.join(foo2.full_gem_path, discover_path),
     ]
 
@@ -872,12 +872,12 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L872
   end
 
   def test_self_prefix
-    assert_equal @@project_dir, Gem.prefix
+    assert_equal PROJECT_DIR, Gem.prefix
   end
 
   def test_self_prefix_libdir
     orig_libdir = RbConfig::CONFIG['libdir']
-    RbConfig::CONFIG['libdir'] = @@project_dir
+    RbConfig::CONFIG['libdir'] = PROJECT_DIR
 
     assert_nil Gem.prefix
   ensure
@@ -886,7 +886,7 @@ class TestGem < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L886
 
   def test_self_prefix_sitelibdir
     orig_sitelibdir = RbConfig::CONFIG['sitelibdir']
-    RbConfig::CONFIG['sitelibdir'] = @@project_dir
+    RbConfig::CONFIG['sitelibdir'] = PROJECT_DIR
 
     assert_nil Gem.prefix
   ensure
@@ -1867,7 +1867,7 @@ You may need to `gem install -g` to install missing gems https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem.rb#L1867
 
   def with_plugin(path)
     test_plugin_path = File.expand_path("test/rubygems/plugin/#{path}",
-                                        @@project_dir)
+                                        PROJECT_DIR)
 
     # A single test plugin should get loaded once only, in order to preserve
     # sane test semantics.
diff --git a/test/rubygems/test_gem_command_manager.rb b/test/rubygems/test_gem_command_manager.rb
index 73bfd20..3cfa4f0 100644
--- a/test/rubygems/test_gem_command_manager.rb
+++ b/test/rubygems/test_gem_command_manager.rb
@@ -4,7 +4,7 @@ require 'rubygems/command_manager' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_command_manager.rb#L4
 
 class TestGemCommandManager < Gem::TestCase
 
-  @@project_dir = File.expand_path('../../..', __FILE__).untaint
+  PROJECT_DIR = File.expand_path('../../..', __FILE__).untaint
 
   def setup
     super
@@ -60,7 +60,7 @@ class TestGemCommandManager < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_command_manager.rb#L60
 
   def test_run_interrupt
     old_load_path = $:.dup
-    $: << File.expand_path("test/rubygems", @@project_dir)
+    $: << File.expand_path("test/rubygems", PROJECT_DIR)
     Gem.load_env_plugins
 
     @command_manager.register_command :interrupt
@@ -79,7 +79,7 @@ class TestGemCommandManager < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_command_manager.rb#L79
 
   def test_run_crash_command
     old_load_path = $:.dup
-    $: << File.expand_path("test/rubygems", @@project_dir)
+    $: << File.expand_path("test/rubygems", PROJECT_DIR)
 
     @command_manager.register_command :crash
     use_ui @ui do
-- 
cgit v0.10.2


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

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