earthquake 0.4.3 → 0.4.4
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/Gemfile.lock +0 -4
- data/VERSION +1 -1
- data/earthquake.gemspec +1 -1
- data/lib/earthquake/commands.rb +3 -3
- data/lib/earthquake/core.rb +12 -2
- metadata +1 -1
data/Gemfile.lock
CHANGED
|
@@ -7,7 +7,6 @@ GEM
|
|
|
7
7
|
diff-lcs (1.1.2)
|
|
8
8
|
eventmachine (0.12.10)
|
|
9
9
|
git (1.2.5)
|
|
10
|
-
highline (1.6.1)
|
|
11
10
|
i18n (0.5.0)
|
|
12
11
|
jeweler (1.5.2)
|
|
13
12
|
bundler (~> 1.0.0)
|
|
@@ -30,8 +29,6 @@ GEM
|
|
|
30
29
|
rspec-expectations (2.3.0)
|
|
31
30
|
diff-lcs (~> 1.1.2)
|
|
32
31
|
rspec-mocks (2.3.0)
|
|
33
|
-
termcolor (1.2.1)
|
|
34
|
-
highline (>= 1.5.0)
|
|
35
32
|
twitter-stream (0.1.12)
|
|
36
33
|
eventmachine (>= 0.12.8)
|
|
37
34
|
roauth (>= 0.0.2)
|
|
@@ -53,6 +50,5 @@ DEPENDENCIES
|
|
|
53
50
|
notify
|
|
54
51
|
oauth
|
|
55
52
|
rspec (~> 2.3.0)
|
|
56
|
-
termcolor
|
|
57
53
|
twitter-stream
|
|
58
54
|
twitter_oauth
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.4.
|
|
1
|
+
0.4.4
|
data/earthquake.gemspec
CHANGED
data/lib/earthquake/commands.rb
CHANGED
|
@@ -26,9 +26,9 @@ module Earthquake
|
|
|
26
26
|
|
|
27
27
|
command %r|^:reply (\d+)\s+(.*)|, :as => :reply do |m|
|
|
28
28
|
# TODO: fill the user name to reply
|
|
29
|
-
async
|
|
30
|
-
twitter.update(m[2], :in_reply_to_status_id => m[1])
|
|
31
|
-
|
|
29
|
+
async {
|
|
30
|
+
twitter.update(m[2], :in_reply_to_status_id => m[1])
|
|
31
|
+
} if confirm("reply '#{m[2]}' to #{m[1]}")
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
command :status do |m|
|
data/lib/earthquake/core.rb
CHANGED
|
@@ -88,14 +88,14 @@ module Earthquake
|
|
|
88
88
|
Thread.start do
|
|
89
89
|
while buf = Readline.readline("⚡ ", true)
|
|
90
90
|
Readline::HISTORY.pop if buf.empty?
|
|
91
|
-
input(buf.strip)
|
|
91
|
+
sync { input(buf.strip) }
|
|
92
92
|
end
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
Thread.start do
|
|
96
96
|
loop do
|
|
97
97
|
if Readline.line_buffer.nil? || Readline.line_buffer.empty?
|
|
98
|
-
output
|
|
98
|
+
sync { output }
|
|
99
99
|
sleep 1
|
|
100
100
|
else
|
|
101
101
|
sleep 2
|
|
@@ -167,6 +167,16 @@ module Earthquake
|
|
|
167
167
|
end
|
|
168
168
|
end
|
|
169
169
|
|
|
170
|
+
def mutex
|
|
171
|
+
@mutex ||= Mutex.new
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def sync(&block)
|
|
175
|
+
mutex.synchronize do
|
|
176
|
+
block.call
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
170
180
|
def async(&block)
|
|
171
181
|
Thread.start(&block)
|
|
172
182
|
end
|