-
Notifications
You must be signed in to change notification settings - Fork 256
Interactive Execute command #40
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
Conversation
|
Thanks @miry I'd be happy to pull a change request if you can figure a sane way to test this, and not break backwards compatibility. I think tools like |
…the remote process.
|
I updated the Example: Remote rails console using the new behavior of the namespace :rails do
desc 'Execute rails console'
task :console do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
command = ''
execute(:rails, :console) do |ch, data|
next if data.chomp == command.chomp || data.chomp == ''
print data
ch.send_data command = $stdin.gets if data =~ /^(>|\?)>/
end
end
end
end
end
end |
|
I really don't want to merge this. See GNU expect if you need to do Sent from my Nexus 4.
|
|
@leehambley if I rewrite this with |
|
That's not a valid usecase for remote automation! I'm not bear a computer Why would you possibly want to use sshkit to script something like this Sent from my Nexus 4.
|
|
@leehambley I added functional tests. It would not harm any present code. I don't want to duplicate the same logic of execution to use netssh. I also added support for local backend. I am working on refactoring and readme docs. |
|
I still hate the use case. gnu expect is sufficient for scripting short Sent from my Nexus 4.
|
|
@leehambley I have slit this PR to small ones. And the main is #65. As you can see it is quite simple. |
|
I really can't see myself merging it, the more I think about it the more it Sent from my Nexus 4.
|
|
For future readers that want a rails console in capistrano 3. Check https://gist.github.com/joost/9343156. |
|
Thought about packaging this as a Gem? (Cap 3 already includes a Lee Hambleyhttp://lee.hambley.name/ On 4 March 2014 12:09, Joost Hietbrink notifications@github.com wrote:
|
|
:) https://github.com/jetthoughts/j-cap-recipes/blob/master/lib/j-cap-recipes/tasks/rails.rake Using https://github.com/jetthoughts/j-cap-recipes#sshkit-addon Cap 3 has console, but it does not interactive. |
|
I blatantly stole @miry's work and made a standalone gem, SSHKit::Interactive. Would love feedback. |
|
@afeld nice 👍 |
Hi @leehambley
To add ability to run interactive rails console before for capistrano 2 we could do:
this solution does not work for v3, and I could not find similar.
I have patched a SSHKit to execute interactive rails console:
https://gist.github.com/miry/7196069.
Can you advice me another solution?
Also I think to store the channel and then we can redefine
on_dataor another callback method, or add block toexecutemethod with same functionality like oldrun.