| 1 |
require 'rake/ext/core' |
| 2 |
require 'rake/task' |
| 3 |
require 'rake/file_task' |
| 4 |
require 'rake/file_creation_task' |
| 5 |
require 'rake/application' |
| 6 |
require 'rake/task_manager' |
| 7 |
|
| 8 |
###################################################################### |
| 9 |
# Rake extensions to Module. |
| 10 |
# |
| 11 |
class Module |
| 12 |
|
| 13 |
# Rename the original handler to make it available. |
| 14 |
alias :rake_original_const_missing :const_missing |
| 15 |
|
| 16 |
# Check for deprecated uses of top level (i.e. in Object) uses of |
| 17 |
# Rake class names. If someone tries to reference the constant |
| 18 |
# name, display a warning and return the proper object. Using the |
| 19 |
# --classic-namespace command line option will define these |
| 20 |
# constants in Object and avoid this handler. |
| 21 |
def const_missing(const_name) |
| 22 |
case const_name |
| 23 |
when :Task |
| 24 |
Rake.application.const_warning(const_name) |
| 25 |
Rake::Task |
| 26 |
when :FileTask |
| 27 |
Rake.application.const_warning(const_name) |
| 28 |
Rake::FileTask |
| 29 |
when :FileCreationTask |
| 30 |
Rake.application.const_warning(const_name) |
| 31 |
Rake::FileCreationTask |
| 32 |
when :RakeApp |
| 33 |
Rake.application.const_warning(const_name) |
| 34 |
Rake::Application |
| 35 |
else |
| 36 |
rake_original_const_missing(const_name) |
| 37 |
end |
| 38 |
end |
| 39 |
end |