earthquake 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
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.3
1
+ 0.4.4
data/earthquake.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{earthquake}
8
- s.version = "0.4.3"
8
+ s.version = "0.4.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["jugyo"]
@@ -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 do
30
- twitter.update(m[2], :in_reply_to_status_id => m[1]) if confirm("reply '#{m[2]}' to #{m[1]}")
31
- end
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|
@@ -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
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: earthquake
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.3
5
+ version: 0.4.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - jugyo