I'm working on a laravel project where we use docker-compose
for local development environment and we are trying to shorten the commands that we use for install composer dependencies and artisan with laravel/envoy.
Here is an example of what we have done so far:
@task('composer-require')
docker-compose exec -u 1000 web composer require {{ $package }}
@endtask
And use as follow
envoy run composer-install --package=xxx/yyy
And now our Envoy.blade.php
file is getting to big because we have to put each usage as a task and we have to remember all those names.
I want to know if it is possible, how can we take a command like this envoy run composer install xxx/yyy
and define only a task named composer
and then pass the install xxx/yyy
part?
Sory about my english
You can pass the arguments like this envoy run deploy --command=require --package=laracasts/flash.
You can also set defaults for --package
and --command
if you'd like. Where possible, use a deploy "story" rather than running one task at a time.
@servers(['web' => '127.0.0.1'])
@setup
$package = isset($package) ? $package : "laravel/envoy";
$command = isset($command) ? $command : "require";
@endsetup
@story('deploy')
composer
@endstory
@task('composer')
echo "Running: composer {{ $command }} {{ $package }}.";
composer {{ $command }} {{ $package }}
@endtask
@finished
echo "Envoy deployment complete.\r\n";
@endfinished
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With