Add bump major, minor, and patch version scripts for semantic versioning

This commit is contained in:
Zach Borboa
2015-01-17 03:07:16 -08:00
parent 1243678883
commit c2be7a781e
3 changed files with 75 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/php
<?php
require dirname(__FILE__) . '/../src/Curl/Curl.php';
$current_version = Curl\Curl::VERSION;
list($major, $minor, $patch) = explode('.', $current_version);
$new_version = implode('.', array($major, $minor, (string)((int)$patch += 1)));
foreach(
array(
array(
dirname(__FILE__) . '/../composer.json',
'/"version": "(?:\d+.\d+.\d+)"/',
'"version": "' . $new_version . '"',
),
array(
dirname(__FILE__) . '/../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);
}