diff --git a/composer.json b/composer.json index 1e38fb3..b8d4408 100644 --- a/composer.json +++ b/composer.json @@ -18,8 +18,7 @@ "require-dev": { "mockery/mockery": "^1.0", "codedungeon/phpunit-result-printer": "^0.19.13", - "phpunit/phpunit": "^7.0", - "orchestra/testbench": "~3.5.0|~3.6.0" + "phpunit/phpunit": "^7.0" }, "autoload": { "psr-4": { diff --git a/deploy.yml.sample b/deploy.yml.sample index 342bb93..9871936 100644 --- a/deploy.yml.sample +++ b/deploy.yml.sample @@ -15,6 +15,8 @@ options: notify_channel_url: null repository: null shared_dirs: null + log_file_name: laravel.log + log_lines: 200 hosts: [] localhost: [] include: [] diff --git a/src/task/logs.php b/src/task/logs.php index 829fab8..d1089ee 100644 --- a/src/task/logs.php +++ b/src/task/logs.php @@ -2,8 +2,15 @@ namespace Deployer; -set('log_lines', 200); -set('log_command', 'cat storage/logs/laravel.log | grep -Ev "^#[[:digit:]]|^\[stacktrace\]$|^\"\}$" | tail -n {{log_lines}}'); +set('log_lines', function () { + return get('log_line', 200); +}); + +set('log_file_name', function () { + return get('log_file_name', 'laravel.log'); +}); + +set('log_command', 'cat storage/logs/{{log_file_name}} | grep -Ev "^#[[:digit:]]|^\[stacktrace\]$|^\"\}$" | tail -n {{log_lines}}'); desc('Read logs from a given host'); task('logs', function () { diff --git a/src/task/notify.php b/src/task/notify.php index 1fd4300..916a437 100644 --- a/src/task/notify.php +++ b/src/task/notify.php @@ -10,7 +10,7 @@ function sendGroupNotify(string $content) { if (! get('notify_channel_url')) { - throw new \Exception('[Laravel-Deployer]Notification is on but channel url is not set!'); + throw new \InvalidArgumentException('[Laravel-Deployer]Notification is on but channel url is not set!'); } $data = json_encode(['text' => $content]); diff --git a/tests/.build/deploy.php b/tests/.build/deploy.php index ae8e9f5..9e05ded 100644 --- a/tests/.build/deploy.php +++ b/tests/.build/deploy.php @@ -20,6 +20,8 @@ set('notify_channel_url', null); set('repository', null); set('shared_dirs', null); +set('log_file_name', 'laravel.log'); +set('log_lines', 200); /* * Hosts and localhost diff --git a/tests/Features/deploy.yml b/tests/Features/deploy.yml index 2861083..4d7c295 100644 --- a/tests/Features/deploy.yml +++ b/tests/Features/deploy.yml @@ -15,6 +15,8 @@ options: notify_channel_url: null repository: null shared_dirs: null + log_file_name: laravel.log + log_lines: 200 hosts: { } localhost: { } include: { }