Skip to content

Commit

Permalink
Merge pull request #1441 from les-enovateurs/update_cli_directory
Browse files Browse the repository at this point in the history
fix: added cli/launcher.bat and add changelog #1440
  • Loading branch information
jenovateurs authored Apr 2, 2020
2 parents 40e8e99 + b9a6ec2 commit 0d2dfb2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# [4.0.2](https://github.com/phalcon/cphalcon/releases/tag/v4.0.2) (2020-xx-xx)
## Added
- Added launcher.bat to run cli with Windows and used DIRECTORY_SEPARATOR to find the file. [#1440](https://github.com/phalcon/phalcon-devtools/issues/1440) [@jenovateurs](https://github.com/jenovateurs)
## Changed

## Fixed
- Fixed Scaffold templates errors and phpstan errors. [#1429](https://github.com/phalcon/phalcon-devtools/issues/1429) [@jenovateurs](https://github.com/jenovateurs)
11 changes: 9 additions & 2 deletions src/Builder/Project/Cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,20 @@ public function build(): bool
*/
private function createLauncher()
{
$getFile = $this->options->get('templatePath') . '/project/cli/launcher';
$getFile = $this->options->get('templatePath') .
DIRECTORY_SEPARATOR . 'project' .
DIRECTORY_SEPARATOR . 'cli' .
DIRECTORY_SEPARATOR . 'launcher';

$putFile = $this->options->get('projectPath') . 'run';
$this->generateFile($getFile, $putFile);
chmod($putFile, 0755);

if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$getFile = $this->options->get('templatePath') . '/project/cli/launcher.bat';
$getFile = $this->options->get('templatePath') .
DIRECTORY_SEPARATOR . 'project' .
DIRECTORY_SEPARATOR . 'cli' .
DIRECTORY_SEPARATOR . 'launcher.bat';
$putFile = $this->options->get('projectPath') . 'run.bat';
$this->generateFile($getFile, $putFile);
}
Expand Down
4 changes: 4 additions & 0 deletions templates/project/cli/launcher.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@echo off

set CURRENT_PATH=%~dp0
php %CURRENT_PATH%run
4 changes: 2 additions & 2 deletions templates/project/modules/launcher.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@echo off

set PATH=%~dp0
php %PATH%launcher
set CURRENT_PATH=%~dp0
php %CURRENT_PATH%launcher

0 comments on commit 0d2dfb2

Please sign in to comment.