Skip to content

Commit d46abf7

Browse files
committed
Tweak make-phar file
1 parent 5c5a3ec commit d46abf7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

utils/make-phar.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
define( 'WP_CLI_BUNDLE_ROOT', dirname( dirname( __FILE__ ) ) );
3+
define( 'WP_CLI_BUNDLE_ROOT', rtrim( dirname( dirname( __FILE__ ) ), '/' ) );
44

55
if ( file_exists( WP_CLI_BUNDLE_ROOT . '/vendor/autoload.php' ) ) {
66
define( 'WP_CLI_BASE_PATH', WP_CLI_BUNDLE_ROOT );
@@ -13,7 +13,7 @@
1313
exit(1);
1414
}
1515

16-
define( 'WP_CLI_ROOT', WP_CLI_VENDOR_DIR . '/wp-cli/wp-cli' );
16+
define( 'WP_CLI_ROOT', rtrim( WP_CLI_VENDOR_DIR, '/' ) . '/wp-cli/wp-cli' );
1717

1818
require WP_CLI_VENDOR_DIR . '/autoload.php';
1919
require WP_CLI_ROOT . '/php/utils.php';
@@ -233,7 +233,7 @@ function get_composer_versions( $current_version ) {
233233

234234
if ( 'cli' !== BUILD ) {
235235
// Include base project files, because the autoloader will load them
236-
if ( WP_CLI_BASE_PATH !== WP_CLI_BUNDLE_ROOT ) {
236+
if ( WP_CLI_BASE_PATH !== WP_CLI_BUNDLE_ROOT && is_dir( WP_CLI_BASE_PATH . '/src' ) ) {
237237
$finder = new Finder();
238238
$finder
239239
->files()
@@ -287,6 +287,7 @@ function get_composer_versions( $current_version ) {
287287
set_file_contents( $phar, WP_CLI_ROOT . '/VERSION', $current_version );
288288

289289
$phar_boot = str_replace( WP_CLI_BASE_PATH, '', WP_CLI_BUNDLE_ROOT . '/php/boot-phar.php' );
290+
$phar_boot = '/' . ltrim( $phar_boot, '/' );
290291
$phar->setStub( <<<EOB
291292
#!/usr/bin/env php
292293
<?php
@@ -302,5 +303,5 @@ function get_composer_versions( $current_version ) {
302303
chmod( DEST_PATH, 0755 ); // Make executable.
303304

304305
if ( ! BE_QUIET ) {
305-
echo "Generated " . DEST_PATH . PHP_EOL;
306+
echo 'Generated ' . DEST_PATH . PHP_EOL;
306307
}

0 commit comments

Comments
 (0)