Skip to content

Commit

Permalink
Util and Phar path fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ᏒᏊᏀᏋᏒ ᏕξᏐ committed Oct 1, 2019
1 parent e4738a3 commit b2ff428
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
@author ᏒᏊᏀᏋᏒ ᏕξᏐ

## [0.3.1] - 2019-09-30
### Fixed
- PHPCS path for phar fixed
- Util fixed


## [0.3.0] - 2019-09-15
### Changed
- Messages are now colored in CLI
Expand Down
16 changes: 11 additions & 5 deletions src/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,16 +323,22 @@ public function run(array $options = null): void
*/
private function validateOptions(): void
{
// TODO: Move this validation to a separated class.
$base = dirname(__DIR__);

// First, we check for basic system requirements.
if ($this->isPhar === true) {
if (isset($this->options['phpcs']) === true) {
$base = getcwd();
$this->exitIf(
empty(shell_exec("command -v $base/{$this->options['phpcs']}")),
"'$base/{$this->options['phpcs']}' not valid phpcs command. Please, make sure it exists."
);
$cwd = getcwd();
$pathRegular = $this->options['phpcs'];
$pathRelative = "$cwd/{$this->options['phpcs']}";
if (empty(shell_exec("command -v $pathRegular")) === false) {
$this->options['phpcs'] = $pathRegular;
} elseif (empty(shell_exec("command -v $pathRelative")) === false) {
$this->options['phpcs'] = $pathRelative;
} else {
$this->exit("phpcs not found.\n\nPlease, make sure the given ``--path={$this->options['phpcs']}`` points to the correct path.");
}
} else {
$this->exitIf(
empty(shell_exec('command -v phpcs')),
Expand Down

0 comments on commit b2ff428

Please sign in to comment.