earthquake 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +34 -0
- data/VERSION +1 -1
- data/bin/earthquake +2 -2
- data/earthquake.gemspec +3 -3
- data/lib/earthquake/commands.rb +187 -6
- data/lib/earthquake/core.rb +2 -0
- data/lib/earthquake/input.rb +17 -8
- data/lib/earthquake/output.rb +26 -4
- metadata +27 -27
data/README.md
CHANGED
@@ -113,6 +113,35 @@ Commands
|
|
113
113
|
|
114
114
|
⚡ :alias :rt :retweet
|
115
115
|
|
116
|
+
### Tweet Ascii Art
|
117
|
+
|
118
|
+
⚡ :update[ENTER]
|
119
|
+
[input EOF (e.g. Ctrl+D) at the last]
|
120
|
+
⚡
|
121
|
+
⚡
|
122
|
+
⚡
|
123
|
+
⚡
|
124
|
+
^D
|
125
|
+
|
126
|
+
### View Ascii Art
|
127
|
+
|
128
|
+
# permanently
|
129
|
+
⚡ :eval config[:raw_text] = true
|
130
|
+
|
131
|
+
# temporarily(with :status, :recent or :thread etc...)
|
132
|
+
⚡ :aa :status $aa
|
133
|
+
|
134
|
+
### Stream Filter Tracking
|
135
|
+
|
136
|
+
# keywords
|
137
|
+
⚡ :filter keyword earthquakegem twitter
|
138
|
+
|
139
|
+
# users
|
140
|
+
⚡ :filter user jugyo matsuu
|
141
|
+
|
142
|
+
# return to normal user stream
|
143
|
+
⚡ :filter off
|
144
|
+
|
116
145
|
And more!
|
117
146
|
|
118
147
|
Configuration
|
@@ -173,6 +202,11 @@ You can change the directory at launch by entering a directory as an argument. F
|
|
173
202
|
# ~/.earthquake/config
|
174
203
|
Earthquake.alias_command :rt, :retweet
|
175
204
|
|
205
|
+
### Default confirmation type
|
206
|
+
|
207
|
+
# ~/.earthquake/config
|
208
|
+
Earthquake.config[:confirm_type] = :n
|
209
|
+
|
176
210
|
### HTTP proxy support
|
177
211
|
|
178
212
|
Please set environment variable *http_proxy* if you want earthquake to use an http proxy.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.4
|
data/bin/earthquake
CHANGED
@@ -6,7 +6,7 @@ slop = Slop.new(:strict => true, :help => true)
|
|
6
6
|
slop.banner "Usage: earthquake [options] [directory]"
|
7
7
|
slop.on :d, :debug, 'Enable debug mode'
|
8
8
|
slop.on :n, :'no-logo', 'No Logo'
|
9
|
-
slop.on :c, :command, "Invoke
|
9
|
+
slop.on :c, :command, "Invoke a command and exit", true
|
10
10
|
slop.on :l, :lolize, 'enable lolize (see: https://github.com/miaout17/lolize)'
|
11
11
|
begin
|
12
12
|
slop.parse!(argv)
|
@@ -14,7 +14,7 @@ rescue => e
|
|
14
14
|
puts e
|
15
15
|
exit!
|
16
16
|
end
|
17
|
-
options = slop.to_hash
|
17
|
+
options = slop.to_hash
|
18
18
|
options.delete(:help)
|
19
19
|
options[:dir] = argv.shift unless argv.empty?
|
20
20
|
|
data/earthquake.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "earthquake"
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.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"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-02-03"
|
13
13
|
s.description = "Twitter Client on Terminal with Twitter Streaming API."
|
14
14
|
s.email = "jugyo.org@gmail.com"
|
15
15
|
s.executables = ["earthquake"]
|
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
s.licenses = ["MIT"]
|
47
47
|
s.require_paths = ["lib"]
|
48
48
|
s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
|
49
|
-
s.rubygems_version = "1.8.
|
49
|
+
s.rubygems_version = "1.8.11"
|
50
50
|
s.summary = "Twitter Client on Terminal."
|
51
51
|
s.test_files = [
|
52
52
|
"spec/earthquake_spec.rb",
|
data/lib/earthquake/commands.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
require 'uri'
|
3
3
|
require 'open-uri'
|
4
|
+
require 'shellwords'
|
4
5
|
Earthquake.init do
|
5
6
|
|
6
7
|
# :exit
|
@@ -63,6 +64,27 @@ Earthquake.init do
|
|
63
64
|
⚡ :eval 1 + 1
|
64
65
|
HELP
|
65
66
|
|
67
|
+
command :aa do |m|
|
68
|
+
begin
|
69
|
+
raw_text, config[:raw_text] = config[:raw_text], true
|
70
|
+
input(m[1])
|
71
|
+
ensure
|
72
|
+
config[:raw_text] = raw_text
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
help :aa, 'executes a command with raw text', <<-HELP
|
77
|
+
⚡ :aa :status $aa
|
78
|
+
HELP
|
79
|
+
|
80
|
+
command %r|^:update$|, :as => :update do
|
81
|
+
puts "[input EOF (e.g. Ctrl+D) at the last]".c(:info)
|
82
|
+
text = STDIN.gets(nil)
|
83
|
+
if text && !text.split.empty?
|
84
|
+
async_e{ twitter.update(text) } if confirm("update above AA?")
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
66
88
|
command :update do |m|
|
67
89
|
async_e { twitter.update(m[1]) } if confirm("update '#{m[1]}'")
|
68
90
|
end
|
@@ -71,6 +93,16 @@ Earthquake.init do
|
|
71
93
|
input(":update #{m[0]}")
|
72
94
|
end
|
73
95
|
|
96
|
+
help :update, 'update status', <<-HELP
|
97
|
+
⚡ :update this is my new status
|
98
|
+
⚡ :update[ENTER]
|
99
|
+
⚡
|
100
|
+
⚡
|
101
|
+
⚡
|
102
|
+
⚡
|
103
|
+
^D
|
104
|
+
HELP
|
105
|
+
|
74
106
|
command %r|^:reply\s+(\d+)\s+(.*)|, :as => :reply do |m|
|
75
107
|
in_reply_to_status_id = m[1]
|
76
108
|
target = twitter.status(in_reply_to_status_id)
|
@@ -81,6 +113,12 @@ Earthquake.init do
|
|
81
113
|
end
|
82
114
|
end
|
83
115
|
|
116
|
+
help :reply, "replys a tweet", <<-HELP
|
117
|
+
[$aa] hello world
|
118
|
+
⚡ :reply $aa goodbye world
|
119
|
+
⚡ $aa goodbye world
|
120
|
+
HELP
|
121
|
+
|
84
122
|
# $xx hi!
|
85
123
|
command %r|^(\$[^\s]+)\s+(.*)$| do |m|
|
86
124
|
input(":reply #{m[1..2].join(' ')}")
|
@@ -95,23 +133,43 @@ Earthquake.init do
|
|
95
133
|
input(":status #{m[1]}")
|
96
134
|
end
|
97
135
|
|
136
|
+
help :status, "shows status", <<-HELP
|
137
|
+
[$aa] hello world
|
138
|
+
⚡ :status $aa
|
139
|
+
[$aa] hello world
|
140
|
+
⚡ $aa
|
141
|
+
[$aa] hello world
|
142
|
+
HELP
|
143
|
+
|
98
144
|
command :delete do |m|
|
99
145
|
tweet = twitter.status(m[1])
|
100
146
|
async_e { twitter.status_destroy(m[1]) } if confirm("delete '#{tweet["text"]}'")
|
101
147
|
end
|
102
148
|
|
149
|
+
help :delete, "deletes status", <<-HELP
|
150
|
+
[$aa] hello world
|
151
|
+
⚡ :delete $aa
|
152
|
+
delete 'hello world' [Yn] Y
|
153
|
+
HELP
|
154
|
+
|
103
155
|
command :mentions do
|
104
156
|
puts_items twitter.mentions
|
105
157
|
end
|
106
158
|
|
159
|
+
help :mentions, "show mentions timeline"
|
160
|
+
|
107
161
|
command :follow do |m|
|
108
162
|
async_e { twitter.friend(m[1]) }
|
109
163
|
end
|
110
164
|
|
165
|
+
help :follow, "follow user"
|
166
|
+
|
111
167
|
command :unfollow do |m|
|
112
168
|
async_e { twitter.unfriend(m[1]) }
|
113
169
|
end
|
114
170
|
|
171
|
+
help :unfollow, "unfollow user"
|
172
|
+
|
115
173
|
command :recent do
|
116
174
|
puts_items twitter.home_timeline(:count => config[:recent_count])
|
117
175
|
end
|
@@ -126,10 +184,22 @@ Earthquake.init do
|
|
126
184
|
puts_items twitter.list_statuses(m[1], m[2])
|
127
185
|
end
|
128
186
|
|
187
|
+
help :recent, "show recent tweets", <<-HELP
|
188
|
+
⚡ :recent
|
189
|
+
⚡ :recent user
|
190
|
+
⚡ :recent user/list
|
191
|
+
HELP
|
192
|
+
|
129
193
|
command :user do |m|
|
130
|
-
|
194
|
+
user = twitter.show(m[1])
|
195
|
+
if user.key?("error")
|
196
|
+
user = twitter.status(m[1])["user"] || {}
|
197
|
+
end
|
198
|
+
ap user.slice(*%w(id screen_name name profile_image_url description url location time_zone lang protected))
|
131
199
|
end
|
132
200
|
|
201
|
+
help :user, "show user info"
|
202
|
+
|
133
203
|
command :search do |m|
|
134
204
|
search_options = config[:search_options] ? config[:search_options].dup : {}
|
135
205
|
puts_items twitter.search(m[1], search_options)["results"].each { |s|
|
@@ -147,6 +217,49 @@ Earthquake.init do
|
|
147
217
|
}
|
148
218
|
end
|
149
219
|
|
220
|
+
help :search, "searches term"
|
221
|
+
|
222
|
+
default_stream = {
|
223
|
+
method: "POST",
|
224
|
+
host: "userstream.twitter.com",
|
225
|
+
path: "/2/user.json",
|
226
|
+
ssl: true,
|
227
|
+
}
|
228
|
+
|
229
|
+
filter_stream = {
|
230
|
+
method: "POST",
|
231
|
+
host: "stream.twitter.com",
|
232
|
+
path: "/1/statuses/filter.json",
|
233
|
+
ssl: true,
|
234
|
+
}
|
235
|
+
|
236
|
+
command %r!^:filter off$!, as: :filter do
|
237
|
+
config[:api] = default_stream
|
238
|
+
reconnect
|
239
|
+
end
|
240
|
+
|
241
|
+
command %r!^:filter keyword (.*)$!, as: :filter do |m|
|
242
|
+
keywords = Shellwords.split(m[1])
|
243
|
+
config[:api] = filter_stream.merge(filters: keywords)
|
244
|
+
reconnect
|
245
|
+
end
|
246
|
+
|
247
|
+
command %r!:filter user (.*)$!, as: :filter do |m|
|
248
|
+
users = m[1].split.map{|user|
|
249
|
+
twitter.show(user)["id"]
|
250
|
+
}.compact.join(",")
|
251
|
+
unless users.empty?
|
252
|
+
config[:api] = filter_stream.merge(params: {follow: users})
|
253
|
+
reconnect
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
help :filter, "manages filters", <<-HELP
|
258
|
+
⚡ :filter off
|
259
|
+
⚡ :filter keyword annoyingsubject
|
260
|
+
⚡ :filter user annoyinguser
|
261
|
+
HELP
|
262
|
+
|
150
263
|
command %r|^:retweet\s+(\d+)$|, :as => :retweet do |m|
|
151
264
|
target = twitter.status(m[1])
|
152
265
|
if confirm("retweet 'RT @#{target["user"]["screen_name"]}: #{target["text"]}'")
|
@@ -162,6 +275,11 @@ Earthquake.init do
|
|
162
275
|
end
|
163
276
|
end
|
164
277
|
|
278
|
+
help :retweet, "retweets or quote status", <<-HELP
|
279
|
+
⚡ :retweet $aa
|
280
|
+
⚡ :retweet $aa // LOL
|
281
|
+
HELP
|
282
|
+
|
165
283
|
command :favorite do |m|
|
166
284
|
tweet = twitter.status(m[1])
|
167
285
|
if confirm("favorite '#{tweet["user"]["screen_name"]}: #{tweet["text"]}'")
|
@@ -169,6 +287,8 @@ Earthquake.init do
|
|
169
287
|
end
|
170
288
|
end
|
171
289
|
|
290
|
+
help :favorite, "marks status as favorite"
|
291
|
+
|
172
292
|
command :unfavorite do |m|
|
173
293
|
tweet = twitter.status(m[1])
|
174
294
|
if confirm("unfavorite '#{tweet["user"]["screen_name"]}: #{tweet["text"]}'")
|
@@ -176,30 +296,44 @@ Earthquake.init do
|
|
176
296
|
end
|
177
297
|
end
|
178
298
|
|
299
|
+
help :unfavorite, "unmarks status as favorite"
|
300
|
+
|
179
301
|
command :retweeted_by_me do
|
180
302
|
puts_items twitter.retweeted_by_me
|
181
303
|
end
|
182
304
|
|
305
|
+
help :retweeted_by_me, "shows the latest retweets you made"
|
306
|
+
|
183
307
|
command :retweeted_to_me do
|
184
308
|
puts_items twitter.retweeted_to_me
|
185
309
|
end
|
186
310
|
|
311
|
+
help :retweeted_to_me, "shows the latest retweets someone you follow made"
|
312
|
+
|
187
313
|
command :retweets_of_me do
|
188
314
|
puts_items twitter.retweets_of_me
|
189
315
|
end
|
190
316
|
|
317
|
+
help :retweets_of_me, "shows your latest status somebody retweeted"
|
318
|
+
|
191
319
|
command :block do |m|
|
192
320
|
async_e { twitter.block(m[1]) }
|
193
321
|
end
|
194
322
|
|
323
|
+
help :block, "blocks user"
|
324
|
+
|
195
325
|
command :unblock do |m|
|
196
326
|
async_e { twitter.unblock(m[1]) }
|
197
327
|
end
|
198
328
|
|
329
|
+
help :unblock, "unblocks user"
|
330
|
+
|
199
331
|
command :report_spam do |m|
|
200
332
|
async_e { twitter.report_spam(m[1]) }
|
201
333
|
end
|
202
334
|
|
335
|
+
help :report_spam, "blocks user and report as spam"
|
336
|
+
|
203
337
|
command :messages do
|
204
338
|
puts_items twitter.messages.each { |s|
|
205
339
|
s["user"] = {"screen_name" => s["sender_screen_name"]}
|
@@ -207,6 +341,8 @@ Earthquake.init do
|
|
207
341
|
}
|
208
342
|
end
|
209
343
|
|
344
|
+
help :messages, "list direct messages received"
|
345
|
+
|
210
346
|
command :sent_messages do
|
211
347
|
puts_items twitter.sent_messages.each { |s|
|
212
348
|
s["user"] = {"screen_name" => s["sender_screen_name"]}
|
@@ -214,10 +350,14 @@ Earthquake.init do
|
|
214
350
|
}
|
215
351
|
end
|
216
352
|
|
353
|
+
help :sent_messages, "list direct messages sent"
|
354
|
+
|
217
355
|
command %r|^:message (\w+)\s+(.*)|, :as => :message do |m|
|
218
356
|
async_e { twitter.message(*m[1, 2]) } if confirm("message '#{m[2]}' to @#{m[1]}")
|
219
357
|
end
|
220
358
|
|
359
|
+
help :message, "sent a direct message"
|
360
|
+
|
221
361
|
command :reconnect do
|
222
362
|
reconnect
|
223
363
|
end
|
@@ -234,19 +374,28 @@ Earthquake.init do
|
|
234
374
|
}
|
235
375
|
end
|
236
376
|
|
377
|
+
help :thread, "displays conversation thread"
|
378
|
+
|
237
379
|
command :update_profile_image do |m|
|
238
380
|
image_path = File.expand_path(m[1].gsub('\\', ''))
|
239
381
|
async_e { twitter.update_profile_image(File.open(image_path, 'rb')) }
|
240
382
|
end
|
241
383
|
|
384
|
+
help :update_profile_image, "updates profile image from local file path"
|
385
|
+
|
242
386
|
command %r|^:open\s+(\d+)$|, :as => :open do |m|
|
243
|
-
|
244
|
-
|
387
|
+
matches = URI.extract(twitter.status(m[1])["text"],["http", "https"])
|
388
|
+
unless matches.empty?
|
389
|
+
matches.each do |match_url|
|
390
|
+
browse match_url
|
391
|
+
end
|
245
392
|
else
|
246
393
|
puts "no link found".c(41)
|
247
394
|
end
|
248
395
|
end
|
249
396
|
|
397
|
+
help :open, "opens all links in a tweet"
|
398
|
+
|
250
399
|
command :browse do |m|
|
251
400
|
url = case m[1]
|
252
401
|
when /^\d+$/
|
@@ -257,16 +406,32 @@ Earthquake.init do
|
|
257
406
|
browse url
|
258
407
|
end
|
259
408
|
|
409
|
+
help :browse, "opens the browser on a tweet or a user", <<-HELP
|
410
|
+
⚡ :browse $aa
|
411
|
+
⚡ :browse username
|
412
|
+
HELP
|
413
|
+
|
260
414
|
command :sh do
|
261
415
|
system ENV["SHELL"] || 'sh'
|
262
416
|
end
|
263
417
|
|
264
|
-
|
265
|
-
|
418
|
+
help :sh, "opens a shell"
|
419
|
+
|
420
|
+
command %r|:!(.+)| do |m|
|
421
|
+
command = m[1].strip
|
422
|
+
puts "`#{command}`"
|
423
|
+
system eval("\"#{command}\"").to_s
|
266
424
|
end
|
267
425
|
|
268
426
|
command :plugin_install do |m|
|
269
427
|
uri = URI.parse(m[1])
|
428
|
+
if uri.host == "t.co"
|
429
|
+
begin
|
430
|
+
open(uri, redirect: false)
|
431
|
+
rescue OpenURI::HTTPRedirect => e
|
432
|
+
uri = URI.parse(e.io.meta["location"])
|
433
|
+
end
|
434
|
+
end
|
270
435
|
unless uri.host == "gist.github.com"
|
271
436
|
puts "the host must be gist.github.com".c(41)
|
272
437
|
else
|
@@ -285,23 +450,39 @@ Earthquake.init do
|
|
285
450
|
if confirm("Install to '#{filepath}'?")
|
286
451
|
File.open(File.join(config[:plugin_dir], filename), 'w') do |file|
|
287
452
|
file << raw
|
288
|
-
file << "\n# #{
|
453
|
+
file << "\n# #{uri}\n"
|
289
454
|
end
|
290
455
|
reload
|
291
456
|
end
|
292
457
|
end
|
293
458
|
end
|
294
459
|
|
460
|
+
help :plugin_install, "installs a plugin from gist.github.com"
|
461
|
+
|
295
462
|
command :edit_config do
|
296
463
|
editor = ENV["EDITOR"] || 'vim'
|
297
464
|
system "#{editor} #{config[:file]}"
|
298
465
|
end
|
299
466
|
|
467
|
+
help :edit_config, "edit your config; note that changes may require to :restart"
|
468
|
+
|
300
469
|
command %r|^:alias\s+?(:\w+)\s+(.+)|, :as => :alias do |m|
|
301
470
|
alias_command m[1], m[2]
|
302
471
|
end
|
303
472
|
|
473
|
+
help :alias, "creates a new command aliasing to an existing one", <<-HELP
|
474
|
+
⚡ :alias :rt :retweet
|
475
|
+
HELP
|
476
|
+
|
477
|
+
command :aliases do
|
478
|
+
ap command_aliases
|
479
|
+
end
|
480
|
+
|
481
|
+
help :aliases, "shows aliases"
|
482
|
+
|
304
483
|
command :reauthorize do
|
305
484
|
get_access_token
|
306
485
|
end
|
486
|
+
|
487
|
+
help :reauthorize, "prompts for new oauth credentials"
|
307
488
|
end
|
data/lib/earthquake/core.rb
CHANGED
@@ -59,6 +59,8 @@ module Earthquake
|
|
59
59
|
config[:output_interval] ||= 1
|
60
60
|
config[:history_size] ||= 1000
|
61
61
|
config[:api] ||= { :host => 'userstream.twitter.com', :path => '/2/user.json', :ssl => true }
|
62
|
+
config[:confirm_type] ||= :y
|
63
|
+
config[:expand_url] ||= false
|
62
64
|
|
63
65
|
[config[:dir], config[:plugin_dir]].each do |dir|
|
64
66
|
unless File.exists?(dir)
|
data/lib/earthquake/input.rb
CHANGED
@@ -32,7 +32,9 @@ module Earthquake
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def alias_command(name, target)
|
35
|
-
|
35
|
+
name = name.is_a?(Symbol) ? ":#{name}" : name.to_s
|
36
|
+
target = target.is_a?(Symbol) ? ":#{target}" : target.to_s
|
37
|
+
command_aliases[name] = target
|
36
38
|
end
|
37
39
|
|
38
40
|
def input(text)
|
@@ -67,14 +69,20 @@ module Earthquake
|
|
67
69
|
end
|
68
70
|
end
|
69
71
|
|
70
|
-
def confirm(message, type = :
|
71
|
-
case type
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
72
|
+
def confirm(message, type = config[:confirm_type])
|
73
|
+
s = case type
|
74
|
+
when :y
|
75
|
+
ask("#{message} [Yn] ".u)
|
76
|
+
when :n
|
77
|
+
ask("#{message} [yN] ".u)
|
78
|
+
else
|
79
|
+
raise "type must be :y or :n"
|
80
|
+
end
|
81
|
+
s = type.to_s if s.empty?
|
82
|
+
if m = s.match(/^[yn]$/i)
|
83
|
+
return m[0].downcase == 'y'
|
76
84
|
else
|
77
|
-
|
85
|
+
confirm(message, type)
|
78
86
|
end
|
79
87
|
end
|
80
88
|
|
@@ -117,6 +125,7 @@ module Earthquake
|
|
117
125
|
completion do |text|
|
118
126
|
regexp = /^#{Regexp.quote(text)}/
|
119
127
|
results = (command_names + command_aliases.keys).grep(regexp)
|
128
|
+
next results if text.start_with?(?:) and (Readline.point rescue nil) == text.size
|
120
129
|
history = Readline::HISTORY.reverse_each.take(config[:history_size]) | @tweets_for_completion
|
121
130
|
history.inject(results){|r, line|
|
122
131
|
r | line.split.grep(regexp)
|
data/lib/earthquake/output.rb
CHANGED
@@ -102,8 +102,20 @@ module Earthquake
|
|
102
102
|
|
103
103
|
text = (item["retweeted_status"] && item["truncated"] ? "RT @#{item["retweeted_status"]["user"]["screen_name"]}: #{item["retweeted_status"]["text"]}" : item["text"]).u
|
104
104
|
text.gsub!(/\s+/, ' ') unless config[:raw_text]
|
105
|
+
text.prepend("\n") if config[:raw_text]
|
105
106
|
text = text.coloring(/@[0-9A-Za-z_]+/) { |i| color_of(i) }
|
106
107
|
text = text.coloring(/(^#[^\s]+)|(\s+#[^\s]+)/) { |i| color_of(i) }
|
108
|
+
if config[:expand_url]
|
109
|
+
entities = (item["retweeted_status"] && item["truncated"]) ? item["retweeted_status"]["entities"] : item["entities"]
|
110
|
+
if entities
|
111
|
+
entities.values_at("urls", "media").flatten.compact.each do |entity|
|
112
|
+
url, expanded_url = entity.values_at("url", "expanded_url")
|
113
|
+
if url && expanded_url
|
114
|
+
text = text.sub(url, expanded_url)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
107
119
|
text = text.coloring(URI.regexp(["http", "https"]), :url)
|
108
120
|
|
109
121
|
if item["_highlights"]
|
@@ -126,10 +138,20 @@ module Earthquake
|
|
126
138
|
end
|
127
139
|
|
128
140
|
output :delete do |item|
|
129
|
-
if
|
130
|
-
|
131
|
-
|
132
|
-
|
141
|
+
if deleted = item["delete"]
|
142
|
+
case
|
143
|
+
when deleted.key?("status")
|
144
|
+
if tweet = cache.read("status:#{deleted["status"]["id"]}")
|
145
|
+
screen_name = tweet["user"]["screen_name"]
|
146
|
+
text = tweet["text"]
|
147
|
+
else
|
148
|
+
next
|
149
|
+
end
|
150
|
+
when deleted.key?("direct_message")
|
151
|
+
screen_name = twitter.info["screen_name"]
|
152
|
+
text = "(direct message)"
|
153
|
+
end
|
154
|
+
puts "%s %s: %s" % ["[delete]".c(:event), screen_name, text]
|
133
155
|
end
|
134
156
|
end
|
135
157
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: earthquake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: twitter-stream
|
16
|
-
requirement: &
|
16
|
+
requirement: &70152961745040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70152961745040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: notify
|
27
|
-
requirement: &
|
27
|
+
requirement: &70152961734900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70152961734900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: i18n
|
38
|
-
requirement: &
|
38
|
+
requirement: &70152961734240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70152961734240
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activesupport
|
49
|
-
requirement: &
|
49
|
+
requirement: &70152961733620 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70152961733620
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: awesome_print
|
60
|
-
requirement: &
|
60
|
+
requirement: &70152961732480 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70152961732480
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: launchy
|
71
|
-
requirement: &
|
71
|
+
requirement: &70152961731100 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70152961731100
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: oauth
|
82
|
-
requirement: &
|
82
|
+
requirement: &70152961730460 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70152961730460
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: twitter_oauth
|
93
|
-
requirement: &
|
93
|
+
requirement: &70152961729340 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - =
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: 0.4.3
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70152961729340
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: slop
|
104
|
-
requirement: &
|
104
|
+
requirement: &70152961715140 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :runtime
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70152961715140
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rspec
|
115
|
-
requirement: &
|
115
|
+
requirement: &70152961719560 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ~>
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: 2.3.0
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70152961719560
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: bundler
|
126
|
-
requirement: &
|
126
|
+
requirement: &70152961717840 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: 1.0.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70152961717840
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: jeweler
|
137
|
-
requirement: &
|
137
|
+
requirement: &70152961716980 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
version: 1.5.2
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70152961716980
|
146
146
|
description: Twitter Client on Terminal with Twitter Streaming API.
|
147
147
|
email: jugyo.org@gmail.com
|
148
148
|
executables:
|
@@ -196,7 +196,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
198
|
rubyforge_project:
|
199
|
-
rubygems_version: 1.8.
|
199
|
+
rubygems_version: 1.8.11
|
200
200
|
signing_key:
|
201
201
|
specification_version: 3
|
202
202
|
summary: Twitter Client on Terminal.
|