Skip to content

Commit

Permalink
Merge pull request #25 from runyan-co/v1.1.2
Browse files Browse the repository at this point in the history
v1.1.2
  • Loading branch information
runyan-co authored Mar 31, 2022
2 parents cf4df1e + 4fb8c26 commit 6fb7a58
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"homepage": "https://github.com/runyan-co/pm",
"bin": ["pm"],
"version": "1.1.1",
"version": "1.1.2",
"authors": [
{
"name": "Alex Runyan",
Expand All @@ -22,13 +22,15 @@
"react/child-process": "^0.6.4",
"symfony/process": "^5.3",
"symfony/console": "^5.3",
"mockery/mockery": "^1.4",
"phpunit/phpunit": "^9.5"
"mockery/mockery": "^1.4"
},
"require-dev": {
"beyondcode/laravel-dump-server": "^1.7",
"nunomaduro/phpinsights": "^2.1"
},
"suggest": {
"phpunit/phpunit": "^9.5"
},
"autoload": {
"files": [
"includes/require.php"
Expand Down
25 changes: 18 additions & 7 deletions src/ProcessMaker/Cli/Reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,16 @@ public function buildResetCommands(string $branch, bool $bounce_database = false
$this->branch = $branch;

$gitCommands = ['git' => array_map(static function ($command) use ($branch) {
return Str::replace('{branch}', $branch, $command);
}, static::$gitCommands),
return Str::replace('{branch}', $branch, $command);
}, static::$gitCommands),
];

$databaseCommands = $bounce_database
? ['database' => [$this->buildDropAndCreateSqlCommand()]]
: [];
? ['database' => [$this->buildDropAndCreateSqlCommand(
Install::get('database_name'),
Install::get('database_user'),
Install::get('database_password')
)]] : [];

$dockerExecutable = Cli::findExecutable('docker');

Expand Down Expand Up @@ -178,18 +181,26 @@ public function buildArtisanInstallCommand(): string
/**
* @param string $db_name
* @param string $mysql_user
* @param string|null $mysql_password
*
* @return string
*/
public function buildDropAndCreateSqlCommand(
string $db_name = 'processmaker',
string $mysql_user = 'root'): string
string $mysql_user = 'root',
string $mysql_password = null): string
{
return "mysql -u ${mysql_user} <<EOFMYSQL
$command = "mysql -u ${mysql_user}";

if ($mysql_password) {
$command .= " -p ${mysql_password}";
}

return "$command <<EOFMYSQL
DROP DATABASE ${db_name};
EOFMYSQL
mysql -u ${mysql_user} <<EOFMYSQL
$command <<EOFMYSQL
CREATE DATABASE ${db_name};
EOFMYSQL";
}
Expand Down
2 changes: 1 addition & 1 deletion src/pm.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

Container::setInstance(new Container());

$app = new Application('ProcessMaker CLI Tool', '1.1.1');
$app = new Application('ProcessMaker CLI Tool', '1.1.2');

/*
* -------------------------------------------------+
Expand Down

0 comments on commit 6fb7a58

Please sign in to comment.