Skip to content

Commit

Permalink
Merge pull request #15 from nymo/add-vendor-sniff-windows
Browse files Browse the repository at this point in the history
add option to use sniffer for vendor install in windows
  • Loading branch information
Anton Fedurtsya authored Feb 2, 2018
2 parents 5cb8a23 + 381c92f commit 24c37c3
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions bin/phpcsoxid
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,25 @@
*/

$scriptPath = array_shift($argv);
$binDir = dirname($scriptPath);
$binDir = dirname(realpath($scriptPath));

// check if installed by coding standards repository checkout
if (!preg_match("@vendor/bin$@si", $binDir, $matches)) {
// overwrite for binDir variable with real path!
$binDir = dirname(realpath($scriptPath));
// if installed by shop composer install
if (preg_match("@vendor/bin$@si", $binDir, $matches)) {
$phpCs = "$binDir/phpcs";
$source = $binDir . "/../../";
$standard = $binDir . "/../oxid-esales/coding-standards/Oxid";

$phpCs = "$binDir/../vendor/bin/phpcs";
} elseif (preg_match("@.vendor.oxid-esales.coding-standards.bin$@si", $binDir, $matches)) {
$phpCs = $binDir . "/../../../../vendor/bin/phpcs";
$source = $binDir . "/../../../../";
$standard = $binDir . "/../Oxid";

// if installed by shop composer install
// if installed by coding standards repository checkout
} else {
$phpCs = "$binDir/phpcs";
$standard = $binDir . "/../oxid-esales/coding-standards/Oxid";
$source = $binDir . "/../../";
// overwrite for binDir variable with real path!
$binDir = dirname(realpath($scriptPath));
$phpCs = "$binDir/../vendor/bin/phpcs";
$standard = $binDir . "/../Oxid";
}

// checking if phpcs can be found
Expand Down

0 comments on commit 24c37c3

Please sign in to comment.