termtter 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/README.rdoc +97 -0
- data/Rakefile +46 -0
- data/bin/kill_termtter +22 -0
- data/bin/termtter +7 -0
- data/lib/filter/en2ja.rb +11 -0
- data/lib/filter/english.rb +8 -0
- data/lib/filter/expand-tinyurl.rb +24 -0
- data/lib/filter/fib.rb +15 -0
- data/lib/filter/ignore.rb +19 -0
- data/lib/filter/reply.rb +8 -0
- data/lib/filter/reverse.rb +13 -0
- data/lib/filter/url_addspace.rb +16 -0
- data/lib/filter/yhara.rb +20 -0
- data/lib/plugin/april_fool.rb +15 -0
- data/lib/plugin/bomb.rb +29 -0
- data/lib/plugin/clear.rb +14 -0
- data/lib/plugin/confirm.rb +9 -0
- data/lib/plugin/cool.rb +10 -0
- data/lib/plugin/devel.rb +13 -0
- data/lib/plugin/english.rb +59 -0
- data/lib/plugin/erb.rb +17 -0
- data/lib/plugin/favorite.rb +75 -0
- data/lib/plugin/fib.rb +8 -0
- data/lib/plugin/filter.rb +69 -0
- data/lib/plugin/follow.rb +56 -0
- data/lib/plugin/graduatter.rb +9 -0
- data/lib/plugin/grass.rb +27 -0
- data/lib/plugin/group.rb +60 -0
- data/lib/plugin/growl.rb +62 -0
- data/lib/plugin/hatebu.rb +59 -0
- data/lib/plugin/history.rb +82 -0
- data/lib/plugin/keyword.rb +18 -0
- data/lib/plugin/log.rb +63 -0
- data/lib/plugin/modify_arg_hook_sample.rb +7 -0
- data/lib/plugin/msagent.rb +26 -0
- data/lib/plugin/multi_reply.rb +36 -0
- data/lib/plugin/notify-send.rb +17 -0
- data/lib/plugin/otsune.rb +21 -0
- data/lib/plugin/outputz.rb +35 -0
- data/lib/plugin/pause.rb +3 -0
- data/lib/plugin/plugin.rb +53 -0
- data/lib/plugin/post_exec_hook_sample.rb +9 -0
- data/lib/plugin/pre_exec_hook_sample.rb +9 -0
- data/lib/plugin/primes.rb +23 -0
- data/lib/plugin/quicklook.rb +38 -0
- data/lib/plugin/reblog.rb +40 -0
- data/lib/plugin/reload.rb +3 -0
- data/lib/plugin/say.rb +24 -0
- data/lib/plugin/scrape.rb +41 -0
- data/lib/plugin/screen.rb +24 -0
- data/lib/plugin/shell.rb +14 -0
- data/lib/plugin/sl.rb +48 -0
- data/lib/plugin/spam.rb +9 -0
- data/lib/plugin/standard_plugins.rb +269 -0
- data/lib/plugin/stdout.rb +62 -0
- data/lib/plugin/system_status.rb +33 -0
- data/lib/plugin/translation.rb +28 -0
- data/lib/plugin/update_editor.rb +53 -0
- data/lib/plugin/uri-open.rb +69 -0
- data/lib/plugin/wassr_post.rb +22 -0
- data/lib/plugin/yhara.rb +148 -0
- data/lib/plugin/yonda.rb +20 -0
- data/lib/termtter/api.rb +14 -0
- data/lib/termtter/client.rb +399 -0
- data/lib/termtter/command.rb +77 -0
- data/lib/termtter/connection.rb +39 -0
- data/lib/termtter/hook.rb +18 -0
- data/lib/termtter/status.rb +26 -0
- data/lib/termtter/task.rb +16 -0
- data/lib/termtter/task_manager.rb +116 -0
- data/lib/termtter/twitter.rb +173 -0
- data/lib/termtter/user.rb +13 -0
- data/lib/termtter/version.rb +3 -0
- data/lib/termtter.rb +157 -0
- data/spec/plugin/cool_spec.rb +10 -0
- data/spec/plugin/fib_spec.rb +16 -0
- data/spec/plugin/filter_spec.rb +18 -0
- data/spec/plugin/plugin_spec.rb +25 -0
- data/spec/plugin/shell_spec.rb +10 -0
- data/spec/plugin/spam_spec.rb +17 -0
- data/spec/plugin/standard_plugins_spec.rb +31 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/termtter/client_spec.rb +175 -0
- data/spec/termtter/command_spec.rb +161 -0
- data/spec/termtter/task_manager_spec.rb +78 -0
- data/spec/termtter/task_spec.rb +22 -0
- data/spec/termtter/user_spec.rb +27 -0
- data/spec/termtter_spec.rb +43 -0
- data/test/friends_timeline.json +5 -0
- data/test/search.json +8 -0
- data/test/test_termtter.rb +86 -0
- metadata +177 -0
@@ -0,0 +1,161 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
4
|
+
|
5
|
+
module Termtter
|
6
|
+
|
7
|
+
describe Command do
|
8
|
+
|
9
|
+
before do
|
10
|
+
params = {
|
11
|
+
:name => 'update',
|
12
|
+
:aliases => ['u', 'up'],
|
13
|
+
:exec_proc => lambda {|arg| arg },
|
14
|
+
:completion_proc => lambda {|command, arg| ['complete1', 'complete2'] },
|
15
|
+
:help => ['update,u TEXT', 'test command']
|
16
|
+
}
|
17
|
+
@command = Command.new(params)
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should execute' do
|
21
|
+
[
|
22
|
+
['update test test', 'test test'],
|
23
|
+
['update test test', 'test test'],
|
24
|
+
['update test test', 'test test'],
|
25
|
+
].each do |input, args|
|
26
|
+
result = @command.exec_if_match(input)
|
27
|
+
result.should == args
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should failed on execute' do
|
32
|
+
result = @command.exec_if_match('upda test test')
|
33
|
+
result.should == nil
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should return command regex' do
|
37
|
+
@command.pattern.should == /^((update|u|up)|(update|u|up)\s+(.*?))\s*$/
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should be given name as String or Symbol' do
|
41
|
+
Command.new(:name => 'foo').name.should == :foo
|
42
|
+
Command.new(:name => :foo).name.should == :foo
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should return name' do
|
46
|
+
@command.name.should == :update
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should return aliases' do
|
50
|
+
@command.aliases.should == [:u, :up]
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should return commands' do
|
54
|
+
@command.commands.should == [:update, :u, :up]
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should return help' do
|
58
|
+
@command.help.should == ['update,u TEXT', 'test command']
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should return candidates for completion' do
|
62
|
+
# complement
|
63
|
+
[
|
64
|
+
['upd', ['update']],
|
65
|
+
[' upd', []],
|
66
|
+
[' upd ', []],
|
67
|
+
['update', ['complete1', 'complete2']],
|
68
|
+
['update ', ['complete1', 'complete2']],
|
69
|
+
[' update ', []],
|
70
|
+
['u foo', ['complete1', 'complete2']],
|
71
|
+
['u', ['complete1', 'complete2']],
|
72
|
+
['up', ['complete1', 'complete2']],
|
73
|
+
].each do |input, comp|
|
74
|
+
@command.complement(input).should == comp
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'should can redefine exec_proc' do
|
79
|
+
# redefine exec_proc
|
80
|
+
command_arg = nil
|
81
|
+
@command.exec_proc = lambda {|arg|
|
82
|
+
command_arg = arg
|
83
|
+
'result'
|
84
|
+
}
|
85
|
+
command_arg.should == nil
|
86
|
+
|
87
|
+
# exec command
|
88
|
+
result = @command.exec_if_match('update test test')
|
89
|
+
command_arg.should == 'test test'
|
90
|
+
result.should == 'result'
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'should return command_info when call method "match?"' do
|
94
|
+
[
|
95
|
+
['update', ['update', nil]],
|
96
|
+
['up', ['up', nil]],
|
97
|
+
['u', ['u', nil]],
|
98
|
+
['update ', ['update', nil]],
|
99
|
+
[' update ', nil],
|
100
|
+
['update foo', ['update', 'foo']],
|
101
|
+
[' update foo', nil],
|
102
|
+
[' update foo ', nil],
|
103
|
+
['u foo', ['u', 'foo']],
|
104
|
+
['up foo', ['up', 'foo']],
|
105
|
+
['upd foo', nil],
|
106
|
+
['upd foo', nil],
|
107
|
+
].each do |input, result|
|
108
|
+
@command.match?(input).should == result
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
it 'should raise ArgumentError when constructor arguments are deficient' do
|
113
|
+
lambda { Command.new }.should raise_error(ArgumentError)
|
114
|
+
lambda { Command.new(:exec_proc => lambda {|args|}) }.should raise_error(ArgumentError)
|
115
|
+
lambda { Command.new(:aliases => ['u']) }.should raise_error(ArgumentError)
|
116
|
+
end
|
117
|
+
|
118
|
+
it 'should return true with the exec_proc return nil' do
|
119
|
+
command = Command.new(:name => :test, :exec_proc => lambda {|args|})
|
120
|
+
command.exec_if_match('test').should == true
|
121
|
+
end
|
122
|
+
|
123
|
+
it 'should call exec_proc when call method "execute"' do
|
124
|
+
@command.execute('test').should == 'test'
|
125
|
+
@command.execute(' test').should == ' test'
|
126
|
+
@command.execute(' test ').should == ' test '
|
127
|
+
@command.execute('test test').should == 'test test'
|
128
|
+
end
|
129
|
+
|
130
|
+
it 'should redefine method "exec_if_match"' do
|
131
|
+
# add method
|
132
|
+
class << @command
|
133
|
+
def exec_if_match(input)
|
134
|
+
case input
|
135
|
+
when /^update\s+foo\s*(.*)/
|
136
|
+
foo($1)
|
137
|
+
when /^update\s+bar\s*(.*)/
|
138
|
+
bar($1)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
def foo(arg)
|
142
|
+
"foo(#{arg})"
|
143
|
+
end
|
144
|
+
def bar(arg)
|
145
|
+
"bar(#{arg})"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
@command.exec_if_match('update foo xxx').should == 'foo(xxx)'
|
150
|
+
@command.exec_if_match('update bar xxx').should == 'bar(xxx)'
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'should raise ArgumentError at execute' do
|
154
|
+
lambda { @command.execute(nil) }.should_not raise_error(ArgumentError)
|
155
|
+
lambda { @command.execute('foo') }.should_not raise_error(ArgumentError)
|
156
|
+
lambda { @command.execute(false) }.should raise_error(ArgumentError)
|
157
|
+
lambda { @command.execute(Array.new) }.should raise_error(ArgumentError)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
4
|
+
require 'termtter/task'
|
5
|
+
require 'termtter/task_manager'
|
6
|
+
|
7
|
+
module Termtter
|
8
|
+
describe TaskManager do
|
9
|
+
before do
|
10
|
+
@task_manager = TaskManager.new
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should able to add tasks' do
|
14
|
+
@task_manager.add_task() {}
|
15
|
+
@task_manager.add_task(:after => 10) {}
|
16
|
+
@task_manager.instance_eval('@tasks').size.should == 2
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should return due_tasks' do
|
20
|
+
time_now = Time.now
|
21
|
+
Time.stub!(:now).and_return(time_now)
|
22
|
+
|
23
|
+
@task_manager.add_task() {}
|
24
|
+
@task_manager.add_task(:after => 10) {}
|
25
|
+
|
26
|
+
due_tasks = @task_manager.instance_eval('pull_due_tasks')
|
27
|
+
due_tasks.size.should == 1
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should run tasks' do
|
31
|
+
time_now = Time.now
|
32
|
+
Time.stub!(:now).and_return(time_now)
|
33
|
+
|
34
|
+
task1_called = false
|
35
|
+
task2_called = false
|
36
|
+
@task_manager.add_task() {task1_called = true}
|
37
|
+
@task_manager.add_task(:after => 10) {task2_called = true}
|
38
|
+
|
39
|
+
task1_called.should == false
|
40
|
+
task2_called.should == false
|
41
|
+
@task_manager.instance_eval('@tasks').size.should == 2
|
42
|
+
|
43
|
+
@task_manager.step
|
44
|
+
task1_called.should == true
|
45
|
+
task2_called.should == false
|
46
|
+
@task_manager.instance_eval('@tasks').size.should == 1
|
47
|
+
|
48
|
+
Time.stub!(:now).and_return(time_now + 10)
|
49
|
+
@task_manager.step
|
50
|
+
task2_called.should == true
|
51
|
+
@task_manager.instance_eval('@tasks').size.should == 0
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should run repeat tasks' do
|
55
|
+
time_now = Time.now
|
56
|
+
Time.stub!(:now).and_return(time_now)
|
57
|
+
|
58
|
+
called_count = 0
|
59
|
+
@task_manager.add_task(:interval => 10) {called_count += 1}
|
60
|
+
@task_manager.step
|
61
|
+
|
62
|
+
called_count.should == 1
|
63
|
+
@task_manager.instance_eval('@tasks').size.should == 1
|
64
|
+
|
65
|
+
Time.stub!(:now).and_return(time_now + 10)
|
66
|
+
@task_manager.step
|
67
|
+
called_count.should == 2
|
68
|
+
@task_manager.instance_eval('@tasks').size.should == 1
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should add task with :name' do
|
72
|
+
@task_manager.add_task(:name => 'foo')
|
73
|
+
@task_manager.get_task('foo').name.should == 'foo'
|
74
|
+
@task_manager.delete_task('foo')
|
75
|
+
@task_manager.get_task('foo').should == nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
4
|
+
require 'termtter/task'
|
5
|
+
|
6
|
+
module Termtter
|
7
|
+
describe Task do
|
8
|
+
|
9
|
+
it 'should be instantiate' do
|
10
|
+
time_now = Time.now
|
11
|
+
Time.stub!(:now).and_return(time_now)
|
12
|
+
|
13
|
+
task = Task.new() do
|
14
|
+
end
|
15
|
+
task.exec_at.should == time_now
|
16
|
+
|
17
|
+
task = Task.new(:after => 10) do
|
18
|
+
end
|
19
|
+
task.exec_at.should == (time_now + 10)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
4
|
+
|
5
|
+
module Termtter
|
6
|
+
describe User do
|
7
|
+
before do
|
8
|
+
@user = User.new
|
9
|
+
@params = %w[ name favourites_count url id description protected utc_offset time_zone
|
10
|
+
screen_name notifications statuses_count followers_count friends_count
|
11
|
+
profile_image_url location following created_at
|
12
|
+
]
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should access to properties' do
|
16
|
+
@params.each do |attr|
|
17
|
+
@user.__send__(attr.to_sym).should == nil
|
18
|
+
end
|
19
|
+
|
20
|
+
@params.each do |attr|
|
21
|
+
@user.__send__("#{attr}=".to_sym, 'foo')
|
22
|
+
@user.__send__(attr.to_sym).should == 'foo'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
4
|
+
|
5
|
+
module Termtter
|
6
|
+
describe Twitter, 'when get_timeline called' do
|
7
|
+
before do
|
8
|
+
connection = mock('connection', :null_object => true)
|
9
|
+
@twitter = Termtter::Twitter.new('test', 'test', connection)
|
10
|
+
|
11
|
+
Termtter::Client.add_hook do |statuses, event|
|
12
|
+
@statuses = statuses
|
13
|
+
@event = event
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should get timeline' do
|
18
|
+
@twitter.should_receive(:open).
|
19
|
+
and_return(
|
20
|
+
File.open(
|
21
|
+
File.dirname(__FILE__) + "/../test/friends_timeline.json"))
|
22
|
+
statuses = @twitter.get_timeline('')
|
23
|
+
statuses.size.should == 3
|
24
|
+
statuses[0].user_id.should == 102
|
25
|
+
statuses[0].user_screen_name.should == 'test2'
|
26
|
+
statuses[0].user_name.should == 'Test User 2'
|
27
|
+
statuses[0].text.should == 'texttext 2'
|
28
|
+
statuses[0].user_url.should == 'http://twitter.com/test2'
|
29
|
+
statuses[0].user_profile_image_url.should ==
|
30
|
+
'http://s3.amazonaws.com/twitter_production/profile_images/000/102.png'
|
31
|
+
statuses[0].created_at.to_s.should == 'Sat Jan 03 21:13:45 +0900 2009'
|
32
|
+
|
33
|
+
statuses[2].user_id.should == 100
|
34
|
+
statuses[2].user_screen_name.should == 'test0'
|
35
|
+
statuses[2].user_name.should == 'Test User 0'
|
36
|
+
statuses[2].text.should == 'texttext 0'
|
37
|
+
statuses[2].user_url.should == 'http://twitter.com/test0'
|
38
|
+
statuses[2].user_profile_image_url.should ==
|
39
|
+
'http://s3.amazonaws.com/twitter_production/profile_images/000/100.png'
|
40
|
+
statuses[2].created_at.to_s.should == 'Sat Jan 03 21:13:45 +0900 2009'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
[
|
2
|
+
{"in_reply_to_user_id":null,"truncated":false,"created_at":"Sat Jan 03 12:13:45 +0000 2009","user":{"description":"test2 xxxx","followers_count":102,"profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/000\/102.png","url":"http:\/\/twitter.com/test2","name":"Test User 2","protected":false,"screen_name":"test2","location":"Tokyo2","id":102},"favorited":false,"in_reply_to_screen_name":null,"text":"texttext 2","id":10002,"in_reply_to_status_id":null,"source":"<a href=\"http:\/\/ssss2\">ssss2<\/a>"},
|
3
|
+
{"in_reply_to_user_id":null,"truncated":false,"created_at":"Sat Jan 03 12:13:45 +0000 2009","user":{"description":"test1 xxxx","followers_count":101,"profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/000\/101.png","url":"http:\/\/twitter.com/test1","name":"Test User 1","protected":false,"screen_name":"test1","location":"Tokyo1","id":101},"favorited":false,"in_reply_to_screen_name":null,"text":"texttext 1","id":10001,"in_reply_to_status_id":null,"source":"<a href=\"http:\/\/ssss1\">ssss1<\/a>"},
|
4
|
+
{"in_reply_to_user_id":null,"truncated":false,"created_at":"Sat Jan 03 12:13:45 +0000 2009","user":{"description":"test0 xxxx","followers_count":100,"profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/000\/100.png","url":"http:\/\/twitter.com/test0","name":"Test User 0","protected":false,"screen_name":"test0","location":"Tokyo0","id":100},"favorited":false,"in_reply_to_screen_name":null,"text":"texttext 0","id":10000,"in_reply_to_status_id":null,"source":"<a href=\"http:\/\/ssss0\">ssss0<\/a>"}
|
5
|
+
]
|
data/test/search.json
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
{
|
2
|
+
"results":[
|
3
|
+
{"text":"texttext 2","to_user_id":202,"to_user":"to_user2","from_user":"test2","id":10002,"from_user_id":102,"iso_language_code":"en","profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/xxx\/102.jpg","created_at":"Sat, 03 Jan 2009 12:49:09 +0000"},
|
4
|
+
{"text":"texttext 1","to_user_id":101,"to_user":"to_user1","from_user":"test1","id":10001,"from_user_id":101,"iso_language_code":"en","profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/xxx\/101.jpg","created_at":"Sat, 03 Jan 2009 12:49:09 +0000"},
|
5
|
+
{"text":"texttext 0","to_user_id":100,"to_user":"to_user0","from_user":"test0","id":10000,"from_user_id":100,"iso_language_code":"en","profile_image_url":"http:\/\/s3.amazonaws.com\/twitter_production\/profile_images\/xxx\/100.jpg","created_at":"Sat, 03 Jan 2009 12:49:09 +0000"}
|
6
|
+
],
|
7
|
+
"since_id":0,"max_id":1093328763,"refresh_url":"?since_id=1093328763&q=ruby","results_per_page":15,"next_page":"?page=2&max_id=1093328763&q=ruby","completed_in":0.019603,"page":1,"query":"ruby"
|
8
|
+
}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'configatron'
|
5
|
+
require 'test/unit'
|
6
|
+
require 'kagemusha'
|
7
|
+
require File.dirname(__FILE__) + '/../lib/termtter'
|
8
|
+
|
9
|
+
# TODO: もっとテスト書く!
|
10
|
+
|
11
|
+
class TestTermtter < Test::Unit::TestCase
|
12
|
+
def setup
|
13
|
+
@twitter = Termtter::Twitter.new('test', 'test')
|
14
|
+
|
15
|
+
Termtter::Client.add_hook do |statuses, event|
|
16
|
+
@statuses = statuses
|
17
|
+
@event = event
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_search
|
22
|
+
statuses = swap_open('search.json') { @twitter.search('') }
|
23
|
+
assert_equal 3, statuses.size
|
24
|
+
assert_equal 'test2', statuses[0].user_screen_name
|
25
|
+
assert_equal 'texttext 2', statuses[0].text
|
26
|
+
assert_equal 'Sat Jan 03 21:49:09 +0900 2009', statuses[0].created_at.to_s
|
27
|
+
assert_equal 'test0', statuses[2].user_screen_name
|
28
|
+
assert_equal 'texttext 0', statuses[2].text
|
29
|
+
assert_equal 'Sat Jan 03 21:49:09 +0900 2009', statuses[2].created_at.to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_add_hook
|
33
|
+
statuses = nil
|
34
|
+
event = nil
|
35
|
+
twitter = nil
|
36
|
+
Termtter::Client.add_hook do |s, e, t|
|
37
|
+
statuses = s
|
38
|
+
event = e
|
39
|
+
twitter = t
|
40
|
+
end
|
41
|
+
|
42
|
+
Termtter::Client.call_hooks([], :foo, @twitter)
|
43
|
+
|
44
|
+
assert_equal [], statuses
|
45
|
+
assert_equal :foo, event
|
46
|
+
assert_equal @twitter, twitter
|
47
|
+
|
48
|
+
Termtter::Client.clear_hooks()
|
49
|
+
statuses = nil
|
50
|
+
event = nil
|
51
|
+
Termtter::Client.call_hooks([], :foo, @twitter)
|
52
|
+
|
53
|
+
assert_equal nil, statuses
|
54
|
+
assert_equal nil, event
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_add_command
|
58
|
+
command_text = nil
|
59
|
+
matche_text = nil
|
60
|
+
twitter = nil
|
61
|
+
Termtter::Client.add_command /foo\s+(.*)/ do |m, t|
|
62
|
+
command_text = m[0]
|
63
|
+
matche_text = m[1]
|
64
|
+
twitter = t
|
65
|
+
end
|
66
|
+
|
67
|
+
Termtter::Client.call_commands('foo xxxxxxxxxxxxxx', @twitter)
|
68
|
+
assert_equal 'foo xxxxxxxxxxxxxx', command_text
|
69
|
+
assert_equal 'xxxxxxxxxxxxxx', matche_text
|
70
|
+
assert_equal @twitter, twitter
|
71
|
+
|
72
|
+
Termtter::Client.clear_commands()
|
73
|
+
assert_raise Termtter::CommandNotFound do
|
74
|
+
Termtter::Client.call_commands('foo xxxxxxxxxxxxxx', @twitter)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def swap_open(name)
|
79
|
+
Kagemusha.new(Termtter::Twitter).def(:open) {
|
80
|
+
File.open(File.dirname(__FILE__) + "/../test/#{name}")
|
81
|
+
}.swap do
|
82
|
+
yield
|
83
|
+
end
|
84
|
+
end
|
85
|
+
private :swap_open
|
86
|
+
end
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: termtter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.8.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jugyo
|
8
|
+
- ujihisa
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-02-14 00:00:00 +09:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: json_pure
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 1.1.3
|
25
|
+
version:
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: configatron
|
28
|
+
type: :runtime
|
29
|
+
version_requirement:
|
30
|
+
version_requirements: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.2.2
|
35
|
+
version:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: highline
|
38
|
+
type: :runtime
|
39
|
+
version_requirement:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 1.5.0
|
45
|
+
version:
|
46
|
+
description: Termtter is a terminal based Twitter client
|
47
|
+
email: jugyo.org@gmail.com
|
48
|
+
executables:
|
49
|
+
- kill_termtter
|
50
|
+
- termtter
|
51
|
+
extensions: []
|
52
|
+
|
53
|
+
extra_rdoc_files:
|
54
|
+
- README.rdoc
|
55
|
+
- History.txt
|
56
|
+
files:
|
57
|
+
- lib/filter/en2ja.rb
|
58
|
+
- lib/filter/english.rb
|
59
|
+
- lib/filter/expand-tinyurl.rb
|
60
|
+
- lib/filter/fib.rb
|
61
|
+
- lib/filter/ignore.rb
|
62
|
+
- lib/filter/reply.rb
|
63
|
+
- lib/filter/reverse.rb
|
64
|
+
- lib/filter/url_addspace.rb
|
65
|
+
- lib/filter/yhara.rb
|
66
|
+
- lib/plugin/april_fool.rb
|
67
|
+
- lib/plugin/bomb.rb
|
68
|
+
- lib/plugin/clear.rb
|
69
|
+
- lib/plugin/confirm.rb
|
70
|
+
- lib/plugin/cool.rb
|
71
|
+
- lib/plugin/devel.rb
|
72
|
+
- lib/plugin/english.rb
|
73
|
+
- lib/plugin/erb.rb
|
74
|
+
- lib/plugin/favorite.rb
|
75
|
+
- lib/plugin/fib.rb
|
76
|
+
- lib/plugin/filter.rb
|
77
|
+
- lib/plugin/follow.rb
|
78
|
+
- lib/plugin/graduatter.rb
|
79
|
+
- lib/plugin/grass.rb
|
80
|
+
- lib/plugin/group.rb
|
81
|
+
- lib/plugin/growl.rb
|
82
|
+
- lib/plugin/hatebu.rb
|
83
|
+
- lib/plugin/history.rb
|
84
|
+
- lib/plugin/keyword.rb
|
85
|
+
- lib/plugin/log.rb
|
86
|
+
- lib/plugin/modify_arg_hook_sample.rb
|
87
|
+
- lib/plugin/msagent.rb
|
88
|
+
- lib/plugin/multi_reply.rb
|
89
|
+
- lib/plugin/notify-send.rb
|
90
|
+
- lib/plugin/otsune.rb
|
91
|
+
- lib/plugin/outputz.rb
|
92
|
+
- lib/plugin/pause.rb
|
93
|
+
- lib/plugin/plugin.rb
|
94
|
+
- lib/plugin/post_exec_hook_sample.rb
|
95
|
+
- lib/plugin/pre_exec_hook_sample.rb
|
96
|
+
- lib/plugin/primes.rb
|
97
|
+
- lib/plugin/quicklook.rb
|
98
|
+
- lib/plugin/reblog.rb
|
99
|
+
- lib/plugin/reload.rb
|
100
|
+
- lib/plugin/say.rb
|
101
|
+
- lib/plugin/scrape.rb
|
102
|
+
- lib/plugin/screen.rb
|
103
|
+
- lib/plugin/shell.rb
|
104
|
+
- lib/plugin/sl.rb
|
105
|
+
- lib/plugin/spam.rb
|
106
|
+
- lib/plugin/standard_plugins.rb
|
107
|
+
- lib/plugin/stdout.rb
|
108
|
+
- lib/plugin/system_status.rb
|
109
|
+
- lib/plugin/translation.rb
|
110
|
+
- lib/plugin/update_editor.rb
|
111
|
+
- lib/plugin/uri-open.rb
|
112
|
+
- lib/plugin/wassr_post.rb
|
113
|
+
- lib/plugin/yhara.rb
|
114
|
+
- lib/plugin/yonda.rb
|
115
|
+
- lib/termtter/api.rb
|
116
|
+
- lib/termtter/client.rb
|
117
|
+
- lib/termtter/command.rb
|
118
|
+
- lib/termtter/connection.rb
|
119
|
+
- lib/termtter/hook.rb
|
120
|
+
- lib/termtter/status.rb
|
121
|
+
- lib/termtter/task.rb
|
122
|
+
- lib/termtter/task_manager.rb
|
123
|
+
- lib/termtter/twitter.rb
|
124
|
+
- lib/termtter/user.rb
|
125
|
+
- lib/termtter/version.rb
|
126
|
+
- lib/termtter.rb
|
127
|
+
- spec/plugin/cool_spec.rb
|
128
|
+
- spec/plugin/fib_spec.rb
|
129
|
+
- spec/plugin/filter_spec.rb
|
130
|
+
- spec/plugin/plugin_spec.rb
|
131
|
+
- spec/plugin/shell_spec.rb
|
132
|
+
- spec/plugin/spam_spec.rb
|
133
|
+
- spec/plugin/standard_plugins_spec.rb
|
134
|
+
- spec/spec_helper.rb
|
135
|
+
- spec/termtter/client_spec.rb
|
136
|
+
- spec/termtter/command_spec.rb
|
137
|
+
- spec/termtter/task_manager_spec.rb
|
138
|
+
- spec/termtter/task_spec.rb
|
139
|
+
- spec/termtter/user_spec.rb
|
140
|
+
- spec/termtter_spec.rb
|
141
|
+
- test/test_termtter.rb
|
142
|
+
- test/friends_timeline.json
|
143
|
+
- test/search.json
|
144
|
+
- README.rdoc
|
145
|
+
- History.txt
|
146
|
+
- Rakefile
|
147
|
+
has_rdoc: true
|
148
|
+
homepage: http://wiki.github.com/jugyo/termtter
|
149
|
+
post_install_message:
|
150
|
+
rdoc_options:
|
151
|
+
- --main
|
152
|
+
- README.rdoc
|
153
|
+
- --exclude
|
154
|
+
- spec
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
159
|
+
- - ">="
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: "0"
|
162
|
+
version:
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ">="
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: "0"
|
168
|
+
version:
|
169
|
+
requirements: []
|
170
|
+
|
171
|
+
rubyforge_project: termtter
|
172
|
+
rubygems_version: 1.3.1
|
173
|
+
signing_key:
|
174
|
+
specification_version: 2
|
175
|
+
summary: Terminal based Twitter client
|
176
|
+
test_files: []
|
177
|
+
|