Parent

Included Modules

Files

Class/Module Index [+]

Quicksearch

Capistrano::ServerDefinition

Attributes

host[R]
options[R]
port[R]
user[R]

Public Class Methods

default_user() click to toggle source

The default user name to use when a user name is not explicitly provided

# File lib/capistrano/server_definition.rb, line 11
def self.default_user
  ENV['USER'] || ENV['USERNAME'] || "not-specified"
end
new(string, options={}) click to toggle source
# File lib/capistrano/server_definition.rb, line 15
def initialize(string, options={})
  @user, @host, @port = string.match(/^(?:([^;,:=]+)@|)(.*?)(?::(\d+)|)$/)[1,3]

  @options = options.dup
  user_opt, port_opt = @options.delete(:user), @options.delete(:port)

  @user ||= user_opt
  @port ||= port_opt

  @port = @port.to_i if @port
end

Public Instance Methods

<=>(server) click to toggle source
# File lib/capistrano/server_definition.rb, line 27
def <=>(server)
  [host, port, user] <=> [server.host, server.port, server.user]
end
==(server) click to toggle source
Alias for: eql?
eql?(server) click to toggle source

Redefined, so that Array#uniq will work to remove duplicate server definitions, based solely on their host names.

# File lib/capistrano/server_definition.rb, line 33
def eql?(server)
  host == server.host &&
    user == server.user &&
    port == server.port
end
Also aliased as: ==
hash() click to toggle source

Redefined, so that Array#uniq will work to remove duplicate server definitions, based on their connection information.

# File lib/capistrano/server_definition.rb, line 43
def hash
  @hash ||= [host, user, port].hash
end
to_s() click to toggle source
# File lib/capistrano/server_definition.rb, line 47
def to_s
  @to_s ||= begin
    s = host
    s = "#{user}@#{s}" if user
    s = "#{s}:#{port}" if port && port != 22
    s
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.