public
Fork of Caged/gitnub
Description: A Gitk-like application written in RubyCocoa that looks like it belongs on a Mac. See the wiki for downloads and screenshots.
Homepage: http://alternateidea.com
Clone URL: git://github.com/andrewlmurray/gitnub.git
Search Repo:
Caged (author)
Mon Mar 03 00:46:13 -0800 2008
commit  a6ad7f3ed651ee1b1332e58fd2a3f7ddd8c0fbee
tree    2859dbdc27b5cb345f25bb6be0e38e7c5d4726e8
parent  3f411c6f61f28b3abb4dee6a201ea4c7dc4adc21
gitnub / CommitsController.rb
100644 51 lines (40 sloc) 1.176 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
# CommitsController.rb
# GitNub
#
# Created by Justin Palmer on 3/2/08.
# Copyright (c) 2008 Active Reload, LLC. All rights reserved.
#
 
require 'osx/cocoa'
 
class CommitsController < OSX::NSObject
  attr_reader :commits, :commit
  ib_outlet :commits_table
  ib_outlet :app_controller
  
  def awakeFromNib
    @repo = Grit::Repo.new("/Users/Caged/dev/clients/digisynd/code/client.rails")
    @commits = @repo.commits('master', 100)
    @commits_table.reloadData
  end
  
  # DataSource Methods
  def tableViewSelectionDidChange(notification)
    
  end
  
  def numberOfRowsInTableView(table_view)
    @commits ? @commits.size : 0
  end
  
  def tableView_objectValueForTableColumn_row(table_view, table_column, row)
    @commit = @commits[row]
    return nil
  end
  
  def primaryTextForCell_data(cell, data)
    return data.message.to_s
  end
  
  def secondaryTextForCell_data(cell, data)
    return %(by #{data.committer.name} <#{data.committer.email}> on #{data.committed_date.strftime("%A, %b %d, %I:%m %p")})
  end
  
  def iconForCell_data(icon, data)
    NSImage.imageNamed('bubble.png')
  end
  
  def dataElementForCell(cell)
    return @commit
  end
end