earthquake 0.6.11 → 0.6.12
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -2
- data/VERSION +1 -1
- data/earthquake.gemspec +3 -3
- data/lib/earthquake/commands.rb +1 -1
- data/lib/earthquake/core.rb +11 -3
- data/lib/earthquake/ext.rb +13 -21
- data/lib/earthquake/id_var.rb +18 -18
- data/lib/earthquake/input.rb +5 -7
- data/lib/earthquake/output.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -6,7 +6,8 @@ It supports only 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)
|
9
|
-
Demo: [http://www.youtube.com/watch?v=S2KtBGrIe5c](http://www.youtube.com/watch?v=S2KtBGrIe5c)
|
9
|
+
Demo: [http://www.youtube.com/watch?v=S2KtBGrIe5c](http://www.youtube.com/watch?v=S2KtBGrIe5c)
|
10
|
+
Slide: [http://www.slideshare.net/jugyo/earthquakegem](http://www.slideshare.net/jugyo/earthquakegem)
|
10
11
|
|
11
12
|
**We need patches that fix the english of the documentation!**
|
12
13
|
|
@@ -24,6 +25,10 @@ Install
|
|
24
25
|
|
25
26
|
$ gem install earthquake
|
26
27
|
|
28
|
+
**Ubuntu:** The EventMachine needs the package libssl-dev.
|
29
|
+
|
30
|
+
$ sudo apt-get install libssl-dev
|
31
|
+
|
27
32
|
Usage
|
28
33
|
----
|
29
34
|
|
@@ -143,7 +148,7 @@ You can try it by using the :eval command:
|
|
143
148
|
Plugins
|
144
149
|
----
|
145
150
|
|
146
|
-
|
151
|
+
see [https://github.com/jugyo/earthquake/wiki](https://github.com/jugyo/earthquake/wiki)
|
147
152
|
|
148
153
|
Making Plugin
|
149
154
|
----
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.12
|
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.12"
|
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-05-09}
|
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/commands.rb
CHANGED
@@ -112,7 +112,7 @@ Earthquake.init do
|
|
112
112
|
|
113
113
|
command %r|^:retweet\s+(\d+)\s+(.*)$|, :as => :retweet do |m|
|
114
114
|
target = twitter.status(m[1])
|
115
|
-
text = "#{m[2]} RT @#{target["user"]["screen_name"]}: #{target["text"]} (#{target["id"]})"
|
115
|
+
text = "#{m[2]} #{config[:quotetweet] ? "QT" : "RT"} @#{target["user"]["screen_name"]}: #{target["text"]} (#{target["id"]})"
|
116
116
|
if confirm("unofficial retweet '#{text}'")
|
117
117
|
async_e { twitter.update(text) }
|
118
118
|
end
|
data/lib/earthquake/core.rb
CHANGED
@@ -188,16 +188,24 @@ module Earthquake
|
|
188
188
|
end
|
189
189
|
|
190
190
|
def async(&block)
|
191
|
-
Thread.start
|
191
|
+
Thread.start do
|
192
|
+
begin
|
193
|
+
block.call
|
194
|
+
rescue Exception => e
|
195
|
+
error e
|
196
|
+
end
|
197
|
+
end
|
192
198
|
end
|
193
199
|
|
194
200
|
def error(e)
|
195
201
|
notify "[ERROR] #{e.message}\n#{e.backtrace.join("\n")}"
|
196
202
|
end
|
197
203
|
|
198
|
-
def notify(message, options = {
|
204
|
+
def notify(message, options = {})
|
205
|
+
args = {:title => 'earthquake'}.update(options)
|
206
|
+
title = args.delete(:title)
|
199
207
|
message = message.is_a?(String) ? message : message.inspect
|
200
|
-
Notify.notify
|
208
|
+
Notify.notify title, message.e, args
|
201
209
|
end
|
202
210
|
alias_method :n, :notify
|
203
211
|
|
data/lib/earthquake/ext.rb
CHANGED
@@ -51,27 +51,19 @@ class String
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
54
|
+
t = {
|
55
|
+
?& => "&",
|
56
|
+
?< => "<",
|
57
|
+
?> => ">",
|
58
|
+
?' => "'",
|
59
|
+
?" => """,
|
60
|
+
}
|
61
|
+
|
62
|
+
define_method(:u) do
|
63
|
+
gsub(/(#{Regexp.union(t.values)})/o, t.invert)
|
64
64
|
end
|
65
65
|
|
66
|
-
|
67
|
-
gsub(/[
|
68
|
-
case s
|
69
|
-
when '&' then '&'
|
70
|
-
when '<' then '<'
|
71
|
-
when '>' then '>'
|
72
|
-
when "'" then '''
|
73
|
-
when '"' then '"'
|
74
|
-
end
|
75
|
-
end
|
66
|
+
define_method(:e) do
|
67
|
+
gsub(/[#{t.keys.join}]/o, t)
|
76
68
|
end
|
77
|
-
end
|
69
|
+
end
|
data/lib/earthquake/id_var.rb
CHANGED
@@ -11,33 +11,33 @@ module Earthquake
|
|
11
11
|
end
|
12
12
|
|
13
13
|
class Gen
|
14
|
-
def initialize(vars =
|
15
|
-
|
16
|
-
raise ArgumentError,
|
17
|
-
elsif vars.empty?
|
18
|
-
raise ArgumentError, 'vars should not be empty'
|
14
|
+
def initialize(vars = "aa".."zz", prefix = "$")
|
15
|
+
unless Range === vars and String === vars.first
|
16
|
+
raise ArgumentError, "vars should be a Range of String"
|
19
17
|
end
|
20
|
-
@vars = vars
|
21
|
-
@
|
22
|
-
@
|
18
|
+
@vars = vars
|
19
|
+
@var = @vars.last.dup
|
20
|
+
@table = ActiveSupport::Cache::MemoryStore.new
|
23
21
|
@prefix = prefix
|
24
22
|
end
|
25
23
|
|
26
24
|
def var2id(var)
|
27
|
-
@table
|
25
|
+
@table.read(var)
|
28
26
|
end
|
29
27
|
|
30
28
|
def id2var(id)
|
31
|
-
@
|
29
|
+
@table.read(id) || succ(id)
|
32
30
|
end
|
33
31
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
@
|
38
|
-
|
39
|
-
@
|
40
|
-
var
|
32
|
+
private
|
33
|
+
|
34
|
+
def succ(id)
|
35
|
+
@var.replace(@vars.first.dup) unless @vars.include?(@var.next!)
|
36
|
+
var = @prefix + @var
|
37
|
+
@table.delete(@table.read(var))
|
38
|
+
@table.write(var, id)
|
39
|
+
@table.write(id, var)
|
40
|
+
var.dup
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -47,4 +47,4 @@ module Earthquake
|
|
47
47
|
init do
|
48
48
|
self.id_var ||= IdVar::Gen.new
|
49
49
|
end
|
50
|
-
end
|
50
|
+
end
|
data/lib/earthquake/input.rb
CHANGED
@@ -97,7 +97,7 @@ module Earthquake
|
|
97
97
|
Readline.completion_proc = lambda do |text|
|
98
98
|
completions.inject([]) do |results, completion|
|
99
99
|
begin
|
100
|
-
results
|
100
|
+
results | (completion.call(text) || [])
|
101
101
|
rescue Exception => e
|
102
102
|
error e
|
103
103
|
results
|
@@ -106,15 +106,13 @@ module Earthquake
|
|
106
106
|
end
|
107
107
|
|
108
108
|
completion do |text|
|
109
|
-
results = []
|
110
109
|
regexp = /^#{Regexp.quote(text)}/
|
111
110
|
|
112
|
-
results
|
111
|
+
results = command_names.grep(regexp)
|
113
112
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
results
|
113
|
+
Readline::HISTORY.reverse_each.take(config[:history_size]).inject(results){|r, line|
|
114
|
+
r | line.split.grep(regexp)
|
115
|
+
}
|
118
116
|
end
|
119
117
|
|
120
118
|
input_filter do |text|
|
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["text"].u
|
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.6.
|
5
|
+
version: 0.6.12
|
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-05-09 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.
|