earthquake 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/earthquake.gemspec +3 -3
- data/lib/earthquake/core.rb +2 -1
- data/lib/earthquake/output.rb +9 -6
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.5
|
data/earthquake.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{earthquake}
|
8
|
-
s.version = "0.6.
|
8
|
+
s.version = "0.6.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["jugyo"]
|
12
|
-
s.date = %q{2011-04-
|
12
|
+
s.date = %q{2011-04-08}
|
13
13
|
s.default_executable = %q{earthquake}
|
14
14
|
s.description = %q{Twitter Client on Terminal with Twitter Streaming API.}
|
15
15
|
s.email = %q{jugyo.org@gmail.com}
|
@@ -60,7 +60,7 @@ Accordingly, you should renew the access token if it is old.
|
|
60
60
|
}
|
61
61
|
s.require_paths = ["lib"]
|
62
62
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
|
63
|
-
s.rubygems_version = %q{1.6.
|
63
|
+
s.rubygems_version = %q{1.6.2}
|
64
64
|
s.summary = %q{Twitter Client on Terminal.}
|
65
65
|
s.test_files = [
|
66
66
|
"spec/earthquake_spec.rb",
|
data/lib/earthquake/core.rb
CHANGED
@@ -53,6 +53,7 @@ module Earthquake
|
|
53
53
|
config[:time_format] ||= Time::DATE_FORMATS[:short]
|
54
54
|
config[:plugin_dir] ||= File.join(config[:dir], 'plugin')
|
55
55
|
config[:file] ||= File.join(config[:dir], 'config')
|
56
|
+
config[:prompt] ||= '⚡ '
|
56
57
|
config[:consumer_key] ||= 'RmzuwQ5g0SYObMfebIKJag'
|
57
58
|
config[:consumer_secret] ||= 'V98dYYmWm9JoG7qfOF0jhJaVEVW3QhGYcDJ9JQSXU'
|
58
59
|
|
@@ -89,7 +90,7 @@ module Earthquake
|
|
89
90
|
|
90
91
|
EventMachine::run do
|
91
92
|
Thread.start do
|
92
|
-
while buf = Readline.readline(
|
93
|
+
while buf = Readline.readline(config[:prompt], true)
|
93
94
|
unless Readline::HISTORY.count == 1
|
94
95
|
Readline::HISTORY.pop if buf.empty? || Readline::HISTORY[-1] == Readline::HISTORY[-2]
|
95
96
|
end
|
data/lib/earthquake/output.rb
CHANGED
@@ -13,9 +13,10 @@ module Earthquake
|
|
13
13
|
@outputs ||= []
|
14
14
|
end
|
15
15
|
|
16
|
-
def output(&block)
|
16
|
+
def output(name = nil, &block)
|
17
17
|
if block
|
18
|
-
outputs
|
18
|
+
outputs.delete_if { |o| o[:name] == name } if name
|
19
|
+
outputs << {:name => name, :block => block}
|
19
20
|
else
|
20
21
|
return if item_queue.empty?
|
21
22
|
insert do
|
@@ -32,7 +33,7 @@ module Earthquake
|
|
32
33
|
next if output_filters.any? { |f| f.call(item) == false }
|
33
34
|
outputs.each do |o|
|
34
35
|
begin
|
35
|
-
o.call(item)
|
36
|
+
o[:block].call(item)
|
36
37
|
rescue => e
|
37
38
|
error e
|
38
39
|
end
|
@@ -71,7 +72,7 @@ module Earthquake
|
|
71
72
|
)
|
72
73
|
config[:raw_text] ||= false
|
73
74
|
|
74
|
-
output do |item|
|
75
|
+
output :tweet do |item|
|
75
76
|
next unless item["text"]
|
76
77
|
|
77
78
|
info = []
|
@@ -80,7 +81,9 @@ module Earthquake
|
|
80
81
|
elsif item["retweeted_status"]
|
81
82
|
info << "(retweet of #{id2var(item["retweeted_status"]["id"])})"
|
82
83
|
end
|
83
|
-
|
84
|
+
if !config[:hide_time] && item["created_at"]
|
85
|
+
info << Time.parse(item["created_at"]).strftime(config[:time_format])
|
86
|
+
end
|
84
87
|
if !config[:hide_app_name] && item["source"]
|
85
88
|
info << (item["source"].u =~ />(.*)</ ? $1 : 'web')
|
86
89
|
end
|
@@ -124,7 +127,7 @@ module Earthquake
|
|
124
127
|
puts status
|
125
128
|
end
|
126
129
|
|
127
|
-
output do |item|
|
130
|
+
output :event do |item|
|
128
131
|
next unless item["event"]
|
129
132
|
|
130
133
|
# TODO: handle 'list_member_added' and 'list_member_removed'
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: earthquake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- jugyo
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-08 00:00:00 +09:00
|
14
14
|
default_executable: earthquake
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
requirements: []
|
206
206
|
|
207
207
|
rubyforge_project:
|
208
|
-
rubygems_version: 1.6.
|
208
|
+
rubygems_version: 1.6.2
|
209
209
|
signing_key:
|
210
210
|
specification_version: 3
|
211
211
|
summary: Twitter Client on Terminal.
|