-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGitDoc.rb
104 lines (75 loc) · 1.74 KB
/
GitDoc.rb
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#
# MyDocument.rb
# iGotGit
#
# Created by John Smilanick on 11/1/08.
# Copyright (c) 2008 Professional Aptitude Council. All rights reserved.
#
require 'osx/cocoa'
class GitDoc < OSX::NSDocument
ib_outlet :git_window, :branch_list
ib_outlet :log
attr_reader :modal_window
def windowNibName
return "GitDoc"
end
#def saveDocumentAs(sender)
# NSLog('savedoc')
#end
#def hasUnautosavedChanges
# false
#end
def windowControllerDidLoadNib(aController)
log("Opened: #{@git.dir.path}")
@git_window.setTitle(@git.dir.path)
end
def writeToURL_ofType_error(absoluteURL, typeName, outError)
return true
end
def readFromURL_ofType_error(absoluteURL, typeName, outError)
p 'readFromURL_ofType_error'
@git = Git::Base.new(:working_directory => absoluteURL.path.to_s)
return true
end
ib_action :refresh
def refresh(sender)
@branch_list.reloadData
@git.status
end
ib_action :git_commit
def git_commit(sender)
end
ib_action :git_push
def git_push(sender)
end
ib_action :git_pull
def git_pull(sender)
end
ib_action :git_stash
def git_stash(sender)
end
ib_action :git_rebase
def git_commit(sender)
end
ib_action :git_diff
def git_diff(sender)
end
def git
@git
end
kvc_reader :local_branches
def local_branches
BranchProxy.from_array(@git.branches.local)
end
kvc_reader :remote_branches
def remote_branches
BranchProxy.from_array(@git.branches.remote)
end
def log(message)
@log.insertText(Time.now.to_s + "\n" + message + "\n\n")
end
ib_action :clear_log
def clear_log(sender)
@log.textStorage.setAttributedString(NSAttributedString.alloc.init)
end
end