Skip to content

Commit

Permalink
Fix autoloader in CLI script
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrech committed Apr 4, 2018
1 parent b1426a1 commit 1c8b3fa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes between versions

## Not yet released

* Fixed autoloader in CLI script

## 2.0.0 (2018-02-12)

* Dropped support for Symfony < 3.3
Expand Down
2 changes: 1 addition & 1 deletion doc/05-cli-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $ source ~/.bashrc
To get help just run:

```
./jolinotif --help
jolinotif --help
```

In case of troubles use following format for passing the param: `--param="value"`.
Expand Down
8 changes: 7 additions & 1 deletion jolinotif
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
use Joli\JoliNotif\Notification;
use Joli\JoliNotif\NotifierFactory;

require __DIR__ . '/vendor/autoload.php';
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
$loader = require(__DIR__ . '/vendor/autoload.php');
} elseif (file_exists(__DIR__ . '/../../../vendor/autoload.php')) {
$loader = require(__DIR__ . '/../../../vendor/autoload.php');
} else {
throw new \RuntimeException('Unable to load autoloader.');
}

final class Cli
{
Expand Down

0 comments on commit 1c8b3fa

Please sign in to comment.