/tools/Ruby/lib/ruby/gems/1.8/gems/rake-0.9.2/test/data/access/Rakefile

http://github.com/agross/netopenspace · Rakefile · 35 lines · 29 code · 5 blank · 1 comment · 0 complexity · e74222f186fa73070ed421deade4a84a MD5 · raw file

  1. TOP_LEVEL_CONSTANT = 0
  2. def a_top_level_function
  3. end
  4. task :default => [:work, :obj, :const]
  5. task :work do
  6. begin
  7. a_top_level_function
  8. puts "GOOD:M Top level methods can be called in tasks"
  9. rescue NameError => ex
  10. puts "BAD:M Top level methods can not be called in tasks"
  11. end
  12. end
  13. # TODO: remove `disabled_' when DeprecatedObjectDSL removed
  14. task :obj
  15. task :disabled_obj do
  16. begin
  17. Object.new.instance_eval { task :xyzzy }
  18. puts "BAD:D Rake DSL are polluting objects"
  19. rescue StandardError => ex
  20. puts "GOOD:D Rake DSL are not polluting objects"
  21. end
  22. end
  23. task :const do
  24. begin
  25. TOP_LEVEL_CONSTANT
  26. puts "GOOD:C Top level constants are available in tasks"
  27. rescue StandardError => ex
  28. puts "BAD:C Top level constants are NOT available in tasks"
  29. end
  30. end