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

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_descObject



61
# File 'lib/chrysalis/rake_ext/intercept.rb', line 61

alias_method :rake_desc, :desc

#rake_fileObject



25
# File 'lib/chrysalis/rake_ext/intercept.rb', line 25

alias_method :rake_file, :file

#rake_file_createObject



31
# File 'lib/chrysalis/rake_ext/intercept.rb', line 31

alias_method :rake_file_create, :file_create

#rake_multitaskObject

– 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_namespaceObject



51
# File 'lib/chrysalis/rake_ext/intercept.rb', line 51

alias_method :rake_namespace, :namespace

#rake_ruleObject



56
# File 'lib/chrysalis/rake_ext/intercept.rb', line 56

alias_method :rake_rule, :rule

#rake_taskObject



19
# File 'lib/chrysalis/rake_ext/intercept.rb', line 19

alias_method :rake_task, :task

#rule(args, &block) ⇒ Object



57
58
59
# File 'lib/chrysalis/rake_ext/intercept.rb', line 57

def rule(args, &block)
  Chrysalis::Loader.instance.rule_intercept { rake_rule(args, &block) }
end

#task(args, &block) ⇒ Object



20
21
22
23
# File 'lib/chrysalis/rake_ext/intercept.rb', line 20

def task(args, &block)
  task_name, deps = Rake.application.resolve_args(args)
  Chrysalis::Loader.instance.task_intercept(task_name) { rake_task(args, &block) }
end