Skip to content

Commit f11c655

Browse files
committed
Corrected registration of binary script for composer
1 parent 6835681 commit f11c655

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

bin/phpcrsh

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/usr/bin/env php
22
<?php
33

4-
$vendorDir = __DIR__.'/../vendor';
5-
6-
$file = $vendorDir.'/autoload.php';
7-
8-
if (file_exists($file)) {
9-
$autoload = require_once $file;
10-
} else {
11-
echo 'Cannot find the vendor directory, have you executed composer install?';
12-
exit(1);
4+
if (!class_exists('\PHPCR\Shell\PhpcrShell')) {
5+
if (is_file(__DIR__.'/../vendor/autoload.php')) {
6+
require __DIR__.'/../vendor/autoload.php';
7+
} elseif (is_file(__DIR__.'/../../../autoload.php')) {
8+
require __DIR__.'/../../../autoload.php';
9+
} else {
10+
echo 'Cannot find the vendor directory, have you executed composer install?'.PHP_EOL;
11+
echo 'See https://getcomposer.org to get Composer.'.PHP_EOL;
12+
exit(1);
13+
}
1314
}
1415

1516
$shell = \PHPCR\Shell\PhpcrShell::createShell();

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"autoload": {
4444
"psr-0": {"": "src"}
4545
},
46+
"bin": ["bin/phpcrsh"],
4647
"extra": {
4748
"branch-alias": {
4849
"dev-master": "1.0-dev"

0 commit comments

Comments
 (0)