How to run Rake tasks programmatically

Some time ago I was told to reimplement some Rake tasks such that they would be available from a simple admin interface. Instead of that, I came up with a web interface for Rake tasks, such that exactly the same code can be run from the web and from a console.

At the core there are a couple of global methods: runnable_tasks and run_task.

{[ .rake-global | 1.hljs(=ruby=) ]}

And here is how that it’s supposed to be used:

{[ .rake-example | 1.hljs(=ruby=) ]}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.