One of the big advantages of Ruby is, that it relies on just a couple of basic things to implement different functionalities. One of the things where this taken to an extreme is IO. Borrowed from the UNIX principle "everything is a file", in Ruby "everything is IO".
So the error Errno::ENOENT - No such file or directory - getaddrinfo:
is just a generic IO error, telling you that the address http://www.domain.ch/path/to/directory
could not be found. It would be even easier to spot this error if you had provided the line-numbers in your code, as they map 1 to 1 to the stack-trace you posted.
From what I know about SSH, it does not care about URLs. It cares about host
and user
, optionally about a password, but it's better to use key based authentication.
So if you look at the net/ssh example, you will see that you have to pass the host and not an URL. In your example this would translate to something like this:
require 'net/ssh'
Net::SSH.start('www.domain.ch', 'gast') do |ssh|
ssh.exec!('ls path/to/directory')
end