class Chake::Node
Attributes
Public Class Methods
Source
# File lib/chake/node.rb, line 16 def self.max_node_name_length @max_node_name_length ||= 0 end
Source
# File lib/chake/node.rb, line 24 def initialize(hostname, data = {}) uri = parse_uri(hostname) @connection_name = uri.scheme @hostname = uri.host @port = uri.port @username = uri.user || Etc.getpwuid.name @remote_username = uri.user @path = uri.path @data = data set_max_node_length end
Public Instance Methods
Source
# File lib/chake/node.rb, line 42 def config_manager @config_manager ||= Chake::ConfigManager.get(self) end
Source
# File lib/chake/node.rb, line 36 def connection @connection ||= Chake::Connection.get(@connection_name).new(self) end
Source
# File lib/chake/node.rb, line 52 def log(msg) return if silent puts("%#{Node.max_node_name_length}<host>s: %<msg>s\n" % { host: hostname, msg: msg }) end
Private Instance Methods
Source
# File lib/chake/node.rb, line 69 def incomplete_uri(uri) !uri.host && ((!uri.scheme && uri.path) || (uri.scheme && uri.opaque)) end
Source
# File lib/chake/node.rb, line 60 def parse_uri(hostname) uri = URI.parse(hostname) if incomplete_uri(uri) uri = URI.parse("ssh://#{hostname}") end uri.path = nil if uri.path.empty? uri end
Source
# File lib/chake/node.rb, line 73 def set_max_node_length return if @hostname.length <= self.class.max_node_name_length self.class.max_node_name_length = @hostname.length end