Class: CIJoe::Commit

Inherits:
Struct
  • Object
show all
Defined in:
lib/cijoe/commit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#projectObject

Returns the value of attribute project

Returns:

  • (Object)

    the current value of project



2
3
4
# File 'lib/cijoe/commit.rb', line 2

def project
  @project
end

#shaObject

Returns the value of attribute sha

Returns:

  • (Object)

    the current value of sha



2
3
4
# File 'lib/cijoe/commit.rb', line 2

def sha
  @sha
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



2
3
4
# File 'lib/cijoe/commit.rb', line 2

def user
  @user
end

Instance Method Details

#authorObject



7
8
9
# File 'lib/cijoe/commit.rb', line 7

def author
  raw_commit_lines[1].split(':')[-1]
end

#committed_atObject



11
12
13
# File 'lib/cijoe/commit.rb', line 11

def committed_at
  raw_commit_lines[2].split(':', 2)[-1]
end

#messageObject



15
16
17
# File 'lib/cijoe/commit.rb', line 15

def message
  raw_commit_lines[4].split(':')[-1].strip
end

#raw_commitObject



19
20
21
# File 'lib/cijoe/commit.rb', line 19

def raw_commit
  @raw_commit ||= `git show #{sha}`.chomp
end

#raw_commit_linesObject



23
24
25
# File 'lib/cijoe/commit.rb', line 23

def raw_commit_lines
  @raw_commit_lines ||= raw_commit.split("\n")
end

#urlObject



3
4
5
# File 'lib/cijoe/commit.rb', line 3

def url
  "http://github.com/#{user}/#{project}/commit/#{sha}"
end