earthquake 0.7.4 → 0.7.5
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 +14 -15
- data/VERSION +1 -1
- data/earthquake.gemspec +2 -2
- data/lib/earthquake/commands.rb +10 -5
- data/lib/earthquake/core.rb +10 -4
- data/lib/earthquake/input.rb +3 -3
- data/lib/earthquake/output.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Earthquake
|
2
2
|
====
|
3
3
|
|
4
|
-
Terminal-based Twitter Client with Streaming API.
|
5
|
-
|
4
|
+
Terminal-based Twitter Client with Streaming API support.
|
5
|
+
Only supports Ruby 1.9.
|
6
6
|
|
7
7
|
Homepage: [https://github.com/jugyo/earthquake](https://github.com/jugyo/earthquake)
|
8
8
|
Twitter: [http://twitter.com/earthquakegem](http://twitter.com/earthquakegem)
|
@@ -16,16 +16,16 @@ Slide: [http://www.slideshare.net/jugyo/earthquakegem](http://www.slideshare.net
|
|
16
16
|
Features
|
17
17
|
----
|
18
18
|
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
19
|
+
* Use Twitter entirely in your Terminal.
|
20
|
+
* Receive data in real time with Streaming API.
|
21
|
+
* Easily extend using Ruby.
|
22
22
|
|
23
23
|
Install
|
24
24
|
----
|
25
25
|
|
26
26
|
$ gem install earthquake
|
27
27
|
|
28
|
-
**Ubuntu:**
|
28
|
+
**Ubuntu:** EventMachine needs the package libssl-dev.
|
29
29
|
|
30
30
|
$ sudo apt-get install libssl-dev
|
31
31
|
|
@@ -102,28 +102,27 @@ Commands
|
|
102
102
|
|
103
103
|
⚡ :alias rt retweet
|
104
104
|
|
105
|
-
And
|
105
|
+
And more!
|
106
106
|
|
107
107
|
Configuration
|
108
108
|
----
|
109
109
|
|
110
|
-
The default earthquake
|
110
|
+
The default earthquake directory is ~/.earthquake.
|
111
111
|
|
112
112
|
The config file is **~/.earthquake/config**.
|
113
113
|
|
114
114
|
### Changing the earthquake directory
|
115
115
|
|
116
|
-
You can change the directory at launch as
|
116
|
+
You can change the directory at launch by entering a directory as an argument. For example:
|
117
117
|
|
118
118
|
$ earthquake ~/.earthquake_foo
|
119
119
|
|
120
120
|
### Changing the colors for user name
|
121
121
|
|
122
122
|
# ~/.earthquake/config
|
123
|
+
# For example, to exclude blue:
|
123
124
|
Earthquake.config[:colors] = (31..36).to_a - [34]
|
124
125
|
|
125
|
-
Blue is excluded.
|
126
|
-
|
127
126
|
### Changing the color scheme
|
128
127
|
|
129
128
|
# ~/.earthquake/config
|
@@ -141,7 +140,7 @@ Blue is excluded.
|
|
141
140
|
|
142
141
|
### HTTP proxy support
|
143
142
|
|
144
|
-
Please set environment variable *http_proxy* if you want earthquake to use http proxy.
|
143
|
+
Please set environment variable *http_proxy* if you want earthquake to use an http proxy.
|
145
144
|
|
146
145
|
Desktop Notifications
|
147
146
|
----
|
@@ -161,9 +160,9 @@ You can try it by using the :eval command:
|
|
161
160
|
Plugins
|
162
161
|
----
|
163
162
|
|
164
|
-
|
163
|
+
See [https://github.com/jugyo/earthquake/wiki](https://github.com/jugyo/earthquake/wiki)
|
165
164
|
|
166
|
-
Making
|
165
|
+
Making Plugins
|
167
166
|
----
|
168
167
|
|
169
168
|
**~/.earthquake/plugin** is the directory for plugins.
|
@@ -188,7 +187,7 @@ The block that is specified for Earthquake.init will be reloaded at any command
|
|
188
187
|
end
|
189
188
|
end
|
190
189
|
|
191
|
-
|
190
|
+
'm' is a [http://www.ruby-doc.org/core/classes/MatchData.html](MatchData) object.
|
192
191
|
|
193
192
|
#### Using regexp:
|
194
193
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.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.7.
|
8
|
+
s.version = "0.7.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-
|
12
|
+
s.date = %q{2011-07-22}
|
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}
|
data/lib/earthquake/commands.rb
CHANGED
@@ -206,9 +206,13 @@ Earthquake.init do
|
|
206
206
|
end
|
207
207
|
end
|
208
208
|
|
209
|
-
command
|
210
|
-
url =
|
211
|
-
|
209
|
+
command :browse do |m|
|
210
|
+
url = case m[1]
|
211
|
+
when /^\d+$/
|
212
|
+
"https://twitter.com/#{twitter.status(m[1])['user']['screen_name']}/status/#{m[1]}"
|
213
|
+
else
|
214
|
+
"https://twitter.com/#{m[1][/[^'"]+/]}"
|
215
|
+
end
|
212
216
|
browse url
|
213
217
|
end
|
214
218
|
|
@@ -248,10 +252,11 @@ Earthquake.init do
|
|
248
252
|
end
|
249
253
|
|
250
254
|
command :edit_config do
|
251
|
-
|
255
|
+
editor = ENV["EDITOR"] || 'vim'
|
256
|
+
system "#{editor} #{config[:file]}"
|
252
257
|
end
|
253
258
|
|
254
|
-
command %r|^:alias\s
|
259
|
+
command %r|^:alias\s+?(:\w+)\s+(.+)|, :as => :alias do |m|
|
255
260
|
alias_command m[1], m[2]
|
256
261
|
end
|
257
262
|
end
|
data/lib/earthquake/core.rb
CHANGED
@@ -182,8 +182,14 @@ module Earthquake
|
|
182
182
|
|
183
183
|
def restore_history
|
184
184
|
history_file = File.join(config[:dir], 'history')
|
185
|
-
|
186
|
-
File.read(history_file
|
185
|
+
begin
|
186
|
+
File.read(history_file, :encoding => "BINARY").
|
187
|
+
encode!(:invalid => :replace, :undef => :replace).
|
188
|
+
split(/\n/).
|
189
|
+
each { |line| Readline::HISTORY << line }
|
190
|
+
rescue Errno::ENOENT
|
191
|
+
rescue Errno::EACCES => e
|
192
|
+
error(e)
|
187
193
|
end
|
188
194
|
end
|
189
195
|
|
@@ -216,12 +222,12 @@ module Earthquake
|
|
216
222
|
title = args.delete(:title)
|
217
223
|
message = message.is_a?(String) ? message : message.inspect
|
218
224
|
# FIXME: Escaping should be done at Notify.notify
|
219
|
-
Notify.notify title, message.e
|
225
|
+
Notify.notify title, message.e
|
220
226
|
end
|
221
227
|
alias_method :n, :notify
|
222
228
|
|
223
229
|
def browse(url)
|
224
|
-
Launchy
|
230
|
+
Launchy.open(url)
|
225
231
|
end
|
226
232
|
end
|
227
233
|
|
data/lib/earthquake/input.rb
CHANGED
@@ -115,7 +115,7 @@ module Earthquake
|
|
115
115
|
|
116
116
|
completion do |text|
|
117
117
|
regexp = /^#{Regexp.quote(text)}/
|
118
|
-
results = (command_names + command_aliases.keys
|
118
|
+
results = (command_names + command_aliases.keys).grep(regexp)
|
119
119
|
history = Readline::HISTORY.reverse_each.take(config[:history_size]) | @tweets_for_completion
|
120
120
|
history.inject(results){|r, line|
|
121
121
|
r | line.split.grep(regexp)
|
@@ -131,9 +131,9 @@ module Earthquake
|
|
131
131
|
end
|
132
132
|
|
133
133
|
input_filter do |text|
|
134
|
-
if text =~ %r
|
134
|
+
if text =~ %r|^(:\w+)|
|
135
135
|
if target = command_aliases[$1]
|
136
|
-
text = text.sub(%r|^:\w+|,
|
136
|
+
text = text.sub(%r|^:\w+|, target)
|
137
137
|
end
|
138
138
|
text = text.gsub(/\$\w+/) { |var| var2id(var) || var }
|
139
139
|
end
|
data/lib/earthquake/output.rb
CHANGED
@@ -93,7 +93,7 @@ module Earthquake
|
|
93
93
|
|
94
94
|
id = id2var(item["id"])
|
95
95
|
|
96
|
-
text = (item["retweeted_status"] && item["truncated"] ? "RT
|
96
|
+
text = (item["retweeted_status"] && item["truncated"] ? "RT @#{item["retweeted_status"]["user"]["screen_name"]}: #{item["retweeted_status"]["text"]}" : item["text"]).u
|
97
97
|
text.gsub!(/\s+/, ' ') unless config[:raw_text]
|
98
98
|
text = text.coloring(/@[0-9A-Za-z_]+/) { |i| color_of(i) }
|
99
99
|
text = text.coloring(/(^#[^\s]+)|(\s+#[^\s]+)/) { |i| color_of(i) }
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: earthquake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.7.
|
5
|
+
version: 0.7.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-
|
13
|
+
date: 2011-07-22 00:00:00 +09:00
|
14
14
|
default_executable: earthquake
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|