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/benstiglitz/gitnub.git
commit  3f411c6f61f28b3abb4dee6a201ea4c7dc4adc21
tree    ae9e962cb5c1211fefe91a28e83b00a137cd08b3
parent  3060525438ebdf1b3bbf6424bed707f3c61f351b
gitnub / ApplicationController.rb
100644 31 lines (26 sloc) 0.895 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
#
# ApplicationController.rb
# GitNub
#
# Created by Justin Palmer on 3/1/08.
# Copyright (c) 2008 Active Reload, LLC. All rights reserved.
#
 
require 'osx/cocoa'
require 'rubygems'
require 'grit'
require 'erubis'
 
include OSX
 
class ApplicationController < OSX::NSObject
  ib_outlet :main_view
  attr_reader :repo
  def awakeFromNib
    @main_view.drawsBackground = false
    @repo = Grit::Repo.new("/Users/Caged/dev/clients/digisynd/code/client.rails")
    render 'log', {:repo => @repo, :branches => @repo.branches }
  end
  
  def render(file, context)
    log_template = File.join(NSBundle.mainBundle.bundlePath, "Contents", "Resources", "#{file}.html.erb")
    eruby = Erubis::FastEruby.load_file(log_template)
    @main_view.mainFrame.loadHTMLString_baseURL(eruby.evaluate(context), NSURL.fileURLWithPath(File.join(NSBundle.mainBundle.bundlePath, "Contents", "Resources")))
  end
end