Class: CaptainHook::Events::PostCommit

Inherits:
Object
  • Object
show all
Defined in:
lib/captain_hook/events/post_commit.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PostCommit

Returns a new instance of PostCommit.



4
5
6
# File 'lib/captain_hook/events/post_commit.rb', line 4

def initialize(options={})
  @repo = options[:repo]
end

Instance Method Details

#authorObject



18
19
20
# File 'lib/captain_hook/events/post_commit.rb', line 18

def author
  commit.author
end

#commitObject

The represents the git commit object in question



9
10
11
# File 'lib/captain_hook/events/post_commit.rb', line 9

def commit
  @commit ||= @repo.commit(@repo.head.commit)
end

#diffObject

The diff string from the commit Concatenates all of the sub-diffs into one string



24
25
26
27
28
# File 'lib/captain_hook/events/post_commit.rb', line 24

def diff
  @diff ||= begin
    commit.diffs.collect{|diff| diff.diff}.join("\n")
  end
end

#messageObject

The commit message



14
15
16
# File 'lib/captain_hook/events/post_commit.rb', line 14

def message
  commit.message
end

#ref_nameObject



30
31
32
# File 'lib/captain_hook/events/post_commit.rb', line 30

def ref_name
  @ref_name ||= @repo.head.name
end