earthquake 0.5.5 → 0.5.6
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/VERSION +1 -1
- data/earthquake.gemspec +3 -3
- data/lib/earthquake/commands.rb +6 -8
- data/lib/earthquake/core.rb +12 -13
- data/lib/earthquake/get_access_token.rb +1 -1
- data/lib/earthquake/input.rb +5 -3
- data/lib/earthquake/output.rb +1 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.6
|
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.5.
|
8
|
+
s.version = "0.5.6"
|
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-03-
|
12
|
+
s.date = %q{2011-03-28}
|
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 that, 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.0}
|
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
@@ -170,15 +170,13 @@ module Earthquake
|
|
170
170
|
end
|
171
171
|
|
172
172
|
command :thread do |m|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
while tweet["in_reply_to_status_id"]
|
177
|
-
indent += 1
|
178
|
-
tweet = twitter.status(tweet["in_reply_to_status_id"])
|
179
|
-
tweet["_mark"] = " " * indent
|
180
|
-
puts_items tweet
|
173
|
+
thread = [twitter.status(m[1])]
|
174
|
+
while reply = thread.last["in_reply_to_status_id"]
|
175
|
+
thread << twitter.status(reply)
|
181
176
|
end
|
177
|
+
puts_items thread.reverse_each.with_index{|tweet, indent|
|
178
|
+
tweet["_mark"] = " " * indent
|
179
|
+
}
|
182
180
|
end
|
183
181
|
|
184
182
|
command :sh do
|
data/lib/earthquake/core.rb
CHANGED
@@ -48,12 +48,12 @@ module Earthquake
|
|
48
48
|
|
49
49
|
def load_config
|
50
50
|
# TODO: parse argv
|
51
|
-
config.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
51
|
+
config[:dir] ||= File.expand_path(ARGV[0] || '~/.earthquake')
|
52
|
+
config[:time_format] ||= Time::DATE_FORMATS[:short]
|
53
|
+
config[:plugin_dir] ||= File.join(config[:dir], 'plugin')
|
54
|
+
config[:file] ||= File.join(config[:dir], 'config')
|
55
|
+
config[:consumer_key] ||= 'RmzuwQ5g0SYObMfebIKJag'
|
56
|
+
config[:consumer_secret] ||= 'V98dYYmWm9JoG7qfOF0jhJaVEVW3QhGYcDJ9JQSXU'
|
57
57
|
|
58
58
|
[config[:dir], config[:plugin_dir]].each do |dir|
|
59
59
|
unless File.exists?(dir)
|
@@ -61,14 +61,12 @@ module Earthquake
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
64
|
+
if File.exists?(config[:file])
|
65
|
+
load config[:file]
|
66
|
+
else
|
67
67
|
File.open(config[:file], 'w')
|
68
68
|
end
|
69
69
|
|
70
|
-
load config[:file]
|
71
|
-
|
72
70
|
get_access_token unless self.config[:token] && self.config[:secret]
|
73
71
|
end
|
74
72
|
|
@@ -83,8 +81,8 @@ module Earthquake
|
|
83
81
|
end
|
84
82
|
|
85
83
|
def start(*argv)
|
86
|
-
_once
|
87
84
|
_init
|
85
|
+
_once
|
88
86
|
restore_history
|
89
87
|
|
90
88
|
EventMachine::run do
|
@@ -154,7 +152,6 @@ module Earthquake
|
|
154
152
|
def stop
|
155
153
|
stop_stream
|
156
154
|
EventMachine.stop_event_loop
|
157
|
-
store_history
|
158
155
|
end
|
159
156
|
|
160
157
|
def store_history
|
@@ -191,8 +188,10 @@ module Earthquake
|
|
191
188
|
end
|
192
189
|
|
193
190
|
def notify(message, options = {:title => 'earthquake'})
|
191
|
+
message = message.is_a?(String) ? message : message.inspect
|
194
192
|
Notify.notify options[:title], message
|
195
193
|
end
|
194
|
+
alias_method :n, :notify
|
196
195
|
end
|
197
196
|
|
198
197
|
extend Core
|
@@ -12,7 +12,7 @@ module Earthquake
|
|
12
12
|
Launchy::Browser.run(request_token.authorize_url)
|
13
13
|
|
14
14
|
print "2) Enter the PIN: "
|
15
|
-
pin = gets.strip
|
15
|
+
pin = STDIN.gets.strip
|
16
16
|
|
17
17
|
access_token = request_token.get_access_token(:oauth_verifier => pin)
|
18
18
|
config[:token] = access_token.token
|
data/lib/earthquake/input.rb
CHANGED
@@ -26,6 +26,8 @@ module Earthquake
|
|
26
26
|
error e
|
27
27
|
end
|
28
28
|
|
29
|
+
return if text.empty?
|
30
|
+
|
29
31
|
begin
|
30
32
|
text = text.gsub(/\$\w+/) do |var|
|
31
33
|
var2id(var) || var
|
@@ -36,6 +38,8 @@ module Earthquake
|
|
36
38
|
elsif !text.empty?
|
37
39
|
puts "Command not found".c(43)
|
38
40
|
end
|
41
|
+
|
42
|
+
store_history
|
39
43
|
rescue Exception => e
|
40
44
|
error e
|
41
45
|
end
|
@@ -98,9 +102,7 @@ module Earthquake
|
|
98
102
|
results += command_names.grep(regexp)
|
99
103
|
|
100
104
|
range = Readline::HISTORY.count >= 100 ? -100..-1 : 0..-1
|
101
|
-
results += Readline::HISTORY.to_a[range].map { |line|
|
102
|
-
line.gsub(/^\s*:\w/, '').split(/\s+/)
|
103
|
-
}.flatten.grep(regexp)
|
105
|
+
results += Readline::HISTORY.to_a[range].map { |line| line.split(/\s+/) }.flatten.grep(regexp)
|
104
106
|
|
105
107
|
results
|
106
108
|
end
|
data/lib/earthquake/output.rb
CHANGED
@@ -76,8 +76,7 @@ module Earthquake
|
|
76
76
|
elsif item["retweeted_status"]
|
77
77
|
info << "(retweet of #{id2var(item["retweeted_status"]["id"])})"
|
78
78
|
end
|
79
|
-
|
80
|
-
info << Time.parse(item["created_at"]).to_s(:short)
|
79
|
+
info << Time.parse(item["created_at"]).strftime(config[:time_format])
|
81
80
|
if item["_detail"] && item["source"]
|
82
81
|
info << (item["source"].u =~ />(.*)</ ? $1 : 'web')
|
83
82
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: earthquake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.6
|
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-03-
|
13
|
+
date: 2011-03-28 00:00:00 +09:00
|
14
14
|
default_executable: earthquake
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
requirements: []
|
195
195
|
|
196
196
|
rubyforge_project:
|
197
|
-
rubygems_version: 1.6.
|
197
|
+
rubygems_version: 1.6.0
|
198
198
|
signing_key:
|
199
199
|
specification_version: 3
|
200
200
|
summary: Twitter Client on Terminal.
|