From 108e41f9bf504169259dcb86bd57d44771e6c6cf Mon Sep 17 00:00:00 2001 From: Loren Sands-Ramshaw Date: Sat, 4 Jun 2011 12:47:56 -0700 Subject: [PATCH 1/5] Added missing 'do' --- doc/rakefile.rdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/rakefile.rdoc b/doc/rakefile.rdoc index 136574fe3..a00c9fd21 100644 --- a/doc/rakefile.rdoc +++ b/doc/rakefile.rdoc @@ -431,7 +431,7 @@ each other. For example: - namespace "main" + namespace "main" do task :build do # Build the main program end From 0e6587e350d405ed5933336663a7ba4f965610eb Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Sun, 5 Jun 2011 19:04:16 -0400 Subject: [PATCH 2/5] Now supporting Ruby 1.8.6 in Rake 0.9.x --- lib/rake/dsl_definition.rb | 23 +++++++++++-------- test/data/extra/Rakefile | 1 + .../data/extra/rakelib}/extra.rake | 0 test/test_rake_functional.rb | 6 ++--- 4 files changed, 17 insertions(+), 13 deletions(-) create mode 100644 test/data/extra/Rakefile rename {rakelib => test/data/extra/rakelib}/extra.rake (100%) diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index e49d0d77d..441cfd2f1 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -140,18 +140,21 @@ 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 + line = __LINE__+1 + class_eval %{ + def #{name}(*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}" + Rake::DeprecatedObjectDSL::Commands.send(:#{name}, *args, &block) end - $stderr.puts "WARNING: DSL method #{self.class}##{name} called at #{caller.first}" - dsl.send(name, *args, &block) - end - private name + private :#{name} + }, __FILE__, line end end 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_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: ' From 23e79f2f740a7800c044c78661cc430c610c1782 Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Sun, 5 Jun 2011 19:28:22 -0400 Subject: [PATCH 3/5] Added global DSL warning to list of warnings suppressed by --no-deprecate. --- lib/rake/dsl_definition.rb | 14 ++++++++------ test/test_rake_dsl.rb | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index 441cfd2f1..e0b9c6fd0 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -145,14 +145,16 @@ module DeprecatedObjectDSL line = __LINE__+1 class_eval %{ def #{name}(*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 + 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 - $stderr.puts "WARNING: DSL method \#{self.class}##{name} called at \#{caller.first}" Rake::DeprecatedObjectDSL::Commands.send(:#{name}, *args, &block) - end + end private :#{name} }, __FILE__, line end 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 From 0e4ad02550818569b02906adbebbc6f05acd9a3a Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Sun, 5 Jun 2011 19:30:39 -0400 Subject: [PATCH 4/5] Bump to version 0.9.2 --- lib/rake/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rake/version.rb b/lib/rake/version.rb index 4ca72b51f..dbad21e52 100644 --- a/lib/rake/version.rb +++ b/lib/rake/version.rb @@ -3,7 +3,7 @@ module Version NUMBERS = [ MAJOR = 0, MINOR = 9, - BUILD = 1, + BUILD = 2, ] end VERSION = Version::NUMBERS.join('.') From b2a8487575969d123d38ad8440ccfb860c060564 Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Sun, 5 Jun 2011 19:32:35 -0400 Subject: [PATCH 5/5] Added 0.9.2 release notes. --- doc/release_notes/rake-0.9.2.rdoc | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 doc/release_notes/rake-0.9.2.rdoc 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