Skip to content

Instantly share code, notes, and snippets.

@ichi
Created September 2, 2015 12:05
Show Gist options
  • Select an option

  • Save ichi/9d7ecd00f5bd21c93d0a to your computer and use it in GitHub Desktop.

Select an option

Save ichi/9d7ecd00f5bd21c93d0a to your computer and use it in GitHub Desktop.
rakeとかcapistranoでタスクを複数回実行したい時に。(引数おんなじ場合は通常どおり2回目以降無視)
# 2回目以降も可能に
def run_task_reenable(task, *args)
@tasks ||= {}
unless @tasks[task] == args
Rake::Task[task].invoke *args
Rake::Task[task].reenable # Allow the task to be run again
end
@tasks[task] = args
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment