我正在尝试使用 ruby(和 Net::SSH)创建一个程序来连接服务器并执行一些任务。服务器的详细信息将提供如下:
ssh://user:pass@host:port (for a host that does not yet have SSH keys)
或者
user@host
Net::SSH 需要以下格式:
Net::SSH.start('host', 'user', :password => "password")
是否有可以将 URL 处理成这种格式的 gem/stdlib?还是可以匹配不同部分的简单正则表达式?
注意:我知道并使用 capistrano,但在这种情况下,我需要较低级别的控制。