Created
September 2, 2015 12:05
-
-
Save ichi/9d7ecd00f5bd21c93d0a to your computer and use it in GitHub Desktop.
rakeとかcapistranoでタスクを複数回実行したい時に。(引数おんなじ場合は通常どおり2回目以降無視)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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