Module: Pwrake::TaskManager
- Included in:
- Rake::Application
- Defined in:
- lib/pwrake/task/task_manager.rb
Instance Method Summary collapse
- #add_prefix(task_name) ⇒ Object
-
#create_rule(*args, &block) ⇒ Object
:nodoc:.
-
#define_task(task_class, *args, &block) ⇒ Object
:nodoc:.
- #initialize ⇒ Object
- #intern(task_class, task_name) ⇒ Object
- #last_description=(description) ⇒ Object
- #resolve_args(args) ⇒ Object
Instance Method Details
#add_prefix(task_name) ⇒ Object
76 77 78 79 80 81 82 83 |
# File 'lib/pwrake/task/task_manager.rb', line 76 def add_prefix(task_name) task_name = task_name.to_s if /^\.?\.?\// =~ task_name task_name else File.join(@subflow_prefix, task_name) end end |
#create_rule(*args, &block) ⇒ Object
:nodoc:
37 38 39 40 41 42 43 |
# File 'lib/pwrake/task/task_manager.rb', line 37 def create_rule(*args, &block) # :nodoc: if block @property_by_block[block.source_location] = @last_property end @last_property = TaskProperty.new super end |
#define_task(task_class, *args, &block) ⇒ Object
:nodoc:
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/pwrake/task/task_manager.rb', line 18 def define_task(task_class, *args, &block) # :nodoc: prop = block && @property_by_block[block.source_location] unless prop prop = @last_property @last_property = TaskProperty.new end if !@disable_subflow @subflow_prefix = Rake.application.current_flow[Fiber.current] end task = super task.pw_set_property(prop) if !@disable_subflow task.property.subflow = @subflow_prefix end task ensure @subflow_prefix = nil end |
#initialize ⇒ Object
7 8 9 10 11 |
# File 'lib/pwrake/task/task_manager.rb', line 7 def initialize @property_by_block = {} @last_property = TaskProperty.new super end |
#intern(task_class, task_name) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/pwrake/task/task_manager.rb', line 56 def intern(task_class, task_name) if @subflow_prefix base_name = task_name # fix task name task_name = add_prefix(task_name) if base_name != task_name && task_class == Rake::Task sbfl = @subflow_prefix begin @subflow_prefix = nil @disable_subflow = true Rake::Task.define_task(base_name => task_name) ensure @subflow_prefix = sbfl @disable_subflow = false end end end super(task_class, task_name) end |
#last_description=(description) ⇒ Object
13 14 15 16 |
# File 'lib/pwrake/task/task_manager.rb', line 13 def last_description=(description) @last_property.parse_description(description) super end |
#resolve_args(args) ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/pwrake/task/task_manager.rb', line 45 def resolve_args(args) task_name, arg_names, deps = super(args) if @subflow_prefix # fix prerequisites deps.map! do |task_name| add_prefix(task_name) end end [task_name, arg_names, deps] end |