Class: Rake::Task
- Inherits:
-
Object
- Object
- Rake::Task
- Defined in:
- lib/only_one_rake.rb
Instance Attribute Summary collapse
-
#is_only_one_task ⇒ Object
Returns the value of attribute is_only_one_task.
-
#working_dir ⇒ Object
Returns the value of attribute working_dir.
Instance Method Summary collapse
-
#execute(args = nil) ⇒ Object
Execute the actions associated with this task.
Instance Attribute Details
#is_only_one_task ⇒ Object
Returns the value of attribute is_only_one_task.
29 30 31 |
# File 'lib/only_one_rake.rb', line 29 def is_only_one_task @is_only_one_task end |
#working_dir ⇒ Object
Returns the value of attribute working_dir.
30 31 32 |
# File 'lib/only_one_rake.rb', line 30 def working_dir @working_dir end |
Instance Method Details
#execute(args = nil) ⇒ Object
Execute the actions associated with this task.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/only_one_rake.rb', line 33 def execute(args=nil) args ||= EMPTY_TASK_ARGS if application..dryrun application.trace "** Execute (dry run) #{name}" return end if application..trace application.trace "** Execute #{name}" end application.enhance_with_matching_rule(name) if @actions.empty? # here's the patch! self.working_dir = `pwd`.strip # it'll maybe change in the task, so set it first Rake.ensure_only_one_task_is_running name, self.working_dir if self.is_only_one_task @actions.each do |act| case act.arity when 1 act.call(self) else act.call(self, args) end end end |