SSHKit::Interactive
An SSHKit backend that allows you to execute interactive commands on your servers. Remote commands that you might want to use this for:
- A Rails console
- A text editor
less- etc.
Installation
Add this line to your application's Gemfile:
gem 'sshkit-interactive'
And then execute:
$ bundle
If you're using Capistrano, add the following to your Capfile:
require 'sshkit/interactive'
Usage
From SSHKit, use the interactive backend (which makes a system call to ssh under the hood), then execute commands as normal.
SSHKit.config.backend = SSHKit::Interactive::Backend
hosts = %w{my.server.com}
on hosts do |host|
execute(:vim)
end
Note that you will probably only want to execute on a single host. In Capistrano, it might look something like this:
namespace :rails do
desc "Run Rails console"
task :console do
SSHKit.config.backend = SSHKit::Interactive::Backend
on primary(:app) do |host|
execute(:rails, :console)
end
end
end
Contributing
- Fork it
- Clone it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request