Class: GradesFirst::PairCommand
- 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
-
.description ⇒ Object
Description of the “gf pair” Thor command that will be used in the commandline help.
-
.long_description ⇒ Object
Description of the “gf pair” Thor commeand that will be used in the commandline help to provide a complete description.
Instance Method Summary collapse
-
#execute ⇒ Object
Performs the gf pair Thor command which determines the current developer pairings.
-
#response ⇒ Object
Generates the command line output response.
Class Method Details
.description ⇒ Object
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_description ⇒ Object
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 <<-LONG_DESCRIPTION Developer pairings are calculated based on a zero day date and the list people who are developers. The actual pairings are made by a round robin tournament algorithm. In order for this command to work correctly, the environment variables GF_DAY_ZERO and GF_DEVELOPERS need to be properly defined. These can be actual environment variables, a .env file, or .env.master file. The .env file can be in the current directory or the home directory. The .env.master file must be in the current directory. The precedence order is environment variables, .env in the current directory, .env in the home directory, and .env.master in the current directory. It is recommended that .env.master be committed to source control and the other options used to override .env.master. GF_DAY_ZERO is a date in a valid Ruby date string format. GF_DEVELOPERS is a pipe (|) delimited list of names. Examples: GF_DAY_ZERO="2014-3-10 00:00:00" GF_DEVELOPERS="Anthony Crumley|Tom Miller|Andrew Sellers" LONG_DESCRIPTION end |
Instance Method Details
#execute ⇒ Object
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 |
#response ⇒ Object
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 |