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

Export environment #270

Closed
kuon opened this issue Aug 7, 2015 · 4 comments
Closed

Export environment #270

kuon opened this issue Aug 7, 2015 · 4 comments

Comments

@kuon
Copy link
Contributor

kuon commented Aug 7, 2015

Here:

"( #{environment_string} %s )" % yield

Exporting the environment;

"( export #{environment_string}; %s )" % yield

Would allow for variable substitution in commands, like so:

execute(:psql, '-d $DATABASE_URL')

Actually the "effect" is because of the ; I added before the command, but this requires to export the environment string to allow it's use in subsequent commands.

This would also allow more flexible prefixes.

For example:

SSHKit.config.command_map.prefix[:ruby].unshift('some shell script;')

to have ruby being executed this way:

some shell script; ruby

Of course, this is already possible, but the command loses the access to the env var because they are not exported.

@leehambley
Copy link
Member

Convincing argument, and I'm always in favour of subshells for encapsulation, given how sub shells are a nice analog of what we're doing with ruby blocks in the DSL.

What's the downside, how much stuff will we risk breaking ?

@kuon
Copy link
Contributor Author

kuon commented Aug 7, 2015

I think it should not break anything in the core. I did monkey patch it and it works to deploy a rails app.

But I am no shell guru, it might change some behavior in some way.

@leehambley
Copy link
Member

Would you care to prepare a PR and add yourself to the CHANGELOG, etc, I think this is a fair change.

@kuon
Copy link
Contributor Author

kuon commented Aug 13, 2015

#273 should cover this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants