earthquake 0.6.9 → 0.6.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/earthquake +4 -2
- data/earthquake.gemspec +3 -3
- data/lib/earthquake/commands.rb +9 -4
- data/lib/earthquake/core.rb +2 -2
- data/lib/earthquake/output.rb +11 -8
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.10
|
data/bin/earthquake
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'slop'
|
3
|
-
|
3
|
+
|
4
|
+
argv = ARGV.dup
|
5
|
+
opts = Slop.parse! argv, :help => true do
|
4
6
|
banner "Usage: earthquake [options] [directory]"
|
5
7
|
on :d, :debug, 'Enable debug mode'
|
6
8
|
end
|
7
9
|
options = opts.to_hash(true)
|
8
10
|
options.delete(:help)
|
9
|
-
options[:dir] =
|
11
|
+
options[:dir] = argv.shift unless argv.empty?
|
10
12
|
|
11
13
|
$:.unshift(File.expand_path('../../lib', __FILE__)) if $0 == __FILE__
|
12
14
|
|
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.10"
|
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-04-
|
12
|
+
s.date = %q{2011-04-16}
|
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.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
@@ -13,7 +13,7 @@ Earthquake.init do
|
|
13
13
|
command :restart do
|
14
14
|
puts 'restarting...'
|
15
15
|
stop
|
16
|
-
exec File.expand_path('../../../bin/earthquake', __FILE__)
|
16
|
+
exec File.expand_path('../../../bin/earthquake', __FILE__), *ARGV
|
17
17
|
end
|
18
18
|
|
19
19
|
command :eval do |m|
|
@@ -70,7 +70,7 @@ Earthquake.init do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
command :recent do
|
73
|
-
puts_items twitter.home_timeline
|
73
|
+
puts_items twitter.home_timeline(:count => config[:recent_count])
|
74
74
|
end
|
75
75
|
|
76
76
|
# :recent jugyo
|
@@ -190,6 +190,11 @@ Earthquake.init do
|
|
190
190
|
}
|
191
191
|
end
|
192
192
|
|
193
|
+
command :update_profile_image do |m|
|
194
|
+
image_path = File.expand_path(m[1].gsub('\\', ''))
|
195
|
+
async_e { twitter.update_profile_image(File.open(image_path, 'rb')) }
|
196
|
+
end
|
197
|
+
|
193
198
|
command %r|^:open\s+(\d+)$|, :as => :open do |m|
|
194
199
|
if match = twitter.status(m[1])["text"].match(URI.regexp(["http", "https"]))
|
195
200
|
browse match[0]
|
@@ -209,7 +214,7 @@ Earthquake.init do
|
|
209
214
|
end
|
210
215
|
|
211
216
|
command :'!' do |m|
|
212
|
-
system m[1]
|
217
|
+
system eval("\"#{m[1]}\"").to_s
|
213
218
|
end
|
214
219
|
|
215
220
|
command :plugin_install do |m|
|
@@ -240,6 +245,6 @@ Earthquake.init do
|
|
240
245
|
end
|
241
246
|
|
242
247
|
command :edit_config do
|
243
|
-
system ENV["EDITOR"]
|
248
|
+
system ENV["EDITOR"] + " #{config[:file]}"
|
244
249
|
end
|
245
250
|
end
|
data/lib/earthquake/core.rb
CHANGED
@@ -56,6 +56,7 @@ module Earthquake
|
|
56
56
|
config[:prompt] ||= '⚡ '
|
57
57
|
config[:consumer_key] ||= 'RmzuwQ5g0SYObMfebIKJag'
|
58
58
|
config[:consumer_secret] ||= 'V98dYYmWm9JoG7qfOF0jhJaVEVW3QhGYcDJ9JQSXU'
|
59
|
+
config[:output_interval] ||= 1
|
59
60
|
|
60
61
|
[config[:dir], config[:plugin_dir]].each do |dir|
|
61
62
|
unless File.exists?(dir)
|
@@ -105,10 +106,9 @@ module Earthquake
|
|
105
106
|
Thread.start do
|
106
107
|
loop do
|
107
108
|
if Readline.line_buffer.nil? || Readline.line_buffer.empty?
|
108
|
-
reload
|
109
109
|
sync { output }
|
110
110
|
end
|
111
|
-
sleep
|
111
|
+
sleep config[:output_interval]
|
112
112
|
end
|
113
113
|
end
|
114
114
|
|
data/lib/earthquake/output.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# encoding: UTF-8
|
2
|
+
require 'stringio'
|
3
|
+
|
2
4
|
module Earthquake
|
3
5
|
module Output
|
4
6
|
def output_filters
|
@@ -18,7 +20,6 @@ module Earthquake
|
|
18
20
|
outputs.delete_if { |o| o[:name] == name } if name
|
19
21
|
outputs << {:name => name, :block => block}
|
20
22
|
else
|
21
|
-
return if item_queue.empty?
|
22
23
|
insert do
|
23
24
|
while item = item_queue.shift
|
24
25
|
item["_stream"] = true
|
@@ -42,15 +43,17 @@ module Earthquake
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def insert(*messages)
|
45
|
-
|
46
|
-
|
46
|
+
$stdout = StringIO.new
|
47
|
+
|
48
|
+
puts messages
|
47
49
|
yield if block_given?
|
48
|
-
ensure
|
49
|
-
Readline.refresh_line
|
50
|
-
end
|
51
50
|
|
52
|
-
|
53
|
-
|
51
|
+
unless $stdout.string.empty?
|
52
|
+
STDOUT.print "\e[0G\e[K#{$stdout.string}"
|
53
|
+
Readline.refresh_line
|
54
|
+
end
|
55
|
+
ensure
|
56
|
+
$stdout = STDOUT
|
54
57
|
end
|
55
58
|
|
56
59
|
def color_of(screen_name)
|
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.10
|
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-04-
|
13
|
+
date: 2011-04-16 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.0
|
209
209
|
signing_key:
|
210
210
|
specification_version: 3
|
211
211
|
summary: Twitter Client on Terminal.
|