Skip to content
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 bash profile support #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,22 @@ public function configure()
}
```

You can also set the `profile` property to load a profile file (.bash_profile, .profile, .bashrc, etc...)

```php
use EasyCorp\Bundle\EasyDeployBundle\Server\Property;

// ...

public function configure()
{
return $this->getConfigBuilder()
->server('deployer@hostname1', ['app'], [Property::profile => 'path/to/.bash_profile'])
// ...
;
}
```

Common Hooks
------------

Expand Down
1 change: 1 addition & 0 deletions src/Server/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ final class Property
const templates_dir = 'templates_dir';
const use_ssh_agent_forwarding = 'use_ssh_agent_forwarding';
const web_dir = 'web_dir';
const profile = 'profile';
}
4 changes: 4 additions & 0 deletions src/Task/TaskRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ private function doRun(Server $server, string $shellCommand, array $envVars): Ta
$shellCommand = sprintf('cd %s && %s', $server->get(Property::project_dir), $shellCommand);
}

if ($server->has(Property::profile)) {
$shellCommand = sprintf('source %s; %s', $server->get(Property::profile), $shellCommand);
}

// env vars aren't set with $process->setEnv() because it causes problems
// that can't be fully solved with inheritEnvironmentVariables()
if (!empty($envVars)) {
Expand Down