earthquake 0.4.1 → 0.4.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/README.md +4 -0
- data/VERSION +1 -1
- data/earthquake.gemspec +1 -1
- data/lib/earthquake/commands.rb +5 -1
- data/lib/earthquake/core.rb +5 -1
- data/lib/earthquake/input.rb +2 -2
- data/lib/earthquake/output.rb +11 -1
- metadata +1 -1
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.2
|
data/earthquake.gemspec
CHANGED
data/lib/earthquake/commands.rb
CHANGED
@@ -58,7 +58,11 @@ module Earthquake
|
|
58
58
|
end
|
59
59
|
|
60
60
|
command :search do |m|
|
61
|
-
puts_items twitter.search(m[1])["results"].each { |s|
|
61
|
+
puts_items twitter.search(m[1])["results"].each { |s|
|
62
|
+
s["user"] = {"screen_name" => s["from_user"]}
|
63
|
+
}.each {|s|
|
64
|
+
s["highlights"] = [m[1]]
|
65
|
+
}.reverse
|
62
66
|
end
|
63
67
|
|
64
68
|
command :retweet do |m|
|
data/lib/earthquake/core.rb
CHANGED
@@ -62,7 +62,7 @@ module Earthquake
|
|
62
62
|
begin
|
63
63
|
require_dependency lib
|
64
64
|
rescue Exception => e
|
65
|
-
|
65
|
+
error e
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -154,6 +154,10 @@ module Earthquake
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
+
def error(e)
|
158
|
+
notify "[ERROR] #{e.message}\n#{e.backtrace.join("\n")}"
|
159
|
+
end
|
160
|
+
|
157
161
|
def notify(message, options = {:title => 'earthquake'})
|
158
162
|
Notify.notify options[:title], message
|
159
163
|
end
|
data/lib/earthquake/input.rb
CHANGED
@@ -26,7 +26,7 @@ module Earthquake
|
|
26
26
|
puts "<yellow>Command not found</yellow>".t
|
27
27
|
end
|
28
28
|
rescue Exception => e
|
29
|
-
|
29
|
+
error e
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -73,7 +73,7 @@ module Earthquake
|
|
73
73
|
begin
|
74
74
|
results + (completion.call(text) || [])
|
75
75
|
rescue Exception => e
|
76
|
-
|
76
|
+
error e
|
77
77
|
results
|
78
78
|
end
|
79
79
|
end
|
data/lib/earthquake/output.rb
CHANGED
@@ -33,7 +33,7 @@ module Earthquake
|
|
33
33
|
begin
|
34
34
|
p.call(item)
|
35
35
|
rescue => e
|
36
|
-
|
36
|
+
error e
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -87,6 +87,16 @@ module Earthquake
|
|
87
87
|
c = color_of($1)
|
88
88
|
"<#{c}>#{i}</#{c}>"
|
89
89
|
end
|
90
|
+
|
91
|
+
if item["highlights"]
|
92
|
+
item["highlights"].each do |h|
|
93
|
+
c = color_of(h).to_i + 10
|
94
|
+
text = text.gsub(/#{h}/i) do |i|
|
95
|
+
"<#{c}>#{i}</#{c}>"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
90
100
|
status = "<90>#{statuses.join(" ").e}</90> " +
|
91
101
|
"<#{user_color}>#{item["user"]["screen_name"].e}</#{user_color}>: " +
|
92
102
|
"#{text}<90>#{misc.e} #{source.e}</90>"
|