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 authored and drbrain committed Aug 12, 2011
1 parent 23f06a6 commit 9401dc5
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
Original file line number Diff line number Diff line change
Expand Up @@ -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 %{
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/test_rake_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9401dc5

Please sign in to comment.