Skip to content

Commit bcd14ab

Browse files
authored
Merge pull request #51 from ace411/patch-1
Add textconsole bin script to package configuration
2 parents c90cae9 + 5493215 commit bcd14ab

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"dev-master": "1.3.x-dev"
2424
}
2525
},
26+
"bin": ["textconsole"],
2627
"require" : {
2728
"php": ">=7",
2829
"yooper/stop-words": "~1",

textconsole

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,31 @@
22
<?php
33
// application.php
44

5-
require 'vendor/autoload.php';
5+
foreach (
6+
[
7+
__DIR__ . '/../autoload.php',
8+
__DIR__ . '/../../autoload.php',
9+
__DIR__ . '/../vendor/autoload.php',
10+
__DIR__ . '/vendor/autoload.php',
11+
__DIR__ . '/../../vendor/autoload.php'
12+
] as $file
13+
) {
14+
if (file_exists($file)) {
15+
define('AUTOLOAD_PHP_FILE', $file);
16+
break;
17+
}
18+
}
19+
20+
if (!defined('AUTOLOAD_PHP_FILE')) {
21+
fwrite(STDERR,
22+
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
23+
'wget http://getcomposer.org/composer.phar' . PHP_EOL .
24+
'php composer.phar install' . PHP_EOL
25+
);
26+
die(1);
27+
}
28+
29+
require AUTOLOAD_PHP_FILE;
630

731
use TextAnalysis\Console\Commands\NltkPackageListCommand;
832
use TextAnalysis\Console\Commands\NltkPackageInstallCommand;

0 commit comments

Comments
 (0)