From 6b36f117f2c35474aa2e63ef56edba338e124d9d Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 12 Apr 2008 14:50:18 +0000 Subject: [PATCH] * prelude.rb (require_relative): move require_relative from lib/require_relative.rb. [ruby-core:16356] * lib/require_relative.rb: removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/require_relative.rb | 11 ----------- prelude.rb | 10 ++++++++++ test/ruby/test_assignment.rb | 1 - test/ruby/test_beginendblock.rb | 1 - test/ruby/test_file.rb | 1 - test/ruby/test_m17n_comb.rb | 1 - test/ruby/test_marshal.rb | 1 - test/ruby/test_pipe.rb | 1 - test/ruby/test_sprintf_comb.rb | 1 - test/ruby/test_system.rb | 1 - test/ruby/test_yield.rb | 1 - 12 files changed, 17 insertions(+), 20 deletions(-) delete mode 100644 lib/require_relative.rb diff --git a/ChangeLog b/ChangeLog index 2607bc1037..9ed4304ad3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,13 @@ Sat Apr 12 12:41:49 2008 Nobuyoshi Nakada parser_warn, e_option_supplied, warn_unless_e_option, range_op, cond0): nd_file is no longer used. +Sat Apr 12 12:17:31 2008 Yukihiro Matsumoto + + * prelude.rb (require_relative): move require_relative from + lib/require_relative.rb. [ruby-core:16356] + + * lib/require_relative.rb: removed. + Sat Apr 12 05:55:57 2008 Eric Hodel * lib/rubygems*, test/rubygems*: Update to RubyGems 1.1.1 r1701. diff --git a/lib/require_relative.rb b/lib/require_relative.rb deleted file mode 100644 index e68546f1ce..0000000000 --- a/lib/require_relative.rb +++ /dev/null @@ -1,11 +0,0 @@ -def require_relative(relative_feature) - c = caller.first - e = c.rindex(/:\d+:in /) - file = $` - if /\A\((.*)\)/ =~ file # eval, etc. - raise LoadError, "require_relative is called in #{$1}" - end - absolute_feature = File.expand_path(File.join(File.dirname(file), relative_feature)) - require absolute_feature -end - diff --git a/prelude.rb b/prelude.rb index a38a578595..fdf401b56a 100644 --- a/prelude.rb +++ b/prelude.rb @@ -23,3 +23,13 @@ class Thread end end +def require_relative(relative_feature) + c = caller.first + e = c.rindex(/:\d+:in /) + file = $` + if /\A\((.*)\)/ =~ file # eval, etc. + raise LoadError, "require_relative is called in #{$1}" + end + absolute_feature = File.expand_path(File.join(File.dirname(file), relative_feature)) + require absolute_feature +end diff --git a/test/ruby/test_assignment.rb b/test/ruby/test_assignment.rb index 2b22613c55..b82cee81d1 100644 --- a/test/ruby/test_assignment.rb +++ b/test/ruby/test_assignment.rb @@ -490,7 +490,6 @@ class TestAssignment < Test::Unit::TestCase end end -require 'require_relative' require_relative 'sentence' class TestAssignmentGen < Test::Unit::TestCase Syntax = { diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb index 2f6a5437f3..f75311f3b0 100644 --- a/test/ruby/test_beginendblock.rb +++ b/test/ruby/test_beginendblock.rb @@ -1,6 +1,5 @@ require 'test/unit' require 'tempfile' -require 'require_relative' require_relative 'envutil' class TestBeginEndBlock < Test::Unit::TestCase diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index 62e1c6341a..22dc1a89e5 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -1,6 +1,5 @@ require 'test/unit' require 'tempfile' -require 'require_relative' require_relative 'ut_eof' class TestFile < Test::Unit::TestCase diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb index ca527cc807..26efa85ea2 100644 --- a/test/ruby/test_m17n_comb.rb +++ b/test/ruby/test_m17n_comb.rb @@ -1,6 +1,5 @@ require 'test/unit' require 'stringio' -require 'require_relative' require_relative 'allpairs' class TestM17NComb < Test::Unit::TestCase diff --git a/test/ruby/test_marshal.rb b/test/ruby/test_marshal.rb index ce9882b5e8..3979e8a15f 100644 --- a/test/ruby/test_marshal.rb +++ b/test/ruby/test_marshal.rb @@ -1,5 +1,4 @@ require 'test/unit' -require 'require_relative' require_relative 'marshaltestlib' class TestMarshal < Test::Unit::TestCase diff --git a/test/ruby/test_pipe.rb b/test/ruby/test_pipe.rb index 3b47bdee53..34f231ad8c 100644 --- a/test/ruby/test_pipe.rb +++ b/test/ruby/test_pipe.rb @@ -1,5 +1,4 @@ require 'test/unit' -require 'require_relative' require_relative 'ut_eof' class TestPipe < Test::Unit::TestCase diff --git a/test/ruby/test_sprintf_comb.rb b/test/ruby/test_sprintf_comb.rb index 667ceab849..8b2c1a7e05 100644 --- a/test/ruby/test_sprintf_comb.rb +++ b/test/ruby/test_sprintf_comb.rb @@ -1,5 +1,4 @@ require 'test/unit' -require 'require_relative' require_relative 'allpairs' class TestSprintfComb < Test::Unit::TestCase diff --git a/test/ruby/test_system.rb b/test/ruby/test_system.rb index 9a897027bf..ec8aca74cb 100644 --- a/test/ruby/test_system.rb +++ b/test/ruby/test_system.rb @@ -1,6 +1,5 @@ require 'test/unit' require 'tmpdir' -require 'require_relative' require_relative 'envutil' class TestSystem < Test::Unit::TestCase diff --git a/test/ruby/test_yield.rb b/test/ruby/test_yield.rb index e1169f5d51..452c17b141 100644 --- a/test/ruby/test_yield.rb +++ b/test/ruby/test_yield.rb @@ -74,7 +74,6 @@ class TestRubyYield < Test::Unit::TestCase end end -require 'require_relative' require_relative 'sentence' class TestRubyYieldGen < Test::Unit::TestCase Syntax = {