From 1a6a4ca66fe599f66d716246091edb145ad3076e Mon Sep 17 00:00:00 2001 From: Eric Hodel Date: Mon, 23 May 2011 15:21:56 -0700 Subject: [PATCH 01/11] Try to load rake from RubyGems over rake from stdlib. This allows 1.9 to be installed atop a gem-installed rake but not crash --- bin/rake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/rake b/bin/rake index c9e95da61..0de43c97e 100755 --- a/bin/rake +++ b/bin/rake @@ -23,9 +23,10 @@ #++ begin - require 'rake' -rescue LoadError require 'rubygems' - require 'rake' +rescue LoadError end + +require 'rake' + Rake.application.run From 63a899d307dba6df0e694b79212d6808746c89c0 Mon Sep 17 00:00:00 2001 From: quix Date: Tue, 24 May 2011 19:48:27 -0400 Subject: [PATCH 02/11] make DSL methods private --- lib/rake/dsl_definition.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index 47762f67f..9086cfa1b 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -12,6 +12,8 @@ module DSL private(*FileUtils.instance_methods(false)) private(*FileUtilsExt.instance_methods(false)) + private + # Declare a basic task. # # Example: From a6bbe1937ed9b177b949ca168b1079227378d559 Mon Sep 17 00:00:00 2001 From: quix Date: Tue, 24 May 2011 19:48:27 -0400 Subject: [PATCH 03/11] remove rake/dsl -- top level DSL is now permanent That rake/dsl infects Object with Rake::DSL is an unintended consequence of the previous top level environment setup between 0.8.7 and 0.9.0. --- lib/rake/dsl.rb | 2 -- test/test_rake_dsl.rb | 11 ----------- 2 files changed, 13 deletions(-) delete mode 100644 lib/rake/dsl.rb diff --git a/lib/rake/dsl.rb b/lib/rake/dsl.rb deleted file mode 100644 index 88fc8e2ea..000000000 --- a/lib/rake/dsl.rb +++ /dev/null @@ -1,2 +0,0 @@ -require 'rake' -include Rake::DSL diff --git a/test/test_rake_dsl.rb b/test/test_rake_dsl.rb index 1c8050355..661a89222 100644 --- a/test/test_rake_dsl.rb +++ b/test/test_rake_dsl.rb @@ -27,15 +27,4 @@ def name.to_str end refute_nil Rake::Task["bob:t"] end - - def test_dsl_not_toplevel_by_default - actual = TOPLEVEL_BINDING.instance_eval { defined?(task) } - assert_nil actual - end - - def test_dsl_toplevel_when_require_rake_dsl - ruby '-I./lib', '-rrake/dsl', '-e', 'task(:x) { }', :verbose => false - - assert $?.exitstatus - end end From 50f22491d067eb25b832e795737e3817c07f103c Mon Sep 17 00:00:00 2001 From: quix Date: Tue, 24 May 2011 19:48:27 -0400 Subject: [PATCH 04/11] make DSL accessible through Object again, with warnings upon use --- lib/rake/dsl_definition.rb | 14 ++++++++++++++ test/data/access/Rakefile | 4 +++- test/test_rake_dsl.rb | 21 +++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index 9086cfa1b..fa0b3164f 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -139,7 +139,21 @@ def import(*fns) end end + module DeprecatedObjectDSL + dsl = Object.new.extend DSL + DSL.private_instance_methods(false).each do |name| + define_method name do |*args, &block| + $stderr.puts "WARNING: Relying upon the Rake DSL being accessible " << + "everywhere is deprecated. Include Rake::DSL into classes which " << + "use the Rake DSL methods. (#{self.class}##{name} called.)" + dsl.send(name, *args, &block) + end + private name + end + end + extend FileUtilsExt end self.extend Rake::DSL +include Rake::DeprecatedObjectDSL diff --git a/test/data/access/Rakefile b/test/data/access/Rakefile index 7052abac2..c064cace9 100644 --- a/test/data/access/Rakefile +++ b/test/data/access/Rakefile @@ -14,7 +14,9 @@ task :work do end end -task :obj do +# TODO: remove `disabled_' when DeprecatedObjectDSL removed +task :obj +task :disabled_obj do begin Object.new.instance_eval { task :xyzzy } puts "BAD:D Rake DSL are polluting objects" diff --git a/test/test_rake_dsl.rb b/test/test_rake_dsl.rb index 661a89222..1998aef32 100644 --- a/test/test_rake_dsl.rb +++ b/test/test_rake_dsl.rb @@ -27,4 +27,25 @@ def name.to_str end refute_nil Rake::Task["bob:t"] end + + class Foo + def initialize + task :foo_deprecated_a => :foo_deprecated_b do + print "a" + end + task :foo_deprecated_b do + print "b" + end + end + end + + def test_deprecated_object_dsl + out, err = capture_io do + Foo.new + Rake.application.invoke_task :foo_deprecated_a + end + assert_equal("ba", out) + assert_match(/deprecated/, err) + assert_match(/Foo\#task/, err) + end end From b55c15fb511e4c62c84dbeaa5eaafa0e8c7be646 Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Tue, 31 May 2011 23:53:45 -0400 Subject: [PATCH 05/11] Bumped to version 0.9.1 --- 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 149b2067f..4ca72b51f 100644 --- a/lib/rake/version.rb +++ b/lib/rake/version.rb @@ -3,7 +3,7 @@ module Version NUMBERS = [ MAJOR = 0, MINOR = 9, - BUILD = 0, + BUILD = 1, ] end VERSION = Version::NUMBERS.join('.') From a643163e29f10d62dcb5de04185711eeb83f337c Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Wed, 1 Jun 2011 00:00:24 -0400 Subject: [PATCH 06/11] Fixed hard-coded version test. --- test/test_rake_application_options.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_rake_application_options.rb b/test/test_rake_application_options.rb index c7649a124..0ae9465e9 100644 --- a/test/test_rake_application_options.rb +++ b/test/test_rake_application_options.rb @@ -285,7 +285,7 @@ def test_verbose end end - assert_equal "rake, version 0.9.0\n", out + assert_equal "rake, version #{Rake::VERSION}\n", out end end From f73cde7ba2367c09d06bd676f8e25573dc5e3fe2 Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Wed, 1 Jun 2011 00:29:27 -0400 Subject: [PATCH 07/11] Improved deprecated DSL method warnings. --- lib/rake/dsl_definition.rb | 9 ++++++--- test/test_rake_dsl.rb | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index fa0b3164f..d49bd1304 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -143,9 +143,12 @@ module DeprecatedObjectDSL dsl = Object.new.extend DSL DSL.private_instance_methods(false).each do |name| define_method name do |*args, &block| - $stderr.puts "WARNING: Relying upon the Rake DSL being accessible " << - "everywhere is deprecated. Include Rake::DSL into classes which " << - "use the Rake DSL methods. (#{self.class}##{name} called.)" + unless @dsl_warning + $stderr.puts "WARNING: Global access to rake DSL methods is deprecated." + $stderr.puts " ... Please Include Rake::DSL into classes which use the Rake DSL methods." + @dsl_warning = true + end + $stderr.puts "WARNING: DSL method #{self.class}##{name} called at #{caller.first}" dsl.send(name, *args, &block) end private name diff --git a/test/test_rake_dsl.rb b/test/test_rake_dsl.rb index 1998aef32..fc7b57fce 100644 --- a/test/test_rake_dsl.rb +++ b/test/test_rake_dsl.rb @@ -30,10 +30,10 @@ def name.to_str class Foo def initialize - task :foo_deprecated_a => :foo_deprecated_b do + task :foo_deprecated_a => "foo_deprecated_b" do print "a" end - task :foo_deprecated_b do + file "foo_deprecated_b" do print "b" end end @@ -47,5 +47,7 @@ def test_deprecated_object_dsl assert_equal("ba", out) assert_match(/deprecated/, err) assert_match(/Foo\#task/, err) + assert_match(/Foo\#file/, err) + assert_match(/test_rake_dsl\.rb:\d+/, err) end end From 0a1123fe021a2a078ab36b2186a55b9943e551ba Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Wed, 1 Jun 2011 00:48:15 -0400 Subject: [PATCH 08/11] Tweeked deprecated DSL method warning. --- lib/rake/dsl_definition.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index d49bd1304..8213e4df0 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -144,8 +144,8 @@ module DeprecatedObjectDSL DSL.private_instance_methods(false).each do |name| define_method name do |*args, &block| unless @dsl_warning - $stderr.puts "WARNING: Global access to rake DSL methods is deprecated." - $stderr.puts " ... Please Include Rake::DSL into classes which use the Rake DSL methods." + $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." @dsl_warning = true end $stderr.puts "WARNING: DSL method #{self.class}##{name} called at #{caller.first}" From 44aec3ceac085740bce0c385bccd65fc4d1d911c Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Wed, 1 Jun 2011 01:01:11 -0400 Subject: [PATCH 09/11] Added 0.9.1 release notes --- doc/release_notes/rake-0.9.1.rdoc | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 doc/release_notes/rake-0.9.1.rdoc diff --git a/doc/release_notes/rake-0.9.1.rdoc b/doc/release_notes/rake-0.9.1.rdoc new file mode 100644 index 000000000..70be8b568 --- /dev/null +++ b/doc/release_notes/rake-0.9.1.rdoc @@ -0,0 +1,52 @@ += Rake 0.9.1 Released + +Rake version 0.9.1 has a number of bug fixes and enhancments (see +below for more details). Additionally, the internals have be slightly +restructured and improved. + +== Changes + +Rake 0.9.1 adds back the global DSL methods, but with deprecation +messages. This allows Rake 0.9.1 to be used with older rakefiles with +warning messages. + +== 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 From 5ec5694f1effd71e4ca446cf51d8c2a5d840823d Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Wed, 1 Jun 2011 01:02:18 -0400 Subject: [PATCH 10/11] Better name for dsl warning variable. --- lib/rake/dsl_definition.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rake/dsl_definition.rb b/lib/rake/dsl_definition.rb index 8213e4df0..e49d0d77d 100644 --- a/lib/rake/dsl_definition.rb +++ b/lib/rake/dsl_definition.rb @@ -143,10 +143,10 @@ module DeprecatedObjectDSL dsl = Object.new.extend DSL DSL.private_instance_methods(false).each do |name| define_method name do |*args, &block| - unless @dsl_warning + 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." - @dsl_warning = true + @rake_dsl_warning = true end $stderr.puts "WARNING: DSL method #{self.class}##{name} called at #{caller.first}" dsl.send(name, *args, &block) From 86db7104b256956cb6807c3d38c6c8d1c50fcab8 Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Wed, 1 Jun 2011 01:02:31 -0400 Subject: [PATCH 11/11] Updated changes with DSL command changes. --- CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES b/CHANGES index 992f53b41..c4929ed81 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,9 @@ = Rake Changelog +== Version 0.9.1 + +* Added deprecation warnings to the Rake DSL methods. + == Version 0.9.0 * *Incompatible* *change*: Rake DSL commands ('task', 'file', etc.) are