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

command_map for piped commands #48

Open
davidosomething opened this issue Nov 14, 2013 · 5 comments
Open

command_map for piped commands #48

davidosomething opened this issue Nov 14, 2013 · 5 comments

Comments

@davidosomething
Copy link

Given:
The SSHKit (capistrano) command in question is:
execute :curl, "-s", fetch(:composer_download_url), "|", :php

My PHP binary is in the following path and set so:
SSHKit.config.command_map[:php] = '/usr/local/bin/php54'

Problem:
The :curl symbol is correctly replaced from the command map, but the :php symbol is not.

I've tested replacement by changing the :curl value in the command_map and succeeded, so I'm guessing it's because :php is in a pipe or is the second substitution that it is not replaced?

@leehambley
Copy link
Member

I've tested replacement by changing the :curl value in the command_map and succeeded, so I'm guessing it's because :php is in a pipe or is the second substitution that it is not replaced?

Only the first argument passed to _execute (which backs capture(), test(), execute(), etc) is mapped.

The string/symbol split is tricky, as what happens when someone would do:

execute :rake, :test

(which I often do), I want it expanded to (perhaps) /usr/bin/env rake test.

I'd consider a patch to make it map symbols regardless of their position, but you'd have to test it pretty thoroughly, and it'd mean a breaking change I think.

@cibulka
Copy link

cibulka commented Sep 17, 2015

Any news on this? Thank you!

@leehambley
Copy link
Member

None, apparently the thread has been quiet for more than two years. What are you looking for?

@cibulka
Copy link

cibulka commented Sep 18, 2015

I have exactly the same problem as @davidosomething. My website is built on Wordpress and hosted on a shared host. For database import/export, I would like to use capistrano-wpcli gem.

As described on lavmeiker/capistrano-wpcli#18, I have a problem with the following line:

execute :gunzip, "<", fetch(:wpcli_remote_db_file), "|", :wp, :db, :import, "-"

As you see, wp is not at the beginning of the command, so currently it is unaffected by setting SSHKit.config.command_map[:wp] = '~/wpcli.phar'.

Unfortunately the author of the gem is not replying to the issue and pull requests (this one would solve it), so it seems, that I'm in sort of a dead end on this. :)

Any thoughts?

@jeremyzahner
Copy link

@cibulka Since we got life into the repo again i guess we will most likely have a solution for this one soon.

lavmeiker/capistrano-wpcli#18

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

No branches or pull requests

4 participants