Class: Capistrano::Doctor::ServersDoctor

Inherits:
Object
  • Object
show all
Includes:
OutputHelpers
Defined in:
lib/capistrano/doctor/servers_doctor.rb

Defined Under Namespace

Classes: RoleWhitespaceChecker, ServerDecorator

Instance Method Summary collapse

Methods included from OutputHelpers

#puts, #table, #title, #warning

Constructor Details

#initialize(env = Capistrano::Configuration.env) ⇒ ServersDoctor

Returns a new instance of ServersDoctor.



8
9
10
# File 'lib/capistrano/doctor/servers_doctor.rb', line 8

def initialize(env=Capistrano::Configuration.env)
  @servers = env.servers.to_a
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/capistrano/doctor/servers_doctor.rb', line 12

def call
  title("Servers (#{servers.size})")
  rwc = RoleWhitespaceChecker.new(servers)

  table(servers) do |server, row|
    sd = ServerDecorator.new(server)

    row << sd.uri_form
    row << sd.roles
    row << sd.properties
    row.yellow if rwc.any_has_whitespace?(server.roles)
  end

  if rwc.whitespace_roles.any?
    warning "\nWhitespace detected in role(s) #{rwc.whitespace_roles_decorated}. " \
      "This might be a result of a mistyped \"%w()\" array literal."
  end
  puts
end