From 9401dc591dadaeb721835a4c89f355eb6da35879 Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Fri, 5 Aug 2011 16:39:10 -0400 Subject: [PATCH] Removed Commands from DeprecatedObjectDSL module (and hence from top level namespace) --- lib/rake/dsl_definition.rb | 8 +++++--- test/test_rake_dsl.rb | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index 3294f9e6c..6d9a6b88f 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -144,10 +144,12 @@ def import(*fns) Rake.application.add_import(fn) end end + end + DeprecatedCommands = Object.new.extend(DSL) + module DeprecatedObjectDSL # :nodoc: - Commands = Object.new.extend DSL DSL.private_instance_methods(false).each do |name| line = __LINE__+1 class_eval %{ @@ -160,8 +162,8 @@ def #{name}(*args, &block) end $stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}" end - Rake::DeprecatedObjectDSL::Commands.send(:#{name}, *args, &block) - end + Rake::DeprecatedCommands.send(:#{name}, *args, &block) + end private :#{name} }, __FILE__, line end diff --git a/test/test_rake_dsl.rb b/test/test_rake_dsl.rb index 294ff2bd0..de83b89ab 100644 --- a/test/test_rake_dsl.rb +++ b/test/test_rake_dsl.rb @@ -56,6 +56,10 @@ def test_deprecated_object_dsl assert_match(/test_rake_dsl\.rb:\d+/, err) end + def test_no_commands_constant + assert ! defined?(Commands), "should not define Commands" + end + def test_deprecated_object_dsl_with_suppressed_warnings Rake.application.options.ignore_deprecate = true out, err = capture_io do