Skip to content

Commit

Permalink
Only check for ONNX once, after any install or update command
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWithKyrian committed Apr 4, 2024
1 parent ee17c39 commit 0f61d8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is a very simple composer plugin meant to work with the [`ankane/onnxruntim
ONNXRuntime library for the current platform and architecture when the package is installed, and verifies it's
presence when the package is updated.

[`ankane/onnxruntime-php`](https://github.com/ankane/onnxruntime-php) has a way of downloading the ONNXRuntime library already, but you have to manually trigger
git has a way of downloading the ONNXRuntime library already, but you have to manually trigger
it after installing the package. This plugin automates that process.


Expand Down
6 changes: 3 additions & 3 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

use Composer\Composer;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\Installer\PackageEvent;
use Composer\Installer\PackageEvents;
use Composer\IO\IOInterface;
use Composer\Plugin\PluginInterface;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use OnnxRuntime\Vendor;

Expand All @@ -35,14 +37,12 @@ public function uninstall(Composer $composer, IOInterface $io)
public static function getSubscribedEvents(): array
{
return [
PackageEvents::POST_PACKAGE_INSTALL => ['checkOnnxRuntime', 10],
PackageEvents::POST_PACKAGE_UPDATE => ['checkOnnxRuntime', 10],
ScriptEvents::POST_INSTALL_CMD => ['checkOnnxRuntime', 10],
ScriptEvents::POST_UPDATE_CMD => ['checkOnnxRuntime', 10]
];
}

public function checkOnnxRuntime(): void
public function checkOnnxRuntime(Event $event): void
{
Vendor::check();
}
Expand Down

0 comments on commit 0f61d8f

Please sign in to comment.