Skip to content

Loading…

Changed task.execute to task.invoke #1

Closed
wants to merge 1 commit into from

2 participants

@scottpayne

Execute doesn't fire off the dependencies, but invoke means a task won't fire more than once. To make it work in the context of guard, we have to reenable the task we want to run and all it's dependencies, every time.

There is probably a better way to do this.

@scottpayne scottpayne Changed task.execute to task.invoke
Execute doesn't fire off the dependencies, but invoke means a task won't fire more than once. To make it work in the context of guard, we have to reenable the task we want to run and all it's dependencies, every time.

There is probably a better way to do this.
e2403f3
@rymai rymai closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 30, 2011
  1. @scottpayne

    Changed task.execute to task.invoke

    scottpayne committed
    Execute doesn't fire off the dependencies, but invoke means a task won't fire more than once. To make it work in the context of guard, we have to reenable the task we want to run and all it's dependencies, every time.
    
    There is probably a better way to do this.
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/guard/rake.rb
View
12 lib/guard/rake.rb
@@ -37,7 +37,17 @@ def run_on_change(paths)
def run_rake_task
UI.info "running #{@task}"
- ::Rake::Task[@task].execute
+ task = ::Rake::Task[@task]
+ reenable_task_and_prerequisites task
+ task.invoke
end
+
+ private
+
+ def reenable_task_and_prerequisites(task)
+ task.reenable
+ task.prerequisites.each { |pre| reenable_task_and_prerequisites(::Rake::Task[pre]) }
+ end
+
end
end
Something went wrong with that request. Please try again.