Class: Capistrano::ServerDefinition

Class | Capistrano::ServerDefinition
In: | lib/capistrano/server_definition.rb lib/capistrano/server_definition.rb
Parent: | Object

### Methods

<=> <=> == == default_user default_user eql? eql? hash hash new new to_s to_s

### Included Modules

Comparable Comparable

### Attributes

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

### Public Class methods

default_user()

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

[Source]

        # File lib/capistrano/server_definition.rb, line 11
    11:     def self.default_user
    12:       ENV['USER'] || ENV['USERNAME'] || "not-specified"
    13:     end

default_user()

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

[Source]

        # File lib/capistrano/server_definition.rb, line 11
    11:     def self.default_user
    12:       ENV['USER'] || ENV['USERNAME'] || "not-specified"
    13:     end

new(string, options={})

[Source]

        # File lib/capistrano/server_definition.rb, line 15
    15:     def initialize(string, options={})
    16:       @user, @host, @port = string.match(/^(?:([^;,:=]+)@|)(.*?)(?::(\d+)|)$/)[1,3]
    17:
    18:       @options = options.dup
    19:       user_opt, port_opt = @options.delete(:user), @options.delete(:port)
    20:
    21:       @user ||= user_opt
    22:       @port ||= port_opt
    23:
    24:       @port = @port.to_i if @port
    25:     end

new(string, options={})

[Source]

        # File lib/capistrano/server_definition.rb, line 15
    15:     def initialize(string, options={})
    16:       @user, @host, @port = string.match(/^(?:([^;,:=]+)@|)(.*?)(?::(\d+)|)$/)[1,3]
    17:
    18:       @options = options.dup
    19:       user_opt, port_opt = @options.delete(:user), @options.delete(:port)
    20:
    21:       @user ||= user_opt
    22:       @port ||= port_opt
    23:
    24:       @port = @port.to_i if @port
    25:     end

### Public Instance methods

<=>(server)

[Source]

        # File lib/capistrano/server_definition.rb, line 27
    27:     def <=>(server)
    28:       [host, port, user] <=> [server.host, server.port, server.user]
    29:     end

<=>(server)

[Source]

        # File lib/capistrano/server_definition.rb, line 27
    27:     def <=>(server)
    28:       [host, port, user] <=> [server.host, server.port, server.user]
    29:     end

==(server)

Alias for eql?

==(server)

Alias for eql?

eql?(server)

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

[Source]

        # File lib/capistrano/server_definition.rb, line 33
    33:     def eql?(server)
    34:       host == server.host &&
    35:         user == server.user &&
    36:         port == server.port
    37:     end

eql?(server)

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

[Source]

        # File lib/capistrano/server_definition.rb, line 33
    33:     def eql?(server)
    34:       host == server.host &&
    35:         user == server.user &&
    36:         port == server.port
    37:     end

hash()

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

[Source]

        # File lib/capistrano/server_definition.rb, line 43
    43:     def hash
    44:       @hash ||= [host, user, port].hash
    45:     end

hash()

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

[Source]

        # File lib/capistrano/server_definition.rb, line 43
    43:     def hash
    44:       @hash ||= [host, user, port].hash
    45:     end

to_s()

[Source]

        # File lib/capistrano/server_definition.rb, line 47
    47:     def to_s
    48:       @to_s ||= begin
    49:         s = host
    50:         s = "#{user}@#{s}" if user
    51:         s = "#{s}:#{port}" if port && port != 22
    52:         s
    53:       end
    54:     end

to_s()

[Source]

        # File lib/capistrano/server_definition.rb, line 47
    47:     def to_s
    48:       @to_s ||= begin
    49:         s = host
    50:         s = "#{user}@#{s}" if user
    51:         s = "#{s}:#{port}" if port && port != 22
    52:         s
    53:       end
    54:     end

[Validate]