Created
September 6, 2017 09:38
-
-
Save unfunco/5f350ae54df7362511c6621023f946aa to your computer and use it in GitHub Desktop.
Rake tasks for Symfony console commands
This file contains 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
require 'json' | |
# Retrieves all the available Symfony console commands and creates a Rake task | |
# for each. In it's current generic state, this proxies the Rake task to the | |
# Symfony console, but this can be changed easily to execute the command within | |
# a containerised or virtualised environment. | |
SF_CONSOLE_COMMANDS = JSON.parse(`bin/console list --format=json`)['commands'] | |
SF_CONSOLE_COMMANDS.each do |command, _| | |
task_name, task_description = command.values_at('name', 'description') | |
desc task_description | |
task task_name do | |
`bin/console #{task_name}` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment