@@ -18,7 +18,6 @@ |
||
18 | 18 | |
19 | 19 | use Nette; |
20 | 20 | use Nette\Utils; |
21 | - |
|
22 | 21 | use IPub\Packages\Exceptions; |
23 | 22 | |
24 | 23 | /** |
@@ -16,13 +16,10 @@ |
||
16 | 16 | |
17 | 17 | namespace IPub\Packages\Loaders; |
18 | 18 | |
19 | -use Composer; |
|
20 | 19 | use Composer\Semver; |
21 | - |
|
22 | 20 | use Nette; |
23 | 21 | use Nette\DI; |
24 | 22 | use Nette\Utils; |
25 | - |
|
26 | 23 | use IPub\Packages\Entities; |
27 | 24 | use IPub\Packages\Exceptions; |
28 | 25 |
@@ -12,38 +12,38 @@ discard block |
||
12 | 12 | * @date 19.07.16 |
13 | 13 | */ |
14 | 14 | |
15 | -declare(strict_types = 1); |
|
15 | +declare(strict_types=1); |
|
16 | 16 | |
17 | 17 | $rootDir = getcwd(); |
18 | -$libsDir = $rootDir . DIRECTORY_SEPARATOR . 'vendor'; |
|
19 | -$wwwDir = $rootDir . DIRECTORY_SEPARATOR . 'www'; |
|
20 | -$appDir = $rootDir . DIRECTORY_SEPARATOR . 'app'; |
|
21 | -$packagesDir = $appDir . DIRECTORY_SEPARATOR . 'config'; |
|
18 | +$libsDir = $rootDir.DIRECTORY_SEPARATOR.'vendor'; |
|
19 | +$wwwDir = $rootDir.DIRECTORY_SEPARATOR.'www'; |
|
20 | +$appDir = $rootDir.DIRECTORY_SEPARATOR.'app'; |
|
21 | +$packagesDir = $appDir.DIRECTORY_SEPARATOR.'config'; |
|
22 | 22 | |
23 | 23 | if (!file_exists($packagesDir)) { |
24 | 24 | if (is_writable(dirname($packagesDir))) { |
25 | 25 | mkdir($packagesDir); |
26 | 26 | |
27 | 27 | } else { |
28 | - die('Path "' . $packagesDir . '" does not exists.'); |
|
28 | + die('Path "'.$packagesDir.'" does not exists.'); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | 32 | if (!is_writable($packagesDir)) { |
33 | - die('Path "' . $packagesDir . '" it not writable.'); |
|
33 | + die('Path "'.$packagesDir.'" it not writable.'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | foreach (['log', 'temp'] as $dir) { |
37 | - if (!is_dir($rootDir . DIRECTORY_SEPARATOR . $dir)) { |
|
38 | - mkdir($rootDir . DIRECTORY_SEPARATOR . $dir); |
|
37 | + if (!is_dir($rootDir.DIRECTORY_SEPARATOR.$dir)) { |
|
38 | + mkdir($rootDir.DIRECTORY_SEPARATOR.$dir); |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -if (!file_exists($libsDir . DIRECTORY_SEPARATOR . 'autoload.php')) { |
|
42 | +if (!file_exists($libsDir.DIRECTORY_SEPARATOR.'autoload.php')) { |
|
43 | 43 | die('autoload.php file can not be found.'); |
44 | 44 | } |
45 | 45 | |
46 | -require_once $libsDir . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
46 | +require_once $libsDir.DIRECTORY_SEPARATOR.'autoload.php'; |
|
47 | 47 | |
48 | 48 | $configurator = new Nette\Configurator; |
49 | 49 | $configurator->addParameters([ |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | ]); |
53 | 53 | |
54 | 54 | //$configurator->setDebugMode(TRUE); // Debug mode HAVE TO BE enabled on production server |
55 | -$configurator->enableDebugger($packagesDir . DIRECTORY_SEPARATOR . 'log'); |
|
55 | +$configurator->enableDebugger($packagesDir.DIRECTORY_SEPARATOR.'log'); |
|
56 | 56 | |
57 | -$configurator->setTempDirectory($packagesDir . DIRECTORY_SEPARATOR . 'temp'); |
|
58 | -$configurator->addConfig(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.neon'); |
|
57 | +$configurator->setTempDirectory($packagesDir.DIRECTORY_SEPARATOR.'temp'); |
|
58 | +$configurator->addConfig(dirname(__DIR__).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.neon'); |
|
59 | 59 | |
60 | 60 | $container = $configurator->createContainer(); |
61 | 61 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * @date 27.05.16 |
13 | 13 | */ |
14 | 14 | |
15 | -declare(strict_types = 1); |
|
15 | +declare(strict_types=1); |
|
16 | 16 | |
17 | 17 | namespace IPub\Packages\DI; |
18 | 18 | |
@@ -43,13 +43,13 @@ discard block |
||
43 | 43 | * @var array |
44 | 44 | */ |
45 | 45 | private $defaults = [ |
46 | - 'path' => NULL, // Paths where to search for packages |
|
47 | - 'dirs' => [ // Define path to folders |
|
48 | - 'configDir' => '%appDir%/config', // Path where is stored app configuration |
|
49 | - 'vendorDir' => '%appDir%/../vendor', // Path to composer vendor folder |
|
50 | - 'tempDir' => '%tempDir%', // Path to temporary folder |
|
46 | + 'path' => NULL, // Paths where to search for packages |
|
47 | + 'dirs' => [// Define path to folders |
|
48 | + 'configDir' => '%appDir%/config', // Path where is stored app configuration |
|
49 | + 'vendorDir' => '%appDir%/../vendor', // Path to composer vendor folder |
|
50 | + 'tempDir' => '%tempDir%', // Path to temporary folder |
|
51 | 51 | ], |
52 | - 'configFile' => 'config.neon', // Filename with enabled packages extensions |
|
52 | + 'configFile' => 'config.neon', // Filename with enabled packages extensions |
|
53 | 53 | 'loader' => [ |
54 | 54 | 'packageFiles' => [ |
55 | 55 | 'package.php', |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | |
77 | 77 | $builder->parameters['packages'] = []; |
78 | 78 | |
79 | - if (is_file($configuration['dirs']['configDir'] . DIRECTORY_SEPARATOR . 'packages.php')) { |
|
80 | - $packages = require $configuration['dirs']['configDir'] . DIRECTORY_SEPARATOR . 'packages.php'; |
|
79 | + if (is_file($configuration['dirs']['configDir'].DIRECTORY_SEPARATOR.'packages.php')) { |
|
80 | + $packages = require $configuration['dirs']['configDir'].DIRECTORY_SEPARATOR.'packages.php'; |
|
81 | 81 | |
82 | 82 | foreach ($packages as $name => $data) { |
83 | 83 | $builder->parameters['packages'][$name] = $data; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | ]; |
137 | 137 | |
138 | 138 | foreach ($commands as $name => $cmd) { |
139 | - $builder->addDefinition($this->prefix('commands' . lcfirst($name))) |
|
139 | + $builder->addDefinition($this->prefix('commands'.lcfirst($name))) |
|
140 | 140 | ->setType($cmd) |
141 | 141 | ->addTag(Console\DI\ConsoleExtension::TAG_COMMAND); |
142 | 142 | } |