Просмотр исходного кода

Improve build process and running logchecker

tags/v0.8.0
itismadness 6 лет назад
Родитель
Сommit
55c61f5d3f
5 измененных файлов: 99 добавлений и 3 удалений
  1. +2
    -1
      .gitignore
  2. +36
    -0
      .travis.yml
  3. +59
    -0
      bin/compile
  4. +1
    -1
      composer.lock
  5. +1
    -1
      src/LogcheckerConsole.php

+ 2
- 1
.gitignore Просмотреть файл

@@ -1,2 +1,3 @@
.idea/
vendor/
vendor/
logchecker.phar

+ 36
- 0
.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'

+ 59
- 0
bin/compile Просмотреть файл

@@ -0,0 +1,59 @@
#!/usr/bin/env php
<?php

$phar_file = 'logchecker.phar';

if (file_exists($phar_file)) {
unlink($phar_file);
}

$phar = new Phar(__DIR__.'/../'.$phar_file, FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME, $phar_file);
$phar->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 = <<<PHP
#!/usr/bin/env php
<?php
Phar::mapPhar('{$phar_file}');
require 'phar://{$phar_file}/bin/logchecker';

__HALT_COMPILER();
PHP;

$phar->setStub($stub);


$phar->stopBuffering();

//$phar->compress(Phar::GZ);

echo "{$phar_file} generated...";

+ 1
- 1
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",


+ 1
- 1
src/LogcheckerConsole.php Просмотреть файл

@@ -19,6 +19,6 @@ class LogcheckerConsole extends Application {
$analyze_command
]);

$this->setDefaultCommand($analyze_command->getName());
$this->setDefaultCommand($analyze_command->getName(), true);
}
}

Загрузка…
Отмена
Сохранить