mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 01:02:24 +01:00
Use release_path in simple tasks
This commit is contained in:
parent
7bd55f8dbe
commit
088511c74b
@ -3,6 +3,9 @@
|
||||
## master
|
||||
[v5.0.0-beta.2...master](https://github.com/deployphp/deployer/compare/v5.0.0-beta.2...master)
|
||||
|
||||
### Changed
|
||||
- Working path default is `release_path` instead of home for simple tasks [#1205]
|
||||
|
||||
### Fixed
|
||||
- Fixed ssh multiplexing master connection initializing
|
||||
- Fixed `dep ssh` command [#1204]
|
||||
@ -176,6 +179,7 @@
|
||||
## v4.0.0
|
||||
🙄
|
||||
|
||||
[#1205]: https://github.com/deployphp/deployer/issues/1205
|
||||
[#1204]: https://github.com/deployphp/deployer/issues/1204
|
||||
[#1000]: https://github.com/deployphp/deployer/pull/1000
|
||||
[#1003]: https://github.com/deployphp/deployer/pull/1003
|
||||
|
@ -82,9 +82,8 @@ class Task
|
||||
call_user_func($this->callback);
|
||||
|
||||
// Clear working_path
|
||||
$config = $context->getConfig();
|
||||
if ($config !== null) {
|
||||
$config->set('working_path', false);
|
||||
if ($context->getConfig() !== null) {
|
||||
$context->getConfig()->set('working_path', false);
|
||||
}
|
||||
|
||||
Context::pop();
|
||||
|
@ -145,6 +145,7 @@ function task($name, $body = null)
|
||||
$task = new GroupTask($name, $body);
|
||||
} elseif (is_string($body)) {
|
||||
$task = new T($name, function () use ($body) {
|
||||
cd('{{release_path}}');
|
||||
run($body);
|
||||
});
|
||||
} else {
|
||||
@ -252,8 +253,8 @@ function cd($path)
|
||||
*/
|
||||
function within($path, $callback)
|
||||
{
|
||||
$lastWorkingPath = workingPath();
|
||||
set('working_path', $path);
|
||||
$lastWorkingPath = get('working_path', '');
|
||||
set('working_path', parse($path));
|
||||
$callback();
|
||||
set('working_path', $lastWorkingPath);
|
||||
}
|
||||
@ -261,6 +262,7 @@ function within($path, $callback)
|
||||
/**
|
||||
* Return the current working path.
|
||||
*
|
||||
* @deprecated Will be removed in 6.x
|
||||
* @return string
|
||||
*/
|
||||
function workingPath()
|
||||
@ -283,7 +285,7 @@ function run($command, $options = [])
|
||||
$hostname = $host->getHostname();
|
||||
|
||||
$command = parse($command);
|
||||
$workingPath = workingPath();
|
||||
$workingPath = get('working_path', '');
|
||||
|
||||
if (!empty($workingPath)) {
|
||||
$command = "cd $workingPath && ($command)";
|
||||
@ -310,7 +312,7 @@ function runLocally($command, $options = [])
|
||||
$process = Deployer::get()->processRunner;
|
||||
$hostname = 'localhost';
|
||||
|
||||
$workingPath = workingPath();
|
||||
$workingPath = get('working_path', '');
|
||||
$command = parse($command);
|
||||
|
||||
if (!empty($workingPath)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user