Posted about 1 month ago. Visible to the public.

Run code before or after an existing Rake task

Before

To run additional code before an existing Rake tasks you can add a dependency like this:

Copy
task :before_task do # runs before :existing_task end Rake::Tasks[:existing_task].enhance [:before_task]

The new dependency will be called after all existing dependencies.

After

To run additional code after an existing Rake tasks, pass a block to enhance:

Copy
Rake::Tasks[:existing_task].enhance do # runs after :existing task end
Growing Rails Applications in Practice
Check out our new e-book:
Learn to structure large Ruby on Rails codebases with the tools you already know and love.

Owner of this card:

Avatar
Henning Koch
Last edit:
about 1 month ago
by Henning Koch
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Henning Koch to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more