Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 4 additions & 30 deletions dashboard.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
#!/usr/bin/env ruby

require 'colorize'
require_relative 'lib/dashboard'

dashboard = "".ljust(10)
dashboard += "Test Results".ljust(25)
dashboard += "Rubocop Results".ljust(26)
dashboard += "Time until last run".ljust(25)
dashboard += " Total"
dashboard += "\n\n"

require_relative 'game'
game = Game.new(teams: ARGV[0].split(","))


for team in game.teams
dashboard += "Team #{team.number}".ljust(10)
dashboard += team.rspec_result.ljust(25).colorize(team.rspec_color)
dashboard += team.rubocop_result.ljust(26).colorize(team.rubocop_color)
dashboard += team.time_result.ljust(25).colorize(:white)
dashboard += team.total_points.green
dashboard += "\n\n"
end

puts dashboard.bold

rules = "\n * 20 points if you get 100% of the tests passing"
rules += "\n * 10 points if you make Rubocop happy. Each offense takes one point."
rules += "\n * 10 points if you finish in 10 minutes or less. Each additional minute takes one point."

puts rules

# puts String.color_samples
team_numbers = ARGV[0].split(',')
game = Game.new(teams: team_numbers)
puts Dashboard.new(game)
38 changes: 38 additions & 0 deletions lib/dashboard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env ruby

require 'colorize'
require_relative 'game'

class Dashboard
def initialize(game)
@game = game
end

def to_s
dashboard = "".ljust(10)
dashboard += "Test Results".ljust(25)
dashboard += "Rubocop Results".ljust(26)
dashboard += "Time until last run".ljust(25)
dashboard += " Total"
dashboard += "\n\n"

game = @game


for team in game.teams
dashboard += "Team #{team.number}".ljust(10)
dashboard += team.rspec_result.ljust(25).colorize(team.rspec_color)
dashboard += team.rubocop_result.ljust(26).colorize(team.rubocop_color)
dashboard += team.time_result.ljust(25).colorize(:white)
dashboard += team.total_points.green
dashboard += "\n\n"
end


rules = "\n * 20 points if you get 100% of the tests passing"
rules += "\n * 10 points if you make Rubocop happy. Each offense takes one point."
rules += "\n * 10 points if you finish in 10 minutes or less. Each additional minute takes one point."

dashboard.bold + rules
end
end
File renamed without changes.