Skip to content

Commit

Permalink
Fix colors[i] would burst the index size
Browse files Browse the repository at this point in the history
  • Loading branch information
sonots committed Jan 13, 2013
1 parent 96b2ac6 commit 605b31a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/capistrano/colorized_stream.rb
Expand Up @@ -37,13 +37,16 @@ def colorized(hostname)
@colorized = {}
servers = find_servers_for_task(current_task).map(&:to_s)
len = servers.map(&:length).max
servers.each_with_index {|host, i| @colorized[host] = (host.ljust(len) + ' | ').colorize(colors[i]) }
servers.each_with_index do |host, i|
color = colors[i % colors.size]
@colorized[host] = (host.ljust(len) + ' | ').colorize(color)
end
end
@colorized[hostname]
end

def colors
%w( cyan yellow green magenta red blue light_cyan light_yellow
@collors ||= %w( cyan yellow green magenta red blue light_cyan light_yellow
light_green light_magenta light_red, light_blue ).map(&:to_sym)
end
end
Expand Down

0 comments on commit 605b31a

Please sign in to comment.