-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new build system and fixed some bugs
New version New choice function Fix windows bug on read Fix notice and warnings Fix some possible issues BREAKING CHANGE: later version can't no more update to latest
- Loading branch information
1 parent
f812aef
commit 47eaf97
Showing
13 changed files
with
428 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
<?php | ||
|
||
|
||
return PhpCsFixer\Config::create() | ||
->setUsingCache(true) | ||
->setRiskyAllowed(true) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,43 +13,30 @@ define('ROOT', dirname(__DIR__)); | |
|
||
require ROOT . '/vendor/autoload.php'; | ||
|
||
$input = ROOT . '/src/scanner'; | ||
$output = ROOT . '/dist/scanner'; | ||
|
||
$jc = new JuggleCode(); | ||
$jc->masterfile = $input; | ||
$jc->outfile = $output; | ||
$jc->mergeScripts = true; | ||
$jc->run(); | ||
|
||
if(empty($argv[1])) { | ||
$version = "0.4.0"; | ||
} else { | ||
$version = $argv[1]; | ||
} | ||
$input = ROOT . '/src/'; | ||
$output = ROOT . '/dist/scanner.phar'; | ||
$finalOutput = ROOT . '/dist/scanner'; | ||
|
||
$date = date("d-m-Y"); | ||
$year = date("Y"); | ||
$comment = <<<EOD | ||
<?php | ||
// clean up | ||
if (file_exists($output)) { | ||
unlink($output); | ||
} | ||
if (file_exists($output . '.gz')) { | ||
unlink($output . '.gz'); | ||
} | ||
if (file_exists($finalOutput)) { | ||
unlink($finalOutput); | ||
} | ||
// create phar | ||
$p = new Phar($output); | ||
|
||
/** | ||
* PHP Antimalware Scanner | ||
* Distribution generated on $date | ||
* @version $version | ||
* @author Marco Cesarato <[email protected]> | ||
* @copyright Copyright (c) $year | ||
* @license http://opensource.org/licenses/gpl-3.0.html GNU Public License | ||
* @link https://github.com/marcocesarato/PHP-Antimalware-Scanner | ||
*/ | ||
// creating our library using whole directory | ||
$p->buildFromDirectory($input); | ||
|
||
EOD; | ||
// pointing main file which requires all classes | ||
$p->setDefaultStub('index.php', '/index.php'); | ||
|
||
unset($p); | ||
rename($output, $finalOutput); | ||
|
||
$file = php_strip_whitespace($output); | ||
$file = preg_replace('/namespace marcocesarato\\\\amwscan\;\s*/si', '', $file); | ||
$file = preg_replace('/public\s*static\s*\$VERSION\s*=\s*(\"|\\\')0\.5\.0(\"|\\\')\s*\;/si', 'public static $VERSION = "'.$version.'";', $file); | ||
$from = '/'.preg_quote("<?php", '/').'/'; | ||
$file = preg_replace($from, $comment, $file, 1); | ||
$file = "#!/usr/bin/php" . PHP_EOL . $file; | ||
$file = file_put_contents($output, $file); | ||
echo "$output successfully created"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.