Class: GradesFirst::BranchCommand

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

Overview

Implemenation of a Thor command for enhancing git branch to include PivotalTracker information such as the story state, name and url.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBranchCommand

Returns a new instance of BranchCommand.



15
16
17
# File 'lib/gradesfirst/branch_command.rb', line 15

def initialize
  @enhanced_branches = []
end

Class Method Details

.descriptionObject

Description of the gf branch Thor command that will be used in the commandline help.



11
12
13
# File 'lib/gradesfirst/branch_command.rb', line 11

def self.description
  'List git branches with related PivotalTracker story information.'
end

Instance Method Details

#executeObject

Performs the gf branch Thor command.



20
21
22
23
24
25
26
# File 'lib/gradesfirst/branch_command.rb', line 20

def execute
  git_response = git_branch
  git_response.each_line do |branch|
    @enhanced_branches << enhanced_branch(branch.rstrip)
  end
  nil
end

#responseObject

Output response of the gf branch Thor command that contains the PivotalTracker enhanced branch names.



30
31
32
# File 'lib/gradesfirst/branch_command.rb', line 30

def response
  @enhanced_branches.join("\n") + "\n"
end