Skip to content
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

simplify init #288

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
23 changes: 1 addition & 22 deletions bin-stub/phparkitect
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,7 @@ use Arkitect\CLI\Check;
use Arkitect\CLI\Command\Init;
use Arkitect\CLI\Version;

foreach (array(__DIR__ . '/../../../autoload.php', __DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
if (file_exists($file)) {
define('PHPARKITECT_COMPOSER_INSTALL', $file);

break;
}
}

unset($file);

if (!defined('PHPARKITECT_COMPOSER_INSTALL')) {
fwrite(
STDERR,
'You need to set up the project dependencies using Composer:' . PHP_EOL . PHP_EOL .
' composer install' . PHP_EOL . PHP_EOL .
'You can learn all about Composer on https://getcomposer.org/.' . PHP_EOL
);

die(1);
}

require PHPARKITECT_COMPOSER_INSTALL;
require __DIR__ . '/../vendor/autoload.php';
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK the only thing the above code is supposed to do is setting PHPARKITECT_COMPOSER_INSTALL as a way to say the package was installed via composer 🤔

To me it can be safely removed

On the other hand, I am not totally sure about adding this line: what is it effect?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To me seems more like:

  • try to find and autoloader (why? it's always in the same place)
  • setup a warning if composer install has not been executed yet
  • include the autoload

The situation is different if we are searching the autoload of the project ouside of the phar, but I don't think it's this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

you are totally right... let's remove it then


$application = new Application('PHPArkitect', Version::get());

Expand Down