jugyo-termtter 1.1.3 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +115 -0
- data/README.rdoc +25 -10
- data/Rakefile +53 -34
- data/lib/plugins/cool.rb +2 -5
- data/lib/plugins/curry.rb +43 -0
- data/lib/plugins/db.rb +91 -0
- data/lib/plugins/{auto_reload.rb → defaults/auto_reload.rb} +5 -1
- data/lib/plugins/defaults/command_line.rb +111 -0
- data/lib/plugins/{exec.rb → defaults/exec.rb} +2 -7
- data/lib/plugins/{fib.rb → defaults/fib.rb} +1 -4
- data/lib/plugins/defaults/retweet.rb +34 -0
- data/lib/plugins/{standard_commands.rb → defaults/standard_commands.rb} +88 -162
- data/lib/plugins/defaults/standard_completion.rb +67 -0
- data/lib/plugins/defaults/stdout.rb +148 -0
- data/lib/plugins/defaults.rb +14 -0
- data/lib/plugins/en2ja.rb +11 -5
- data/lib/plugins/english.rb +2 -2
- data/lib/plugins/expand-tinyurl.rb +27 -6
- data/lib/plugins/github-issues.rb +192 -0
- data/lib/plugins/group.rb +30 -4
- data/lib/plugins/growl.rb +10 -1
- data/lib/plugins/http_server/favicon.ico +0 -0
- data/lib/plugins/http_server/index.html +117 -0
- data/lib/plugins/http_server.rb +82 -0
- data/lib/plugins/irb.rb +6 -0
- data/lib/plugins/l2.rb +1 -1
- data/lib/plugins/list_with_opts.rb +0 -3
- data/lib/plugins/log.rb +6 -9
- data/lib/plugins/modify_arg_hook_sample.rb +3 -5
- data/lib/plugins/multi_reply.rb +0 -5
- data/lib/plugins/notify-send.rb +1 -1
- data/lib/plugins/notify-send2.rb +1 -1
- data/lib/plugins/notify-send3.rb +11 -3
- data/lib/plugins/open_url.rb +5 -17
- data/lib/plugins/otsune.rb +3 -9
- data/lib/plugins/outputz.rb +1 -1
- data/lib/plugins/pool.rb +30 -0
- data/lib/plugins/protected_filter.rb +9 -0
- data/lib/plugins/quicklook.rb +1 -1
- data/lib/plugins/saykanji.rb +81 -0
- data/lib/plugins/shell.rb +1 -6
- data/lib/plugins/sl.rb +8 -8
- data/lib/plugins/tinyurl.rb +26 -7
- data/lib/plugins/trends.rb +84 -0
- data/lib/plugins/twitpic.rb +46 -0
- data/lib/plugins/uri-open.rb +33 -28
- data/lib/plugins/wassr.rb +0 -3
- data/lib/plugins/whois.rb +45 -0
- data/lib/plugins/yhara.rb +2 -6
- data/lib/termtter/client.rb +91 -103
- data/lib/termtter/command.rb +24 -9
- data/lib/termtter/config.rb +8 -6
- data/lib/termtter/config_setup.rb +1 -1
- data/lib/termtter/config_template.erb +1 -4
- data/lib/termtter/hook.rb +2 -2
- data/lib/termtter/optparse.rb +14 -1
- data/lib/termtter/system_extensions.rb +3 -2
- data/lib/termtter/task_manager.rb +1 -5
- data/lib/termtter/version.rb +1 -1
- data/spec/plugins/cool_spec.rb +1 -1
- data/spec/plugins/curry_spec.rb +13 -0
- data/spec/plugins/db_spec.rb +62 -0
- data/spec/plugins/english_spec.rb +2 -2
- data/spec/plugins/fib_spec.rb +2 -2
- data/spec/plugins/filter_spec.rb +2 -2
- data/spec/plugins/pause_spec.rb +1 -1
- data/spec/plugins/primes_spec.rb +2 -2
- data/spec/plugins/shell_spec.rb +1 -1
- data/spec/plugins/sl_spec.rb +1 -1
- data/spec/plugins/{standard_plugins_spec.rb → standard_commands_spec.rb} +2 -2
- data/spec/plugins/whois_spec.rb +20 -0
- data/spec/termtter/client_spec.rb +151 -33
- data/spec/termtter/command_spec.rb +68 -35
- data/spec/termtter/config_spec.rb +10 -0
- data/spec/termtter/optparse_spec.rb +16 -0
- data/spec/termtter_spec.rb +7 -8
- metadata +48 -19
- data/History.txt +0 -4
- data/lib/plugins/direct_messages.rb +0 -36
- data/lib/plugins/retweet.rb +0 -46
- data/lib/plugins/stdout.rb +0 -77
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jugyo-termtter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jugyo
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-07-27 00:00:00 -07:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.6.4
|
55
55
|
version:
|
56
|
-
description: Termtter is a terminal based Twitter client
|
56
|
+
description: Termtter is a terminal based Twitter client.
|
57
57
|
email: jugyo.org@gmail.com
|
58
58
|
executables:
|
59
59
|
- kill_termtter
|
@@ -62,28 +62,41 @@ extensions: []
|
|
62
62
|
|
63
63
|
extra_rdoc_files:
|
64
64
|
- README.rdoc
|
65
|
-
-
|
65
|
+
- ChangeLog
|
66
66
|
files:
|
67
|
+
- Rakefile
|
68
|
+
- README.rdoc
|
69
|
+
- ChangeLog
|
70
|
+
- lib/plugins
|
67
71
|
- lib/plugins/addspace.rb
|
68
72
|
- lib/plugins/april_fool.rb
|
69
|
-
- lib/plugins/auto_reload.rb
|
70
73
|
- lib/plugins/bomb.rb
|
71
74
|
- lib/plugins/clear.rb
|
72
75
|
- lib/plugins/command_plus.rb
|
73
76
|
- lib/plugins/confirm.rb
|
74
77
|
- lib/plugins/cool.rb
|
75
78
|
- lib/plugins/countter.rb
|
79
|
+
- lib/plugins/curry.rb
|
80
|
+
- lib/plugins/db.rb
|
81
|
+
- lib/plugins/defaults
|
82
|
+
- lib/plugins/defaults/auto_reload.rb
|
83
|
+
- lib/plugins/defaults/command_line.rb
|
84
|
+
- lib/plugins/defaults/exec.rb
|
85
|
+
- lib/plugins/defaults/fib.rb
|
86
|
+
- lib/plugins/defaults/retweet.rb
|
87
|
+
- lib/plugins/defaults/standard_commands.rb
|
88
|
+
- lib/plugins/defaults/standard_completion.rb
|
89
|
+
- lib/plugins/defaults/stdout.rb
|
90
|
+
- lib/plugins/defaults.rb
|
76
91
|
- lib/plugins/devel.rb
|
77
|
-
- lib/plugins/direct_messages.rb
|
78
92
|
- lib/plugins/en2ja.rb
|
79
93
|
- lib/plugins/english.rb
|
80
94
|
- lib/plugins/erb.rb
|
81
|
-
- lib/plugins/exec.rb
|
82
95
|
- lib/plugins/exec_and_update.rb
|
83
96
|
- lib/plugins/expand-tinyurl.rb
|
84
|
-
- lib/plugins/fib.rb
|
85
97
|
- lib/plugins/fib_filter.rb
|
86
98
|
- lib/plugins/filter.rb
|
99
|
+
- lib/plugins/github-issues.rb
|
87
100
|
- lib/plugins/graduatter.rb
|
88
101
|
- lib/plugins/grass.rb
|
89
102
|
- lib/plugins/group.rb
|
@@ -92,7 +105,12 @@ files:
|
|
92
105
|
- lib/plugins/hatebu.rb
|
93
106
|
- lib/plugins/hatebu_and_update.rb
|
94
107
|
- lib/plugins/history.rb
|
108
|
+
- lib/plugins/http_server
|
109
|
+
- lib/plugins/http_server/favicon.ico
|
110
|
+
- lib/plugins/http_server/index.html
|
111
|
+
- lib/plugins/http_server.rb
|
95
112
|
- lib/plugins/ignore.rb
|
113
|
+
- lib/plugins/irb.rb
|
96
114
|
- lib/plugins/irc_gw.rb
|
97
115
|
- lib/plugins/keyword.rb
|
98
116
|
- lib/plugins/l2.rb
|
@@ -111,17 +129,19 @@ files:
|
|
111
129
|
- lib/plugins/otsune.rb
|
112
130
|
- lib/plugins/outputz.rb
|
113
131
|
- lib/plugins/pause.rb
|
132
|
+
- lib/plugins/pool.rb
|
114
133
|
- lib/plugins/post_exec_hook_sample.rb
|
115
134
|
- lib/plugins/pre_exec_hook_sample.rb
|
116
135
|
- lib/plugins/primes.rb
|
136
|
+
- lib/plugins/protected_filter.rb
|
117
137
|
- lib/plugins/quicklook.rb
|
118
138
|
- lib/plugins/random.rb
|
119
139
|
- lib/plugins/reblog.rb
|
120
140
|
- lib/plugins/reload.rb
|
121
141
|
- lib/plugins/reply.rb
|
122
|
-
- lib/plugins/retweet.rb
|
123
142
|
- lib/plugins/reverse.rb
|
124
143
|
- lib/plugins/say.rb
|
144
|
+
- lib/plugins/saykanji.rb
|
125
145
|
- lib/plugins/scrape.rb
|
126
146
|
- lib/plugins/screen-notify.rb
|
127
147
|
- lib/plugins/screen.rb
|
@@ -129,8 +149,7 @@ files:
|
|
129
149
|
- lib/plugins/shell.rb
|
130
150
|
- lib/plugins/sl.rb
|
131
151
|
- lib/plugins/spam.rb
|
132
|
-
- lib/plugins/
|
133
|
-
- lib/plugins/stdout.rb
|
152
|
+
- lib/plugins/storage
|
134
153
|
- lib/plugins/storage/DB.rb
|
135
154
|
- lib/plugins/storage/status.rb
|
136
155
|
- lib/plugins/storage/status_mook.rb
|
@@ -140,19 +159,24 @@ files:
|
|
140
159
|
- lib/plugins/timer.rb
|
141
160
|
- lib/plugins/tinyurl.rb
|
142
161
|
- lib/plugins/translation.rb
|
162
|
+
- lib/plugins/trends.rb
|
163
|
+
- lib/plugins/twitpic.rb
|
143
164
|
- lib/plugins/typable_id.rb
|
144
165
|
- lib/plugins/update_editor.rb
|
145
166
|
- lib/plugins/uri-open.rb
|
146
167
|
- lib/plugins/wassr.rb
|
147
168
|
- lib/plugins/wassr_post.rb
|
169
|
+
- lib/plugins/whois.rb
|
148
170
|
- lib/plugins/yhara.rb
|
149
171
|
- lib/plugins/yhara_filter.rb
|
150
172
|
- lib/plugins/yonda.rb
|
173
|
+
- lib/termtter
|
151
174
|
- lib/termtter/api.rb
|
152
175
|
- lib/termtter/client.rb
|
153
176
|
- lib/termtter/command.rb
|
154
177
|
- lib/termtter/config.rb
|
155
178
|
- lib/termtter/config_setup.rb
|
179
|
+
- lib/termtter/config_template.erb
|
156
180
|
- lib/termtter/connection.rb
|
157
181
|
- lib/termtter/hook.rb
|
158
182
|
- lib/termtter/optparse.rb
|
@@ -161,8 +185,10 @@ files:
|
|
161
185
|
- lib/termtter/task_manager.rb
|
162
186
|
- lib/termtter/version.rb
|
163
187
|
- lib/termtter.rb
|
164
|
-
-
|
188
|
+
- spec/plugins
|
165
189
|
- spec/plugins/cool_spec.rb
|
190
|
+
- spec/plugins/curry_spec.rb
|
191
|
+
- spec/plugins/db_spec.rb
|
166
192
|
- spec/plugins/english_spec.rb
|
167
193
|
- spec/plugins/fib_spec.rb
|
168
194
|
- spec/plugins/filter_spec.rb
|
@@ -171,23 +197,26 @@ files:
|
|
171
197
|
- spec/plugins/shell_spec.rb
|
172
198
|
- spec/plugins/sl_spec.rb
|
173
199
|
- spec/plugins/spam_spec.rb
|
174
|
-
- spec/plugins/
|
200
|
+
- spec/plugins/standard_commands_spec.rb
|
201
|
+
- spec/plugins/storage
|
175
202
|
- spec/plugins/storage/DB_spec.rb
|
176
203
|
- spec/plugins/storage/status_spec.rb
|
204
|
+
- spec/plugins/whois_spec.rb
|
177
205
|
- spec/spec_helper.rb
|
206
|
+
- spec/termtter
|
178
207
|
- spec/termtter/client_spec.rb
|
179
208
|
- spec/termtter/command_spec.rb
|
180
209
|
- spec/termtter/config_spec.rb
|
181
210
|
- spec/termtter/hook_spec.rb
|
211
|
+
- spec/termtter/optparse_spec.rb
|
182
212
|
- spec/termtter/task_manager_spec.rb
|
183
213
|
- spec/termtter/task_spec.rb
|
184
214
|
- spec/termtter_spec.rb
|
185
215
|
- test/friends_timeline.json
|
186
216
|
- test/search.json
|
187
|
-
-
|
188
|
-
-
|
189
|
-
|
190
|
-
has_rdoc: true
|
217
|
+
- bin/kill_termtter
|
218
|
+
- bin/termtter
|
219
|
+
has_rdoc: false
|
191
220
|
homepage: http://wiki.github.com/jugyo/termtter
|
192
221
|
post_install_message:
|
193
222
|
rdoc_options:
|
@@ -214,7 +243,7 @@ requirements: []
|
|
214
243
|
rubyforge_project: termtter
|
215
244
|
rubygems_version: 1.2.0
|
216
245
|
signing_key:
|
217
|
-
specification_version:
|
218
|
-
summary: Terminal based Twitter client
|
246
|
+
specification_version: 3
|
247
|
+
summary: Terminal based Twitter client.
|
219
248
|
test_files: []
|
220
249
|
|
data/History.txt
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
module Termtter::Client
|
3
|
-
register_command(
|
4
|
-
:name => :direct_messages,
|
5
|
-
:aliases => [:ds],
|
6
|
-
:exec_proc => lambda {|arg|
|
7
|
-
event = :list_user_timeline
|
8
|
-
ds = Termtter::API.twitter.direct_messages
|
9
|
-
DM = Struct.new :id, :text, :user, :created_at, :in_reply_to_status_id
|
10
|
-
statuses = ds.map do |d|
|
11
|
-
DM.new(d.id, d.text, d.sender, d.created_at)
|
12
|
-
end
|
13
|
-
output(statuses, event)
|
14
|
-
},
|
15
|
-
:completion_proc => lambda {|cmd, arg|
|
16
|
-
},
|
17
|
-
:help => ['direct_messages,ds', 'List direct messages for you']
|
18
|
-
)
|
19
|
-
|
20
|
-
register_command(
|
21
|
-
:name => :sent_direct_messages,
|
22
|
-
:aliases => [:sds],
|
23
|
-
:exec_proc => lambda {|arg|
|
24
|
-
event = :list_user_timeline
|
25
|
-
ds = Termtter::API.twitter.sent_direct_messages
|
26
|
-
DM = Struct.new :id, :text, :user, :created_at, :in_reply_to_status_id
|
27
|
-
statuses = ds.map do |d|
|
28
|
-
DM.new(d.id, "@#{d.recipient.screen_name} #{d.text}", d.sender, d.created_at)
|
29
|
-
end
|
30
|
-
output(statuses, event)
|
31
|
-
},
|
32
|
-
:completion_proc => lambda {|cmd, arg|
|
33
|
-
},
|
34
|
-
:help => ['sent_direct_messages, sds', 'List direct messages from you']
|
35
|
-
)
|
36
|
-
end
|
data/lib/plugins/retweet.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
config.plugins.retweet.set_default(:format, 'RT @<%=s.user.screen_name%>: <%=s.text%>')
|
4
|
-
|
5
|
-
module Termtter::Client
|
6
|
-
def self.post_retweet(s)
|
7
|
-
text = ERB.new(config.plugins.retweet.format).result(binding)
|
8
|
-
Termtter::API.twitter.update(text)
|
9
|
-
puts "=> #{text}"
|
10
|
-
end
|
11
|
-
|
12
|
-
register_command(
|
13
|
-
:name => :retweet,
|
14
|
-
:aliases => [:rt],
|
15
|
-
:help => ['retweet,rt (TYPABLE|ID|@USER)', 'Post a retweet message'],
|
16
|
-
:exec_proc => lambda {|arg|
|
17
|
-
if public_storage[:typable_id] && s = typable_id_status(arg)
|
18
|
-
post_retweet(s)
|
19
|
-
else
|
20
|
-
case arg
|
21
|
-
when /(\d+)/
|
22
|
-
post_retweet(Termtter::API.twitter.show(arg))
|
23
|
-
#s = Twitter::API.twitter.show(arg)
|
24
|
-
#post_retweet(s)
|
25
|
-
when /@([A-Za-z0-9_]+)/
|
26
|
-
user = $1
|
27
|
-
statuses = Termtter::API.twitter.user_timeline(user)
|
28
|
-
return if statuses.empty?
|
29
|
-
post_retweet(statuses[0])
|
30
|
-
end
|
31
|
-
end
|
32
|
-
},
|
33
|
-
:completion_proc => lambda {|cmd, arg|
|
34
|
-
if public_storage[:typable_id] && s = typable_id_status(arg)
|
35
|
-
"u #{ERB.new(config.plugins.retweet.format).result(binding)}"
|
36
|
-
else
|
37
|
-
case arg
|
38
|
-
when /@(.*)/
|
39
|
-
find_user_candidates $1, "#{cmd} @%s"
|
40
|
-
when /(\d+)/
|
41
|
-
find_status_ids(arg).map{|id| "#{cmd} #{$1}"}
|
42
|
-
end
|
43
|
-
end
|
44
|
-
}
|
45
|
-
)
|
46
|
-
end
|
data/lib/plugins/stdout.rb
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'termcolor'
|
4
|
-
require 'erb'
|
5
|
-
require 'tempfile'
|
6
|
-
|
7
|
-
config.plugins.stdout.set_default(:colors, (31..36).to_a + (91..96).to_a)
|
8
|
-
config.plugins.stdout.set_default(
|
9
|
-
:timeline_format,
|
10
|
-
'<90><%=time%></90> <<%=color%>><%=s.user.screen_name%>: <%=text%></<%=color%>> ' +
|
11
|
-
'<90><%=reply_to ? reply_to + " " : ""%><%=s.id%> <%=source%></90>'
|
12
|
-
)
|
13
|
-
config.plugins.stdout.set_default(:enable_pager, true)
|
14
|
-
config.plugins.stdout.set_default(:pager, 'less -R -f +G')
|
15
|
-
config.plugins.stdout.set_default(:window_height, 50)
|
16
|
-
|
17
|
-
module Termtter
|
18
|
-
class StdOut < Hook
|
19
|
-
def initialize
|
20
|
-
super(:name => :stdout, :points => [:output])
|
21
|
-
end
|
22
|
-
|
23
|
-
def call(statuses, event)
|
24
|
-
print_statuses(statuses)
|
25
|
-
end
|
26
|
-
|
27
|
-
def print_statuses(statuses, sort = true, time_format = nil)
|
28
|
-
return unless statuses and statuses.first
|
29
|
-
unless time_format
|
30
|
-
t0 = Time.now
|
31
|
-
t1 = Time.parse(statuses.first[:created_at])
|
32
|
-
t2 = Time.parse(statuses.last[:created_at])
|
33
|
-
time_format =
|
34
|
-
if [t0.year, t0.month, t0.day] == [t1.year, t1.month, t1.day] \
|
35
|
-
and [t1.year, t1.month, t1.day] == [t2.year, t2.month, t2.day]
|
36
|
-
'%H:%M:%S'
|
37
|
-
else
|
38
|
-
'%y/%m/%d %H:%M'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
output_text = ''
|
43
|
-
statuses.each do |s|
|
44
|
-
text = TermColor.escape(s.text)
|
45
|
-
color = config.plugins.stdout.colors[s.user.id.to_i % config.plugins.stdout.colors.size]
|
46
|
-
reply_to = s.in_reply_to_status_id ? "(reply to #{s.in_reply_to_status_id})" : nil
|
47
|
-
time = "(#{Time.parse(s.created_at).strftime(time_format)})"
|
48
|
-
source =
|
49
|
-
case s.source
|
50
|
-
when />(.*?)</ then $1
|
51
|
-
when 'web' then 'web'
|
52
|
-
end
|
53
|
-
|
54
|
-
erbed_text = ERB.new(config.plugins.stdout.timeline_format).result(binding)
|
55
|
-
output_text << TermColor.parse(erbed_text) + "\n"
|
56
|
-
end
|
57
|
-
|
58
|
-
if config.plugins.stdout.enable_pager && ENV['LINES'] && statuses.size > ENV['LINES'].to_i
|
59
|
-
file = Tempfile.new('termtter')
|
60
|
-
file.print output_text
|
61
|
-
file.close
|
62
|
-
system "#{config.plugins.stdout.pager} #{file.path}"
|
63
|
-
file.close(true)
|
64
|
-
else
|
65
|
-
print output_text
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
Client.register_hook(StdOut.new)
|
71
|
-
end
|
72
|
-
|
73
|
-
# stdout.rb
|
74
|
-
# output statuses to stdout
|
75
|
-
# example config
|
76
|
-
# config.plugins.stdout.colors = [:none, :red, :green, :yellow, :blue, :magenta, :cyan]
|
77
|
-
# config.plugins.stdout.timeline_format = '<90><%=time%></90> <<%=status_color%>><%=status%></<%=status_color%>> <90><%=id%></90>'
|