File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change 11# Release History
22
33## update-history x.x.x (not yet released)
4+ * Bug fixes
45
56## update-history 1.0.0
67
Original file line number Diff line number Diff line change 22<?php declare (strict_types=1 );
33
44if (file_exists (__DIR__ . '/../vendor/autoload.php ' )) {
5- require __DIR__ . '/../vendor/autoload.php ' ;
6- } elseif (file_exists (__DIR__ . '/../../../autoload.php ' )) {
7- require __DIR__ . '/../../../autoload.php ' ;
5+ # Running from own package
6+ $ root = __DIR__ . '/../ ' ;
7+ } elseif (file_exists (__DIR__ . '/../../../../vendor/autoload.php ' )) {
8+ # Running from vendor/wikimedia/update-history
9+ $ root = __DIR__ . '/../../../../ ' ;
810} else {
9- echo 'Project dependencies need to be installed using composer. ' ;
11+ error_log ( 'Project dependencies need to be installed using composer. ' ) ;
1012 exit (1 );
1113}
14+ require "$ root/vendor/autoload.php " ;
1215
1316global $ argv ;
1417
1518$ which = $ argv [1 ] ?? 'patch ' ;
16- \Wikimedia \UpdateHistory \UpdateHistory::main ( $ which );
19+ \Wikimedia \UpdateHistory \UpdateHistory::main ( $ root , $ which );
Original file line number Diff line number Diff line change 99class UpdateHistory {
1010 /**
1111 * Main entry point.
12+ * @param string $root Package root (where the HISTORY.md file is found)
1213 * @param string $which One of 'patch', 'minor', or 'major'.
1314 * @return int Exit code: zero on success, non-zero on failure.
1415 */
15- public static function main ( string $ which = 'patch ' ): int {
16- $ changeLogPath = __DIR__ . ' /../ HISTORY.md' ;
16+ public static function main ( string $ root , string $ which = 'patch ' ): int {
17+ $ changeLogPath = " $ root / HISTORY.md" ;
1718 $ changeLog = file_get_contents ( $ changeLogPath );
1819 $ changeLog = preg_replace_callback (
1920 '/^(#+)( \S+)? (x\.x\.x|\d+\.\d+\.\d+)(.*)$/m ' ,
You can’t perform that action at this time.
0 commit comments