diff --git a/doc/rakefile.rdoc b/doc/rakefile.rdoc index 3666dab09..9007581bb 100644 --- a/doc/rakefile.rdoc +++ b/doc/rakefile.rdoc @@ -437,7 +437,7 @@ each other. For example: - namespace "main" + namespace "main" do task :build do # Build the main program end diff --git a/doc/release_notes/rake-0.9.2.rdoc b/doc/release_notes/rake-0.9.2.rdoc new file mode 100644 index 000000000..2314193f5 --- /dev/null +++ b/doc/release_notes/rake-0.9.2.rdoc @@ -0,0 +1,49 @@ += Rake 0.9.2 Released + +Rake version 0.9.2 has a few small fixes. See below for details. + +== Changes + +* Support for Ruby 1.8.6 was fixed. +* Global DSL warnings now honor --no-deprecate + +== What is Rake + +Rake is a build tool similar to the make program in many ways. But +instead of cryptic make recipes, Rake uses standard Ruby code to +declare tasks and dependencies. You have the full power of a modern +scripting language built right into your build tool. + +== Availability + +The easiest way to get and install rake is via RubyGems ... + + gem install rake (you may need root/admin privileges) + +Otherwise, you can get it from the more traditional places: + +Home Page:: http://rake.rubyforge.org/ +Download:: http://rubyforge.org/project/showfiles.php?group_id=50 +GitHub:: git://github.com/jimweirich/rake.git + +== Thanks + +As usual, it was input from users that drove a alot of these changes. The +following people either contributed patches, made suggestions or made +otherwise helpful comments. Thanks to ... + +* James M. Lawrence (quix) +* Roger Pack +* Cezary Baginski +* Sean Scot August Moon +* R.T. Lechow +* Alex Chaffee +* James Tucker +* Matthias Lüdtke +* Santiago Pastorino + +Also, bit thanks to Eric Hodel for assisting with getting this release +out the door (where "assisting" includes, but is not by any means +limited to, "pushing" me to get it done). + +-- Jim Weirich diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index e49d0d77d..e0b9c6fd0 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -140,18 +140,23 @@ def import(*fns) end module DeprecatedObjectDSL - dsl = Object.new.extend DSL + Commands = Object.new.extend DSL DSL.private_instance_methods(false).each do |name| - define_method name do |*args, &block| - unless @rake_dsl_warning - $stderr.puts "WARNING: Global access to Rake DSL methods is deprecated. Please Include" - $stderr.puts " ... Rake::DSL into classes and modules which use the Rake DSL methods." - @rake_dsl_warning = true - end - $stderr.puts "WARNING: DSL method #{self.class}##{name} called at #{caller.first}" - dsl.send(name, *args, &block) - end - private name + line = __LINE__+1 + class_eval %{ + def #{name}(*args, &block) + unless Rake.application.options.ignore_deprecate + unless @rake_dsl_warning + $stderr.puts "WARNING: Global access to Rake DSL methods is deprecated. Please include" + $stderr.puts " ... Rake::DSL into classes and modules which use the Rake DSL methods." + @rake_dsl_warning = true + end + $stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}" + end + Rake::DeprecatedObjectDSL::Commands.send(:#{name}, *args, &block) + end + private :#{name} + }, __FILE__, line end end diff --git a/lib/rake/version.rb b/lib/rake/version.rb index 4f3a76b1a..d43389134 100644 --- a/lib/rake/version.rb +++ b/lib/rake/version.rb @@ -3,10 +3,10 @@ module Version NUMBERS = [ MAJOR = 0, MINOR = 9, - BUILD = 1, + BUILD = 2, DRAKE_MAJOR = 0, DRAKE_MINOR = 3, - DRAKE_BUILD = 0, + DRAKE_BUILD = 1, ] end VERSION = Version::NUMBERS.join('.') diff --git a/test/data/extra/Rakefile b/test/data/extra/Rakefile new file mode 100644 index 000000000..5cfd6d989 --- /dev/null +++ b/test/data/extra/Rakefile @@ -0,0 +1 @@ +task :default diff --git a/rakelib/extra.rake b/test/data/extra/rakelib/extra.rake similarity index 100% rename from rakelib/extra.rake rename to test/data/extra/rakelib/extra.rake diff --git a/test/test_rake_dsl.rb b/test/test_rake_dsl.rb index fc7b57fce..294ff2bd0 100644 --- a/test/test_rake_dsl.rb +++ b/test/test_rake_dsl.rb @@ -2,6 +2,11 @@ class TestRakeDsl < Rake::TestCase + def setup + super + Rake::Task.clear + end + def test_namespace_command namespace "n" do task "t" @@ -50,4 +55,19 @@ def test_deprecated_object_dsl assert_match(/Foo\#file/, err) assert_match(/test_rake_dsl\.rb:\d+/, err) end + + def test_deprecated_object_dsl_with_suppressed_warnings + Rake.application.options.ignore_deprecate = true + out, err = capture_io do + Foo.new + Rake.application.invoke_task :foo_deprecated_a + end + assert_equal("ba", out) + refute_match(/deprecated/, err) + refute_match(/Foo\#task/, err) + refute_match(/Foo\#file/, err) + refute_match(/test_rake_dsl\.rb:\d+/, err) + ensure + Rake.application.options.ignore_deprecate = false + end end diff --git a/test/test_rake_functional.rb b/test/test_rake_functional.rb index fae231df9..8df208be5 100644 --- a/test/test_rake_functional.rb +++ b/test/test_rake_functional.rb @@ -131,8 +131,8 @@ def test_system_excludes_rakelib_files_too end def test_by_default_rakelib_files_are_included - in_environment('RAKE_SYSTEM' => 'test/data/sys') do - rake '-T', 'extra' + in_environment('RAKE_SYSTEM' => 'test/data/sys', "PWD" => 'test/data/extra') do + rake '-T', 'extra', '--trace' end assert_match %r{extra:extra}, @out end @@ -145,7 +145,7 @@ def test_implicit_system end def test_no_system - in_environment('RAKE_SYSTEM' => 'test/data/sys') do + in_environment('RAKE_SYSTEM' => 'test/data/sys', "PWD" => "test/data/extra") do rake '-G', "sys1" end assert_match %r{^Don't know how to build task}, @err # emacs wart: '