needy 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/needy.rb +28 -13
- metadata +1 -1
data/lib/needy.rb
CHANGED
@@ -56,21 +56,12 @@ module Needy
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def set abbrev, val
|
59
|
-
@@when[abbrev.to_s] = val
|
59
|
+
@@when[abbrev.to_s] = val unless (@@when[abbrev.to_s] and @@when[abbrev.to_s] > val)
|
60
60
|
end
|
61
61
|
|
62
|
-
def
|
63
|
-
|
64
|
-
|
65
|
-
Dir["#{dir}/*.ichat"].each do |path|
|
66
|
-
if path =~ /^#{name} on /
|
67
|
-
set abbrev, File.mtime(path)
|
68
|
-
Thread.exit
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
return Time.at(0)
|
73
|
-
end
|
62
|
+
def ichats dir = "#{ENV['HOME']}/Documents/iChats"
|
63
|
+
i = Needy::IChat.new(dir, self)
|
64
|
+
yield(i)
|
74
65
|
end
|
75
66
|
|
76
67
|
class Git
|
@@ -100,4 +91,28 @@ module Needy
|
|
100
91
|
self.log_opt += " --author=#{name}"
|
101
92
|
end
|
102
93
|
end
|
94
|
+
|
95
|
+
class IChat
|
96
|
+
attr_accessor :dir, :target
|
97
|
+
|
98
|
+
def initialize dir, target
|
99
|
+
self.dir = dir
|
100
|
+
self.target = target
|
101
|
+
end
|
102
|
+
|
103
|
+
def when name
|
104
|
+
Dir["#{dir}/*"].sort.reverse.each do |dir|
|
105
|
+
Dir["#{dir}/*.ichat"].each do |path|
|
106
|
+
if path =~ /\/#{name} on /
|
107
|
+
return File.mtime(path)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
return Time.at(0)
|
112
|
+
end
|
113
|
+
|
114
|
+
def chatter abbrev, name
|
115
|
+
target.thr { target.set abbrev, self.when(name) }
|
116
|
+
end
|
117
|
+
end
|
103
118
|
end
|