Reputation: 1417
I have a Ruby on Rails 3 application, that I would like to control a remote machine via SSH access.
Basically I would like the Rails application to be able to edit files, copy them, move directories, etc. on a remote machine via SSH.
I have already created Capistrano tasks for the functions I would like to execute, but I would like to know:
Thanks!
Upvotes: 1
Views: 1648
Reputation: 2001
For #1, ruby has a net-ssh library -- http://net-ssh.rubyforge.org/ -- that includes the functionality you want.
For #2, The accepted answer to this question has the information to run Capistrano tasks from inside of rails -- Is there a better way to run a capistrano task from within rake?
Although the text says rake, it also applies to ruby generally. It should be noted, though, that depending on how your host is configured, you may have trouble with the way that Capistrano creates subshells to execute scripts, so you may need to play around with this for a bit or post a follow-up question
Upvotes: 1