Skip to content

Commit

Permalink
Removed Commands from DeprecatedObjectDSL module
Browse files Browse the repository at this point in the history
(and hence from top level namespace)
  • Loading branch information
jimweirich committed Aug 5, 2011
1 parent ac24187 commit 5fc927c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/rake/dsl_definition.rb
Expand Up @@ -144,10 +144,12 @@ def import(*fns)
Rake.application.add_import(fn) Rake.application.add_import(fn)
end end
end end

end end


DeprecatedCommands = Object.new.extend(DSL)

module DeprecatedObjectDSL # :nodoc: module DeprecatedObjectDSL # :nodoc:
Commands = Object.new.extend DSL
DSL.private_instance_methods(false).each do |name| DSL.private_instance_methods(false).each do |name|
line = __LINE__+1 line = __LINE__+1
class_eval %{ class_eval %{
Expand All @@ -160,8 +162,8 @@ def #{name}(*args, &block)
end end
$stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}" $stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}"
end end
Rake::DeprecatedObjectDSL::Commands.send(:#{name}, *args, &block) Rake::DeprecatedCommands.send(:#{name}, *args, &block)
end end
private :#{name} private :#{name}
}, __FILE__, line }, __FILE__, line
end end
Expand Down
4 changes: 4 additions & 0 deletions test/test_rake_dsl.rb
Expand Up @@ -56,6 +56,10 @@ def test_deprecated_object_dsl
assert_match(/test_rake_dsl\.rb:\d+/, err) assert_match(/test_rake_dsl\.rb:\d+/, err)
end end


def test_no_commands_constant
assert ! defined?(Commands), "should not define Commands"
end

def test_deprecated_object_dsl_with_suppressed_warnings def test_deprecated_object_dsl_with_suppressed_warnings
Rake.application.options.ignore_deprecate = true Rake.application.options.ignore_deprecate = true
out, err = capture_io do out, err = capture_io do
Expand Down

0 comments on commit 5fc927c

Please sign in to comment.