Class: GradesFirst::CommitMessageCommand

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

Overview

Implementation of a Thor command for creating a git commit message that already includes the information from the related PivotalTracker story associated with the current branch.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.descriptionObject

Description of the gf commit-message Thor command that well be usewd in the commandline help.



12
13
14
# File 'lib/gradesfirst/commit_message_command.rb', line 12

def self.description
  'Generate a git commit message in the standard format.'
end

Instance Method Details

#executeObject

Performs the gf commit-message Thor command.



17
18
19
# File 'lib/gradesfirst/commit_message_command.rb', line 17

def execute
  @story = current_story
end

#responseObject

Output response of the gf commit-message Thor command in the standard format.



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/gradesfirst/commit_message_command.rb', line 23

def response
  if @story.nil?
    ''
  else
    message = [
      "",
      "",
      constrain_line_length(@story['name'], 72),
      @story['url']
    ]
    message.join("\n") + "\n"
  end
end