Sha256: 080bd4a99f08c9823b9ddc95144ac5174016fcaebe05b569795d5a3dfa20f703
Contents?: true
Size: 416 Bytes
Versions: 2
Compression:
Stored size: 416 Bytes
Contents
require 'net/ssh' module Sunzi class Endpoint attr_reader :user, :host, :port def initialize(input) input.match(/(.*@)?(.*?)(:.*)?$/) # Load ssh config if it exists ssh = Net::SSH::Config.for($2) @user = $1 && $1.delete('@') || ssh[:user] || 'root' @host = ssh[:host_name] || $2 @port = $3 && $3.delete(':') || ssh[:port] && ssh[:port].to_s || '22' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sunzi-2.1.0 | lib/sunzi/endpoint.rb |
sunzi-2.0.0 | lib/sunzi/endpoint.rb |