Skip to content

The correct registration of binary script for composer #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions bin/phpcrsh
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/usr/bin/env php
<?php

$vendorDir = __DIR__.'/../vendor';

$file = $vendorDir.'/autoload.php';

if (file_exists($file)) {
$autoload = require_once $file;
} else {
echo 'Cannot find the vendor directory, have you executed composer install?';
exit(1);
if (!class_exists('\PHPCR\Shell\PhpcrShell')) {
if (is_file(__DIR__.'/../vendor/autoload.php')) {
require __DIR__.'/../vendor/autoload.php';
} elseif (is_file(__DIR__.'/../../../autoload.php')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the case of binaries installed in vendor/.composer/bin right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is case of symlink to binary from COMPOSER_BIN_DIR (default vendor/composer/bin) to vendor/phpcr/phpcr-shell/bin.

require __DIR__.'/../../../autoload.php';
} else {
echo 'Cannot find the vendor directory, have you executed composer install?'.PHP_EOL;
echo 'See https://getcomposer.org to get Composer.'.PHP_EOL;
exit(1);
}
}

$shell = \PHPCR\Shell\PhpcrShell::createShell();
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"autoload": {
"psr-0": {"": "src"}
},
"bin": ["bin/phpcrsh"],
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
Expand Down