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/dustin/gitnub.git
Search Repo:
Respect users system time preferences as set in the International prefs 
[dustin]
Caged (author)
Fri Mar 14 20:26:19 -0700 2008
commit  b4da17cd0588d92d01e3c04f377f23a17aecd288
tree    3a159339cc8039fbe4b21a8f894029f168011be1
parent  fc4de4ef7a337d4b391fad6ff33d357cf2bad074
...
10
11
12
 
13
14
15
...
10
11
12
13
14
15
16
0
@@ -10,6 +10,7 @@
0
 require 'osx/cocoa'
0
 require 'mime-types/lib/mime/types'
0
 require 'grit/lib/grit'
0
+require 'lib/time_extensions'
0
 require 'InfoWindowController'
0
 
0
 OSX.ns_import 'CommitSummaryCell'
...
22
23
24
25
26
 
 
27
28
29
...
94
95
96
97
 
98
99
100
101
...
113
114
115
116
 
117
118
 
119
120
121
...
22
23
24
 
 
25
26
27
28
29
...
94
95
96
 
97
98
99
100
101
...
113
114
115
 
116
117
 
118
119
120
121
0
@@ -22,8 +22,8 @@
0
     @offset = 50
0
     @active_commit = nil
0
     @icons = Hash.new do |hash, email|
0
- gravatar = NSURL.URLWithString("http://www.gravatar.com/avatar.php?gravatar_id=#{MD5.hexdigest(email)}&size=36")
0
- hash[email] = NSImage.alloc.initWithContentsOfURL(gravatar)
0
+ gravatar = NSURL.URLWithString("http://www.gravatar.com/avatar.php?gravatar_id=#{MD5.hexdigest(email)}&size=36")
0
+ hash[email] = NSImage.alloc.initWithContentsOfURL(gravatar)
0
     end
0
     
0
     if(fetch_git_repository)
0
@@ -94,7 +94,7 @@
0
   objc_method :tableView_willDisplayCell_forTableColumn_row, 'v@:@@@i'
0
   def tableView_willDisplayCell_forTableColumn_row(table_view, cell, table_column, row)
0
     commit = @commits[row]
0
- cell.subtitle = %(by #{commit.author.name} on #{commit.authored_date.strftime("%A, %b %d, %I:%M %p")})
0
+ cell.subtitle = %(by #{commit.author.name} on #{commit.authored_date.to_system_time})
0
     cell.gravatarImage = @icons[commit.author.email]
0
   end
0
   
0
0
@@ -113,9 +113,9 @@
0
     set_html("hash", active_commit.id)
0
 
0
     if Time.now.day == active_commit.authored_date.day
0
- cdate = active_commit.authored_date.strftime("Today, %I:%M %p")
0
+ cdate = active_commit.authored_date.to_system_time(:time)
0
     else
0
- cdate = active_commit.authored_date.strftime("%A, %B %d %I:%M %p")
0
+ cdate = active_commit.authored_date.to_system_time
0
     end
0
     set_html("date", "#{cdate} by #{active_commit.author.name}")
0
 
...
7
8
9
 
10
11
12
...
61
62
63
 
64
65
66
...
173
174
175
 
176
177
178
...
297
298
299
 
300
301
302
...
7
8
9
10
11
12
13
...
62
63
64
65
66
67
68
...
175
176
177
178
179
180
181
...
300
301
302
303
304
305
306
0
@@ -7,6 +7,7 @@
0
   objects = {
0
 
0
 /* Begin PBXBuildFile section */
0
+ 283254680D8B792500D99366 /* lib in Resources */ = {isa = PBXBuildFile; fileRef = 283254650D8B792500D99366 /* lib */; };
0
     285BB47C0D8306C60027980C /* mime-types in Resources */ = {isa = PBXBuildFile; fileRef = 285BB4690D8306C60027980C /* mime-types */; };
0
     285BB5320D849C890027980C /* TexturedWindow.rb in Resources */ = {isa = PBXBuildFile; fileRef = 285BB52F0D849C890027980C /* TexturedWindow.rb */; };
0
     285BB53D0D849DD20027980C /* added.png in Resources */ = {isa = PBXBuildFile; fileRef = 285BB5380D849DD20027980C /* added.png */; };
0
@@ -61,6 +62,7 @@
0
 /* Begin PBXFileReference section */
0
     089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
0
     1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
0
+ 283254650D8B792500D99366 /* lib */ = {isa = PBXFileReference; lastKnownFileType = folder; path = lib; sourceTree = "<group>"; };
0
     284B71470D7CDE340075DA6C /* nub.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = nub.xcodeproj; path = nub/nub.xcodeproj; sourceTree = "<group>"; };
0
     285BB4690D8306C60027980C /* mime-types */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "mime-types"; sourceTree = "<group>"; };
0
     285BB52F0D849C890027980C /* TexturedWindow.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = TexturedWindow.rb; sourceTree = "<group>"; };
0
@@ -173,6 +175,7 @@
0
     29B97315FDCFA39411CA2CEA /* Other Sources */ = {
0
       isa = PBXGroup;
0
       children = (
0
+ 283254650D8B792500D99366 /* lib */,
0
         285BB52F0D849C890027980C /* TexturedWindow.rb */,
0
         285BB4690D8306C60027980C /* mime-types */,
0
         288854540D7E352C00862D67 /* grit */,
0
@@ -297,6 +300,7 @@
0
         285BB54A0D849EA60027980C /* InfoWindowController.rb in Resources */,
0
         288CB41A0D8789DD0092B5CC /* MainMenu.xib in Resources */,
0
         288CB41D0D878A1C0092B5CC /* Info.xib in Resources */,
0
+ 283254680D8B792500D99366 /* lib in Resources */,
0
       );
0
       runOnlyForDeploymentPostprocessing = 0;
0
     };
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0
@@ -1 +1,15 @@
0
+class Time
0
+ def to_system_time(style = :full)
0
+ formatter = OSX::NSDateFormatter.alloc.init
0
+ case style
0
+ when :full
0
+ formatter.dateStyle = OSX::NSDateFormatterMediumStyle
0
+ formatter.timeStyle = OSX::NSDateFormatterShortStyle
0
+ when :time
0
+ formatter.dateStyle = OSX::NSDateFormatterNoStyle
0
+ formatter.timeStyle = OSX::NSDateFormatterShortStyle
0
+ end
0
+ formatter.stringFromDate(self.to_ns)
0
+ end
0
+end

Comments

    No one has commented yet.