Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/chrysalis/rake_ext/intercept.rb
Overview
Intercept Rake’s methods for declaring tasks.
Task interception is used to construct internal tables, and synthesize tasks in the all: namespace.
Tasks declared in the course of loading a dependency are intercepted completely, and are unknown to Rake. This prevents dependencies from polluting the task space of their dependents.
Tasks declared by the main rakefile are forwarded to Rake’s original methods, ensuring that the system remains consistent.
Instance Method Summary collapse
- #desc(comment) ⇒ Object
- #file(args, &block) ⇒ Object
- #file_create(args, &block) ⇒ Object
- #multitask(args, &block) ⇒ Object
- #namespace(name = nil, &block) ⇒ Object
- #rake_desc ⇒ Object
- #rake_file ⇒ Object
- #rake_file_create ⇒ Object
-
#rake_multitask ⇒ Object
– NOTE: Intercepting directory tasks is unnecessary, because Rake itself implements them as a set of file_create tasks.
- #rake_namespace ⇒ Object
- #rake_rule ⇒ Object
- #rake_task ⇒ Object
- #rule(args, &block) ⇒ Object
- #task(args, &block) ⇒ Object
Instance Method Details
#desc(comment) ⇒ Object
62 63 64 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 62 def desc(comment) Chrysalis::Loader.instance.desc_intercept(comment) { rake_desc(comment) } end |
#file(args, &block) ⇒ Object
26 27 28 29 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 26 def file(args, &block) task_name, deps = Rake.application.resolve_args(args) Chrysalis::Loader.instance.file_task_intercept(task_name) { rake_file(args, &block) } end |
#file_create(args, &block) ⇒ Object
32 33 34 35 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 32 def file_create(args, &block) task_name, deps = Rake.application.resolve_args(args) Chrysalis::Loader.instance.file_task_intercept(task_name) { rake_file_create(args, &block) } end |
#multitask(args, &block) ⇒ Object
46 47 48 49 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 46 def multitask(args, &block) task_name, deps = Rake.application.resolve_args(args) Chrysalis::Loader.instance.task_intercept(task_name) { rake_multitask(args, &block) } end |
#namespace(name = nil, &block) ⇒ Object
52 53 54 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 52 def namespace(name=nil, &block) Chrysalis::Loader.instance.namespace_intercept(name, block) { rake_namespace(name, &block) } end |
#rake_desc ⇒ Object
61 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 61 alias_method :rake_desc, :desc |
#rake_file ⇒ Object
25 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 25 alias_method :rake_file, :file |
#rake_file_create ⇒ Object
31 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 31 alias_method :rake_file_create, :file_create |
#rake_multitask ⇒ Object
– NOTE: Intercepting directory tasks is unnecessary, because Rake itself
implements them as a set of file_create tasks. Thus, the interception
of file_create is sufficient.
alias_method :rake_directory, :directory def directory(dir) end
45 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 45 alias_method :rake_multitask, :multitask |
#rake_namespace ⇒ Object
51 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 51 alias_method :rake_namespace, :namespace |
#rake_rule ⇒ Object
56 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 56 alias_method :rake_rule, :rule |
#rake_task ⇒ Object
19 |
# File 'lib/chrysalis/rake_ext/intercept.rb', line 19 alias_method :rake_task, :task |