Search code examples
phplaravel-envoy

Laravel/Envoy TaskContainer line 330 Probleme


I try for Laravel Envoy for deployment easily. But ! Despite my research, I can not find an answer.

When I try to put more than one line in a story or macro, it does not handle at all and sends me an error.

I have the impression that the TaskContainer does not manage space and takes all for a single Task. Hum... not just an impression.

Code in Envoy.blade.php :

...

@task('test_1')
    echo "test 1";
@endtask

@task('test_2')
    echo "test 2";
@endtask

@story('test')
    test_1
    test_2
@endstory

Result :

$ envoy run test

In TaskContainer.php line 330:

  Task "test_1
      test_2" is not defined.


run [--continue] [--pretend] [--path PATH] [--conf CONF] [--] <task>

Solution

  • I created pull request to fix it https://github.com/laravel/envoy/pull/168

    If you don't want clone laravel/envoy repository and change in src/TaskContainer.php

    $macro = explode(PHP_EOL, $this->trimSpaces(trim(ob_get_clean())));
    

    to:

    $macro = preg_split('/\n|\r\n?/', $this->trimSpaces(trim(ob_get_clean())));
    

    Then you can run envoy like php <envoy_dir>\bin\envoy run <task>