Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/jimweirich/rake
Browse files Browse the repository at this point in the history
Conflicts:
	lib/rake/version.rb
	test/test_rake_application_options.rb
  • Loading branch information
quix committed May 11, 2011
2 parents 65825ba + 86db710 commit 46d43a2
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 4 additions & 3 deletions bin/rake
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
#++

begin
require 'rake'
rescue LoadError
require 'rubygems'
require 'rake'
rescue LoadError
end

require 'rake'

Rake.application.run
52 changes: 52 additions & 0 deletions doc/release_notes/rake-0.9.1.rdoc
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions lib/rake/dsl.rb

This file was deleted.

19 changes: 19 additions & 0 deletions lib/rake/dsl_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ module DSL
private(*FileUtils.instance_methods(false))
private(*FileUtilsExt.instance_methods(false))

private

# Declare a basic task.
#
# Example:
Expand Down Expand Up @@ -137,7 +139,24 @@ 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|
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
end
end

extend FileUtilsExt
end

self.extend Rake::DSL
include Rake::DeprecatedObjectDSL
2 changes: 1 addition & 1 deletion lib/rake/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Version
NUMBERS = [
MAJOR = 0,
MINOR = 9,
BUILD = 0,
BUILD = 1,
DRAKE_MAJOR = 0,
DRAKE_MINOR = 3,
DRAKE_BUILD = 0,
Expand Down
4 changes: 3 additions & 1 deletion test/data/access/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
26 changes: 19 additions & 7 deletions test/test_rake_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,26 @@ def name.to_str
refute_nil Rake::Task["bob:t"]
end

def test_dsl_not_toplevel_by_default
actual = TOPLEVEL_BINDING.instance_eval { defined?(task) }
assert_nil actual
class Foo
def initialize
task :foo_deprecated_a => "foo_deprecated_b" do
print "a"
end
file "foo_deprecated_b" do
print "b"
end
end
end

def test_dsl_toplevel_when_require_rake_dsl
ruby '-I./lib', '-rrake/dsl', '-e', 'task(:x) { }', :verbose => false

assert $?.exitstatus
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)
assert_match(/Foo\#file/, err)
assert_match(/test_rake_dsl\.rb:\d+/, err)
end
end

0 comments on commit 46d43a2

Please sign in to comment.