From 55c61f5d3f8d1fca53046ea6e84dbcedf66f20b9 Mon Sep 17 00:00:00 2001 From: itismadness Date: Wed, 28 Nov 2018 20:31:33 -0500 Subject: [PATCH] Improve build process and running logchecker --- .gitignore | 3 ++- .travis.yml | 36 +++++++++++++++++++++++++++++ bin/compile | 59 +++++++++++++++++++++++++++++++++++++++++++++++ composer.lock | 2 +- src/LogcheckerConsole.php | 2 +- 5 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 .travis.yml create mode 100755 bin/compile diff --git a/.gitignore b/.gitignore index e0caea8..5433f6f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ -vendor/ \ No newline at end of file +vendor/ +logchecker.phar diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3227a12 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,36 @@ +language: php +sudo: true +dist: trusty + +cache: + directories: + - $HOME/.composer/cache + +php: + - 7.0 + - 7.1 + - 7.2 + - 7.3 + - nightly + +matrix: + fast_finish: true + allow_failures: + - php: nightly + +before_install: + - composer install --ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress + +before_deploy: + - php -d phar.readonly=0 bin/compile + +deploy: + provider: releases + api_key: + secure: jlvbD7nzOz/8vssSI75loBMJE9OosAofTu1IDMc3bfxfRaPT6c2duebJF7Bm0VCTGYWK3Wc+19wwyLpCMoueUUEtKqi6RGIUQyboQvbSEe/cje7/9PgqmFstV8LdBLNOwRVj01YcmGw/iMVc+GxPTtDZtcwVU9bzlMCwXFAlggeId0Qw6KgxN+wTbm+oS3zrIh+TnWhgeWhmMYn0/UAEUEQCsYDI+UJjGWStWdpdJqdMhidg5GQyVtomFg82ZjIw+ywYGMGgq38S4PMRBLoqbxuWs++9LPblWboxtktb4+U0xUMdHfrv/r94b8+nI2SJ1xzzUKTXS/glkk0lJAovSYew6jJiu+gsejiNyR89WNgRGwnWAUA8ZBptrM2b3sxLuZ6RuxQXP3TMpxhQQE/3aodOrACPOHa8uuct0JAj/a2p0WCIj4r76McHrXTjFzDPsbdxD1GwOQmFJGqY5EV7Vez6q++Erp/64JEZJk9/jieTv0arLe76VZPQcZ6TB488tH699MvK7Gg1cc4114FbKIEZrOKF2FOrMAZJ3husjELN0zJYeRPZUy6Y7A2PAWsqfdswlxjP9IxuDFVE/3TW8O1sVItWo4+SSkKTILzsC0qgxVL2lW9WDmyka8U5T2SAa8ye/RRZ3FJYugep49wjUsfLraRdA+Lj7KQXSaMlFa8= + file: logchecker.phar + skip_cleanup: true + on: + tags: true + repo: OPSnet/Logchecker + php: '7.2' \ No newline at end of file diff --git a/bin/compile b/bin/compile new file mode 100755 index 0000000..232d216 --- /dev/null +++ b/bin/compile @@ -0,0 +1,59 @@ +#!/usr/bin/env php +startBuffering(); + +$base_dir = realpath(__DIR__.'/../'); + +$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath(__DIR__.'/../src'), RecursiveDirectoryIterator::SKIP_DOTS)); +foreach ($it as $entry) { + $phar->addFile($entry->getPathName(), str_replace($base_dir, '', $entry->getPathName())); +} + +$vendor = [ + 'composer', + 'symfony' +]; + +foreach ($vendor as $dir) { + $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(realpath(__DIR__.'/../vendor/'.$dir), RecursiveDirectoryIterator::SKIP_DOTS)); + foreach ($it as $entry) { + $phar->addFile($entry->getPathName(), str_replace($base_dir, '', $entry->getPathName())); + } +} + +$phar->addFile(realpath(__DIR__.'/../vendor/autoload.php'), 'vendor/autoload.php'); + + +$phar->addFile(realpath(__DIR__.'/../composer.json'), 'composer.json'); +$phar->addFile(realpath(__DIR__.'/../LICENSE.md'), 'LICENSE.md'); +$phar->addFile(realpath(__DIR__.'/../README.md'), 'README.md'); + +$bin_file = file_get_contents(__DIR__.'/logchecker'); +$bin_file = preg_replace('{^#!/usr/bin/env php\s*}', '', $bin_file); +$phar->addFromString('bin/logchecker', $bin_file); + +$stub = <<setStub($stub); + + +$phar->stopBuffering(); + +//$phar->compress(Phar::GZ); + +echo "{$phar_file} generated..."; diff --git a/composer.lock b/composer.lock index e8f4dd7..575cfea 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fa52b95b461ba9af6f89994e631f51e4", + "content-hash": "1b00b9853f92c70786b4de2b5f0571f3", "packages": [ { "name": "symfony/console", diff --git a/src/LogcheckerConsole.php b/src/LogcheckerConsole.php index 7f6a7d3..46543a3 100644 --- a/src/LogcheckerConsole.php +++ b/src/LogcheckerConsole.php @@ -19,6 +19,6 @@ class LogcheckerConsole extends Application { $analyze_command ]); - $this->setDefaultCommand($analyze_command->getName()); + $this->setDefaultCommand($analyze_command->getName(), true); } } \ No newline at end of file