-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cd (change directory) and within (run commands within a directory and revert to the previous workingPath) #180
Conversation
@@ -140,6 +140,24 @@ function after($it, $that) | |||
$afterScenario->addAfter($scenario); | |||
} | |||
|
|||
function cd($path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add PhpDoc here, please.
… and revert to the previous working_path).
a446853
to
f5bc859
Compare
I've forced pushed the changes you've asked. Please take the time to review them. Thanks! |
Add cd (change directory) and within (run commands within a directory and revert to the previous workingPath)
Done 🍺 |
Hmmm. It's not possible to write like this:
only like this:
@tomzx Can you fix it? |
@Elfet Pretty sure that should work (at least it did when I wrote the functionality). I'll pull the latest changes and see if that still works. Edit: Works fine for me: task('test', function () {
run('pwd');
within('{deploy_path}/current', function() {
run('pwd');
});
cd('{deploy_path}');
run('pwd');
cd('{deploy_path}/shared');
run('pwd');
within('{deploy_path}/current', function() {
run('pwd');
});
run('pwd');
});
|
Hmmm, can you look at https://github.com/deployphp/deployer/blob/master/recipe/common.php#L134 |
I assume you're getting this error: It has to do with the fact that resolving the environment variable env('release_path', function () {
return str_replace("\n", '', run("readlink {deploy_path}/release"));
});
Basically, it tries to resolve One possible way to fix this might be to make the /**
* Return release path.
*/
env('release_path', '{deploy_path}/release');
/**
* Return current release path.
*/
env('current', '{deploy_path}/current'); Basically, any variable that would be used in the function cd($path)
{
env('working_path', env()->parse($path));
} |
Yes.
|
Here's my take on the
cd
function. I've also added awithin
function which allows the user to provide a callback:After the
within
function is called, the environment is reverted to the previous working path.This current implementation only support going to an absolute path. We may consider changing the implementation to support relative navigation if that is something people would want (I don't think that is the case though).
Reference: #177.