Files
php-curl-class/scripts/bump_patch_version.php
T
Zach Borboa 05a8133a66 Improve portability of scripts
Error message:
    $ ./scripts/bump_major_version.php
    -bash: ./scripts/bump_major_version.php: /usr/bin/php: bad interpreter: No such file or directory
2022-09-23 14:37:18 -07:00

23 lines
759 B
PHP
Executable File

#!/usr/bin/env php
<?php
require __DIR__ . '/../src/Curl/Curl.php';
$current_version = Curl\Curl::VERSION;
list($major, $minor, $patch) = explode('.', $current_version);
$new_version = implode('.', [$major, $minor, (string)((int)$patch += 1)]);
foreach ([
[
__DIR__ . '/../src/Curl/Curl.php',
'/const VERSION = \'(?:\d+.\d+.\d+)\';/',
'const VERSION = \'' . $new_version . '\';',
],
] as $info) {
list($filepath, $find, $replace) = $info;
$data = preg_replace($find, $replace, file_get_contents($filepath));
file_put_contents($filepath, $data);
}
$rightwards_arrow = json_decode('"\u2192"');
echo 'Bump version: ' . $current_version . ' ' . $rightwards_arrow . ' ' . $new_version . "\n";