Class: GitBreeze::CommitMessage
- Inherits:
-
Object
- Object
- GitBreeze::CommitMessage
- Defined in:
- lib/git_breeze/commit_message.rb
Instance Method Summary collapse
-
#append(text) ⇒ Object
def keyword @message =~ /[(fix|fixes|fixed|complete|completes|completed|finish|finishes|finished|deliver|delivers|delivered)]/io $1 end.
-
#initialize(file) ⇒ CommitMessage
constructor
A new instance of CommitMessage.
- #mentions_story?(number) ⇒ Boolean
- #movelist ⇒ Object
Constructor Details
#initialize(file) ⇒ CommitMessage
Returns a new instance of CommitMessage.
4 5 6 7 |
# File 'lib/git_breeze/commit_message.rb', line 4 def initialize(file) @file = file @message = File.read(@file) end |
Instance Method Details
#append(text) ⇒ Object
def keyword
@message =~ /\[(fix|fixes|fixed|complete|completes|completed|finish|finishes|finished|deliver|delivers|delivered)\]/io
$1
end
25 26 27 28 29 30 31 32 |
# File 'lib/git_breeze/commit_message.rb', line 25 def append(text) body, postscript = parse(@message) = (body, text, postscript) File.open(@file, 'w') do |f| f.write() end end |
#mentions_story?(number) ⇒ Boolean
9 10 11 |
# File 'lib/git_breeze/commit_message.rb', line 9 def mentions_story?(number) @message =~ /^(?!#).*\[(\w+\s)?(#\d+\s)*##{number}(\s#\d+)*(\s\w+)?\]/io end |
#movelist ⇒ Object
13 14 15 16 17 18 |
# File 'lib/git_breeze/commit_message.rb', line 13 def movelist @message =~ /(m\:[\w]+)/io movecommand = $1 @message.sub! movecommand, '' movecommand end |