Class: GradesFirst::PairCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/gradesfirst/pair_command.rb

Overview

Implementation of a Thor command for determining who your next pair is for pair programming or code review.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.descriptionObject

Description of the “gf pair” Thor command that will be used in the commandline help.



10
11
12
# File 'lib/gradesfirst/pair_command.rb', line 10

def self.description
  'Show the current developer pairings.'
end

.long_descriptionObject

Description of the “gf pair” Thor commeand that will be used in the commandline help to provide a complete description.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/gradesfirst/pair_command.rb', line 16

def self.long_description
  "  Developer pairings are calculated based on a zero day date and the list\n  people who are developers.  The actual pairings are made by a round robin\n  tournament algorithm.\n\n  In order for this command to work correctly, the environment variables\n  GF_DAY_ZERO and GF_DEVELOPERS need to be properly defined.  These can\n  be actual environment variables, a .env file, or .env.master file.  The\n  .env file can be in the current directory or the home directory.  The\n  .env.master file must be in the current directory.  The precedence order\n  is environment variables, .env in the current directory, .env in the\n  home directory, and .env.master in the current directory.  It is\n  recommended that .env.master be committed to source control and the\n  other options used to override .env.master.\n\n  GF_DAY_ZERO is a date in a valid Ruby date string format.\n\n  GF_DEVELOPERS is a pipe (|) delimited list of names.\n\n  Examples:\n\n  GF_DAY_ZERO=\"2014-3-10 00:00:00\"\n\n  GF_DEVELOPERS=\"Anthony Crumley|Tom Miller|Andrew Sellers\"\n  LONG_DESCRIPTION\nend\n"

Instance Method Details

#executeObject

Performs the gf pair Thor command which determines the current developer pairings.



46
47
48
# File 'lib/gradesfirst/pair_command.rb', line 46

def execute
  @pairing = pairings[pairing_index]
end

#responseObject

Generates the command line output response. The output of the pair command will be a list of developer pairings for code review, pair programming, etc.



53
54
55
# File 'lib/gradesfirst/pair_command.rb', line 53

def response
  @pairing.map{|pair| pair.compact.join(' and ')}.join("\n") + "\n"
end