File.open to open Remotely

View: New views
1 Messages — Rating Filter:   Alert me  

File.open to open Remotely

by Adam Akhtar-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I know that this question looks like a Webistrano question but since I
don’t know much about Ruby, I thought it might be a simple Ruby question
too.
We have installed Webistrano and Capistrano install on some server
(let’s say Server1). I have created a Webistrano project and inside it I
have defined my Host to be ‘Server2’. I have this Ruby code inside my
project:
require 'open-uri'
   writeout = open("/home/test/test.txt", "wb")
   writeout.write(“TEST”)
   writeout.close

The problem is Webistrano is giving me an error saying that
/home/test/test.txt does not exist. I believe what It’s trying to do is
to create test.txt in Server1 (Capistrano Server) instead of my defined
Host.
Is there any way in Ruby to say Open the file remotely (e.g.
“Server2:/home/test/test.txt”) (assuming there is no Server of any kind
installed on Server2).
Strange is if I have a command like run "bash --login -c 'touch
test.txt'", it will create test.txt in the right defined Host (Server2).
But ‘open’ somehow is failing.

Thanks in Advance,

Homer
--
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---