-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add 'windows_os' function - DRY ( Don't repeat yourself concept ) * Code cleanup * Add 'mkdir_if_not_exist' function - DRY ( Don't repeat yourself concept ) * Add 'git_version' function - Avoid updating the application version in future releases * Sort functions * Rename functions - 'windos_os()' to 'is_windows()' - 'mkdir_if_not_exist()' to 'create_hooks_dir()' - Replace mkdir hardcode with 'create_hooks_dir()' function * Update 'create_hooks_dir()' function - String interpolation within function
- Loading branch information
1 parent
283dd5b
commit d3ba750
Showing
12 changed files
with
69 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
use Symfony\Component\Process\Process; | ||
|
||
if (! function_exists('create_hooks_dir')) { | ||
/** | ||
* Create hook directory if not exists. | ||
* | ||
* @param string $dir | ||
* @param int $mode | ||
* @param bool $recursive | ||
* | ||
* @return void | ||
*/ | ||
function create_hooks_dir($dir, $mode = 0700, $recursive = true) | ||
{ | ||
if (! is_dir("{$dir}/hooks")) { | ||
mkdir("{$dir}/hooks", $mode, $recursive); | ||
} | ||
} | ||
} | ||
|
||
if (! function_exists('git_version')) { | ||
/** | ||
* Get latest git tag version. | ||
* | ||
* @return string | ||
*/ | ||
function git_version() | ||
{ | ||
$process = new Process('git describe --tags $(git rev-list --tags --max-count=1)'); | ||
$process->run(); | ||
|
||
return trim($process->getOutput()) ?: 'unreleased'; | ||
} | ||
} | ||
|
||
if (! function_exists('is_windows')) { | ||
/** | ||
* Determine whether the current environment is Windows based. | ||
* | ||
* @return bool | ||
*/ | ||
function is_windows() | ||
{ | ||
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters