Skip to content

Commit

Permalink
Search for configuration in specified path first
Browse files Browse the repository at this point in the history
  • Loading branch information
donatorsky committed Jan 12, 2019
1 parent 11c56a9 commit b194c61
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ Exit code | Name | Description
## Tips for use
- The PHAR file tries to [mount](https://secure.php.net/manual/en/phar.mount.php) directories outside of the `vendor/` directory and is currently only tested for paths directly one level above the `vendor/` directory. If you rely in some way on paths from outside of the root directory of the project, autoload may not work.
- I think that the most useful would be to generate autoloading with the option `--classmap-authoritative` for production. To make autoloading from a PHAR file work, I rewrite the generated file indexes, so it may not work for dynamic file guessing and searching.
- Watch out when using whole archive compression. Although it provides better compression ratio, it also comes with additional hack for decompressing files (overrides custom `stub.php` script) which might break autoloading. Files compression is a bit more reliable here.

## Plans for future
- Remove unnecessary whitespaces (a.k.a finish `\Donatorsky\VendorCompress\FileProcessors\StripWhitespacesPhpFileProcessor`)
Expand Down
5 changes: 4 additions & 1 deletion bin/vendor-compress
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ if (!\defined('VENDOR_COMPRESS_COMPOSER_INSTALL')) {
exit(VENDOR_COMPRESS_ERR_PROJECT_NOT_SET_UP);
}

\define('VENDOR_COMPRESS_COMPOSER_PHAR', \dirname(VENDOR_COMPRESS_COMPOSER_INSTALL) . DIRECTORY_SEPARATOR . 'vendor.phar');
\define('VENDOR_COMPRESS_PROJECT_ROOT', \dirname(VENDOR_COMPRESS_COMPOSER_INSTALL) . DIRECTORY_SEPARATOR);
\define('VENDOR_COMPRESS_COMPOSER_PHAR', VENDOR_COMPRESS_PROJECT_ROOT . 'vendor.phar');

// Fix user input
$usingFallbackConfig = false;
Expand All @@ -132,6 +133,8 @@ if (null !== $configurationOption) {
exit(VENDOR_COMPRESS_ERR_INACCESSIBLE_CONFIGURATION_FILE);
}
} elseif (
!\is_file($configurationOption = VENDOR_COMPRESS_PROJECT_ROOT . '.vendor_compress') &&
!\is_file($configurationOption = VENDOR_COMPRESS_PROJECT_ROOT . '.vendor_compress.dist') &&
!\is_file($configurationOption = \getcwd() . DIRECTORY_SEPARATOR . '.vendor_compress') &&
!\is_file($configurationOption = \getcwd() . DIRECTORY_SEPARATOR . '.vendor_compress.dist')
) {
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
],
"require": {
"php": ">=7.1",
"ext-Phar": "*",
"ext-json": "*"
},
"require-dev": {
Expand Down

0 comments on commit b194c61

Please sign in to comment.