jugyo-termtter 0.8.14 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. data/README.rdoc +8 -8
  2. data/Rakefile +3 -5
  3. data/lib/{plugin → plugins}/april_fool.rb +0 -0
  4. data/lib/plugins/bomb.rb +42 -0
  5. data/lib/{plugin → plugins}/clear.rb +0 -0
  6. data/lib/{plugin → plugins}/confirm.rb +0 -0
  7. data/lib/{plugin → plugins}/cool.rb +0 -0
  8. data/lib/{plugin → plugins}/devel.rb +0 -0
  9. data/lib/{filter → plugins}/en2ja.rb +1 -1
  10. data/lib/plugins/english.rb +25 -0
  11. data/lib/{plugin → plugins}/erb.rb +0 -0
  12. data/lib/{filter → plugins}/expand-tinyurl.rb +6 -6
  13. data/lib/plugins/favorite.rb +63 -0
  14. data/lib/plugins/fib.rb +28 -0
  15. data/lib/{filter/fib.rb → plugins/fib_filter.rb} +1 -2
  16. data/lib/{plugin → plugins}/filter.rb +0 -0
  17. data/lib/{plugin → plugins}/graduatter.rb +1 -2
  18. data/lib/{plugin → plugins}/grass.rb +2 -2
  19. data/lib/{plugin → plugins}/group.rb +9 -9
  20. data/lib/{plugin → plugins}/growl.rb +11 -12
  21. data/lib/{plugin → plugins}/hatebu.rb +5 -5
  22. data/lib/{plugin → plugins}/history.rb +13 -13
  23. data/lib/plugins/ignore.rb +19 -0
  24. data/lib/plugins/keyword.rb +18 -0
  25. data/lib/{plugin → plugins}/log.rb +18 -12
  26. data/lib/{plugin → plugins}/me.rb +1 -2
  27. data/lib/{plugin → plugins}/modify_arg_hook_sample.rb +0 -0
  28. data/lib/{plugin → plugins}/msagent.rb +1 -1
  29. data/lib/plugins/multi_reply.rb +27 -0
  30. data/lib/{plugin → plugins}/notify-send.rb +1 -1
  31. data/lib/{plugin → plugins}/otsune.rb +0 -0
  32. data/lib/plugins/outputz.rb +33 -0
  33. data/lib/{plugin → plugins}/pause.rb +0 -0
  34. data/lib/{plugin → plugins}/plugin.rb +0 -0
  35. data/lib/{plugin → plugins}/post_exec_hook_sample.rb +0 -0
  36. data/lib/{plugin → plugins}/pre_exec_hook_sample.rb +0 -0
  37. data/lib/{plugin → plugins}/primes.rb +9 -2
  38. data/lib/plugins/quicklook.rb +41 -0
  39. data/lib/{plugin → plugins}/random.rb +0 -0
  40. data/lib/{plugin → plugins}/reblog.rb +3 -3
  41. data/lib/{plugin → plugins}/reload.rb +0 -0
  42. data/lib/{filter → plugins}/reply.rb +0 -0
  43. data/lib/{filter → plugins}/reverse.rb +1 -1
  44. data/lib/{plugin → plugins}/say.rb +1 -1
  45. data/lib/{plugin → plugins}/scrape.rb +4 -4
  46. data/lib/plugins/screen-notify.rb +13 -0
  47. data/lib/plugins/screen.rb +24 -0
  48. data/lib/{plugin → plugins}/shell.rb +0 -0
  49. data/lib/{plugin → plugins}/sl.rb +4 -4
  50. data/lib/plugins/spam.rb +13 -0
  51. data/lib/{plugin → plugins}/standard_plugins.rb +72 -18
  52. data/lib/plugins/stdout.rb +80 -0
  53. data/lib/plugins/storage/DB.rb +37 -0
  54. data/lib/plugins/storage/status.rb +48 -0
  55. data/lib/plugins/storage/status_mook.rb +30 -0
  56. data/lib/plugins/storage.rb +47 -0
  57. data/lib/plugins/system_status.rb +33 -0
  58. data/lib/{plugin → plugins}/translation.rb +15 -5
  59. data/lib/{plugin → plugins}/update_editor.rb +6 -6
  60. data/lib/plugins/uri-open.rb +64 -0
  61. data/lib/{filter → plugins}/url_addspace.rb +0 -0
  62. data/lib/{plugin → plugins}/wassr_post.rb +1 -1
  63. data/lib/{plugin → plugins}/yhara.rb +1 -1
  64. data/lib/plugins/yhara_filter.rb +8 -0
  65. data/lib/plugins/yonda.rb +21 -0
  66. data/lib/termtter/api.rb +28 -2
  67. data/lib/termtter/client.rb +90 -102
  68. data/lib/termtter/command.rb +32 -31
  69. data/lib/termtter/config.rb +64 -0
  70. data/lib/termtter/connection.rb +9 -7
  71. data/lib/termtter/hook.rb +11 -2
  72. data/lib/termtter/optparse.rb +14 -0
  73. data/lib/termtter/version.rb +1 -1
  74. data/lib/termtter.rb +19 -22
  75. data/spec/plugin/english_spec.rb +19 -0
  76. data/spec/plugin/favorite_spec.rb +10 -0
  77. data/spec/plugin/fib_spec.rb +1 -2
  78. data/spec/plugin/pause_spec.rb +8 -0
  79. data/spec/plugin/plugin_spec.rb +1 -1
  80. data/spec/plugin/primes_spec.rb +15 -0
  81. data/spec/plugin/sl_spec.rb +8 -0
  82. data/spec/plugin/spam_spec.rb +0 -13
  83. data/spec/plugin/standard_plugins_spec.rb +0 -7
  84. data/spec/plugin/storage/DB_spec.rb +12 -0
  85. data/spec/plugin/storage/status_spec.rb +24 -0
  86. data/spec/spec_helper.rb +3 -0
  87. data/spec/termtter/client_spec.rb +63 -1
  88. data/spec/termtter/command_spec.rb +6 -68
  89. data/spec/termtter/config_spec.rb +111 -0
  90. data/spec/termtter/hook_spec.rb +69 -0
  91. data/spec/termtter_spec.rb +22 -34
  92. metadata +81 -72
  93. data/lib/filter/english.rb +0 -8
  94. data/lib/filter/ignore.rb +0 -19
  95. data/lib/filter/yhara.rb +0 -20
  96. data/lib/plugin/bomb.rb +0 -29
  97. data/lib/plugin/english.rb +0 -59
  98. data/lib/plugin/favorite.rb +0 -75
  99. data/lib/plugin/fib.rb +0 -8
  100. data/lib/plugin/follow.rb +0 -60
  101. data/lib/plugin/keyword.rb +0 -18
  102. data/lib/plugin/multi_reply.rb +0 -36
  103. data/lib/plugin/outputz.rb +0 -35
  104. data/lib/plugin/quicklook.rb +0 -38
  105. data/lib/plugin/screen.rb +0 -24
  106. data/lib/plugin/spam.rb +0 -9
  107. data/lib/plugin/stdout.rb +0 -63
  108. data/lib/plugin/system_status.rb +0 -33
  109. data/lib/plugin/uri-open.rb +0 -69
  110. data/lib/plugin/yonda.rb +0 -20
  111. data/lib/termtter/status.rb +0 -26
  112. data/lib/termtter/twitter.rb +0 -188
  113. data/lib/termtter/user.rb +0 -13
  114. data/spec/termtter/user_spec.rb +0 -27
  115. data/test/test_termtter.rb +0 -86
@@ -17,22 +17,6 @@ module Termtter
17
17
  @command = Command.new(params)
18
18
  end
19
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
20
  it 'should return command regex' do
37
21
  @command.pattern.should == /^((update|u|up)|(update|u|up)\s+(.*?))\s*$/
38
22
  end
@@ -64,46 +48,28 @@ module Termtter
64
48
  ['upd', ['update']],
65
49
  [' upd', []],
66
50
  [' upd ', []],
67
- ['update', ['complete1', 'complete2']],
68
- ['update ', ['complete1', 'complete2']],
51
+ ['update a', ['complete1', 'complete2']],
69
52
  [' update ', []],
70
53
  ['u foo', ['complete1', 'complete2']],
71
- ['u', ['complete1', 'complete2']],
72
- ['up', ['complete1', 'complete2']],
73
54
  ].each do |input, comp|
74
55
  @command.complement(input).should == comp
75
56
  end
76
57
  end
77
58
 
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
59
  it 'should return command_info when call method "match?"' do
94
60
  [
95
61
  ['update', ['update', nil]],
96
62
  ['up', ['up', nil]],
97
63
  ['u', ['u', nil]],
98
64
  ['update ', ['update', nil]],
99
- [' update ', nil],
65
+ [' update ', [nil, nil]],
100
66
  ['update foo', ['update', 'foo']],
101
- [' update foo', nil],
102
- [' update foo ', nil],
67
+ [' update foo', [nil, nil]],
68
+ [' update foo ', [nil, nil]],
103
69
  ['u foo', ['u', 'foo']],
104
70
  ['up foo', ['up', 'foo']],
105
- ['upd foo', nil],
106
- ['upd foo', nil],
71
+ ['upd foo', [nil, nil]],
72
+ ['upd foo', [nil, nil]],
107
73
  ].each do |input, result|
108
74
  @command.match?(input).should == result
109
75
  end
@@ -115,11 +81,6 @@ module Termtter
115
81
  lambda { Command.new(:aliases => ['u']) }.should raise_error(ArgumentError)
116
82
  end
117
83
 
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
84
  it 'should call exec_proc when call method "execute"' do
124
85
  @command.execute('test').should == 'test'
125
86
  @command.execute(' test').should == ' test'
@@ -127,29 +88,6 @@ module Termtter
127
88
  @command.execute('test test').should == 'test test'
128
89
  end
129
90
 
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
91
  it 'should raise ArgumentError at execute' do
154
92
  lambda { @command.execute(nil) }.should_not raise_error(ArgumentError)
155
93
  lambda { @command.execute('foo') }.should_not raise_error(ArgumentError)
@@ -0,0 +1,111 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require File.dirname(__FILE__) + '/../spec_helper'
4
+
5
+ module Termtter
6
+ describe Config do
7
+ before do
8
+ @config = Config.new
9
+ end
10
+
11
+ it 'should be able to store value to new storage' do
12
+ @config.new_storage = :value
13
+ @config.new_storage.should == :value
14
+ end
15
+
16
+ it 'should be able to make subb.key and store value' do
17
+ @config.subb.key = :value
18
+ @config.subb.key.should == :value
19
+ end
20
+
21
+ it 'should be able to make multiple storage' do
22
+ @config.subb.more.for.test = 'value'
23
+ @config.subb.more.for.test.should == 'value'
24
+ end
25
+
26
+ it 'should be able to change value in storage' do
27
+ @config.storage = :value1
28
+ @config.storage = :value2
29
+ @config.storage.should == :value2
30
+ end
31
+
32
+ it 'should be able to store any data' do
33
+ [
34
+ ['string', 'value' ],
35
+ ['symbol', :value ],
36
+ ['arrry', [:a, :b] ],
37
+ ['hashes', {:a => :b}],
38
+ ['integer', 1 ],
39
+ ['float', 1.5 ],
40
+ ['regexp', /regexp/ ],
41
+ ].each do |type, value|
42
+ @config.__send__("#{type}=", value)
43
+ @config.__send__(type).should == value
44
+ end
45
+ end
46
+
47
+ it 'should raise error when add by prohibited name' do
48
+ lambda {
49
+ @config.set_default('sub.aaa', :value)
50
+ @config.sub.aaa
51
+ }.should raise_error
52
+ end
53
+
54
+ it 'should raise error when add subb-storage to existed key' do
55
+ @config.subb = 'original value'
56
+ lambda {
57
+ @config.subb.key = 'invalid subbstitution'
58
+ }.should raise_error(
59
+ NoMethodError,
60
+ %r[undefined method `key=' for "original value":String]
61
+ )
62
+ end
63
+
64
+ it 'should set intermediate defult configs' do
65
+ @config.set_default 'subb.more', 'value'
66
+ @config.subb.class.should == Config
67
+ @config.subb.more.should == 'value'
68
+
69
+ @config.proxy.set_default(:port, 'value')
70
+ @config.proxy.port.should == 'value'
71
+ end
72
+
73
+ # FIXME: not work
74
+ # it 'should have :undefined value in un-assigned key' do
75
+ # @config.aaaa.should == :undefined
76
+ # end
77
+
78
+ it 'should be empty when something is assigned' do
79
+ @config.empty?.should be_true
80
+
81
+ @config.aaa = 1
82
+ @config.empty?.should be_false
83
+
84
+ @config.bbb.empty?.should be_true
85
+ end
86
+
87
+ it 'should be empty when assigned nil' do
88
+ @config.bbb = nil
89
+ @config.empty?.should be_false
90
+ end
91
+
92
+ it 'should be empty when set_defaulted' do
93
+ @config.set_default('aaa', 1)
94
+ @config.empty?.should be_false
95
+ end
96
+
97
+ it 'should use in expression' do
98
+ @config.set_default(:ssb, 'hoge')
99
+ lambda {
100
+ res = @config.ssb + ' piyo'
101
+ res.should == 'hoge piyo'
102
+ }.should_not raise_error
103
+ end
104
+
105
+ it 'should not change value when call set_default twice' do
106
+ @config.plugins.set_default :only, 'before_value'
107
+ @config.plugins.set_default :only, 'after_value'
108
+ @config.plugins.only.should == 'before_value'
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,69 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require File.dirname(__FILE__) + '/../spec_helper'
4
+
5
+ module Termtter
6
+ describe Hook do
7
+ before do
8
+ end
9
+
10
+ it 'should match' do
11
+ hook = Hook.new(
12
+ :name => :span,
13
+ :points => ['foo'],
14
+ :exec_proc => lambda{|cmd, arg|
15
+ puts 'a'
16
+ }
17
+ )
18
+ hook.match?('foo').should == true
19
+ hook.match?('bar').should == false
20
+ hook.match?(:foo).should == true
21
+ hook.match?(:bar).should == false
22
+ end
23
+
24
+ it 'should match when multi points' do
25
+ hook = Hook.new(
26
+ :name => :span,
27
+ :points => ['foo', 'bar'],
28
+ :exec_proc => lambda{|cmd, arg|
29
+ puts 'a'
30
+ }
31
+ )
32
+ hook.match?('foo').should == true
33
+ hook.match?('bar').should == true
34
+ hook.match?(:foo).should == true
35
+ hook.match?(:bar).should == true
36
+ end
37
+
38
+ it 'should match when multi points' do
39
+ hook = Hook.new(
40
+ :name => :span,
41
+ :points => ['foo', /bar/],
42
+ :exec_proc => lambda{|cmd, arg|
43
+ puts 'a'
44
+ }
45
+ )
46
+ hook.match?('foo').should == true
47
+ hook.match?('bar').should == true
48
+ hook.match?('_bar_').should == true
49
+ hook.match?(:foo).should == true
50
+ hook.match?(:_bar_).should == true
51
+ end
52
+
53
+ it 'should match when multi points' do
54
+ hook = Hook.new(
55
+ :name => :span,
56
+ :points => ['foo', /^bar/],
57
+ :exec_proc => lambda{|cmd, arg|
58
+ puts 'a'
59
+ }
60
+ )
61
+ hook.match?('bar').should == true
62
+ hook.match?('bar_').should == true
63
+ hook.match?('_bar_').should == false
64
+ hook.match?(:'bar').should == true
65
+ hook.match?(:'bar_').should == true
66
+ hook.match?(:'_bar_').should == false
67
+ end
68
+ end
69
+ end
@@ -2,42 +2,30 @@
2
2
 
3
3
  require File.dirname(__FILE__) + '/spec_helper'
4
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)
5
+ describe Termtter, 'when plugin is called (without init option)' do
6
+ it 'should require global plugin if exist' do
7
+ File.should_receive(:exist?).and_return(false)
8
+ should_receive(:require).with('plugins/aaa')
9
+ plugin 'aaa'
10
+ end
11
+
12
+ it 'should require user plugin if not exist' do
13
+ File.should_receive(:exist?).and_return(true)
14
+ should_receive(:require).with(File.expand_path('~/.termtter/plugins/aaa'))
15
+ plugin 'aaa'
16
+ end
10
17
 
11
- Termtter::Client.add_hook do |statuses, event|
12
- @statuses = statuses
13
- @event = event
14
- end
15
- end
18
+ it 'should handle_error if there are no plugins in global or user' do
19
+ Termtter::Client.should_receive(:handle_error)
20
+ plugin 'not-exist-plugin-hehehehehehe'
21
+ end
22
+ end
16
23
 
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'
24
+ describe Termtter, 'when plugin is called (with init option)' do
25
+ it 'init option will become config' do
26
+ should_receive(:require)
32
27
 
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
28
+ plugin 'aaa', :bbb => :ccc
29
+ config.plugins.aaa.bbb.should == :ccc
42
30
  end
43
31
  end
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: 0.8.14
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jugyo
@@ -24,34 +24,34 @@ dependencies:
24
24
  version: 1.1.3
25
25
  version:
26
26
  - !ruby/object:Gem::Dependency
27
- name: configatron
27
+ name: highline
28
28
  type: :runtime
29
29
  version_requirement:
30
30
  version_requirements: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 2.2.2
34
+ version: 1.5.0
35
35
  version:
36
36
  - !ruby/object:Gem::Dependency
37
- name: highline
37
+ name: termcolor
38
38
  type: :runtime
39
39
  version_requirement:
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
42
  - - ">="
43
43
  - !ruby/object:Gem::Version
44
- version: 1.5.0
44
+ version: 0.3.1
45
45
  version:
46
46
  - !ruby/object:Gem::Dependency
47
- name: termcolor
47
+ name: rubytter
48
48
  type: :runtime
49
49
  version_requirement:
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 0.3.1
54
+ version: 0.4.8
55
55
  version:
56
56
  description: Termtter is a terminal based Twitter client
57
57
  email: jugyo.org@gmail.com
@@ -64,94 +64,103 @@ extra_rdoc_files:
64
64
  - README.rdoc
65
65
  - History.txt
66
66
  files:
67
- - lib/filter/en2ja.rb
68
- - lib/filter/english.rb
69
- - lib/filter/expand-tinyurl.rb
70
- - lib/filter/fib.rb
71
- - lib/filter/ignore.rb
72
- - lib/filter/reply.rb
73
- - lib/filter/reverse.rb
74
- - lib/filter/url_addspace.rb
75
- - lib/filter/yhara.rb
76
- - lib/plugin/april_fool.rb
77
- - lib/plugin/bomb.rb
78
- - lib/plugin/clear.rb
79
- - lib/plugin/confirm.rb
80
- - lib/plugin/cool.rb
81
- - lib/plugin/devel.rb
82
- - lib/plugin/english.rb
83
- - lib/plugin/erb.rb
84
- - lib/plugin/favorite.rb
85
- - lib/plugin/fib.rb
86
- - lib/plugin/filter.rb
87
- - lib/plugin/follow.rb
88
- - lib/plugin/graduatter.rb
89
- - lib/plugin/grass.rb
90
- - lib/plugin/group.rb
91
- - lib/plugin/growl.rb
92
- - lib/plugin/hatebu.rb
93
- - lib/plugin/history.rb
94
- - lib/plugin/keyword.rb
95
- - lib/plugin/log.rb
96
- - lib/plugin/me.rb
97
- - lib/plugin/modify_arg_hook_sample.rb
98
- - lib/plugin/msagent.rb
99
- - lib/plugin/multi_reply.rb
100
- - lib/plugin/notify-send.rb
101
- - lib/plugin/otsune.rb
102
- - lib/plugin/outputz.rb
103
- - lib/plugin/pause.rb
104
- - lib/plugin/plugin.rb
105
- - lib/plugin/post_exec_hook_sample.rb
106
- - lib/plugin/pre_exec_hook_sample.rb
107
- - lib/plugin/primes.rb
108
- - lib/plugin/quicklook.rb
109
- - lib/plugin/random.rb
110
- - lib/plugin/reblog.rb
111
- - lib/plugin/reload.rb
112
- - lib/plugin/say.rb
113
- - lib/plugin/scrape.rb
114
- - lib/plugin/screen.rb
115
- - lib/plugin/shell.rb
116
- - lib/plugin/sl.rb
117
- - lib/plugin/spam.rb
118
- - lib/plugin/standard_plugins.rb
119
- - lib/plugin/stdout.rb
120
- - lib/plugin/system_status.rb
121
- - lib/plugin/translation.rb
122
- - lib/plugin/update_editor.rb
123
- - lib/plugin/uri-open.rb
124
- - lib/plugin/wassr_post.rb
125
- - lib/plugin/yhara.rb
126
- - lib/plugin/yonda.rb
67
+ - lib/plugins/april_fool.rb
68
+ - lib/plugins/bomb.rb
69
+ - lib/plugins/clear.rb
70
+ - lib/plugins/confirm.rb
71
+ - lib/plugins/cool.rb
72
+ - lib/plugins/devel.rb
73
+ - lib/plugins/en2ja.rb
74
+ - lib/plugins/english.rb
75
+ - lib/plugins/erb.rb
76
+ - lib/plugins/expand-tinyurl.rb
77
+ - lib/plugins/favorite.rb
78
+ - lib/plugins/fib.rb
79
+ - lib/plugins/fib_filter.rb
80
+ - lib/plugins/filter.rb
81
+ - lib/plugins/graduatter.rb
82
+ - lib/plugins/grass.rb
83
+ - lib/plugins/group.rb
84
+ - lib/plugins/growl.rb
85
+ - lib/plugins/hatebu.rb
86
+ - lib/plugins/history.rb
87
+ - lib/plugins/ignore.rb
88
+ - lib/plugins/keyword.rb
89
+ - lib/plugins/log.rb
90
+ - lib/plugins/me.rb
91
+ - lib/plugins/modify_arg_hook_sample.rb
92
+ - lib/plugins/msagent.rb
93
+ - lib/plugins/multi_reply.rb
94
+ - lib/plugins/notify-send.rb
95
+ - lib/plugins/otsune.rb
96
+ - lib/plugins/outputz.rb
97
+ - lib/plugins/pause.rb
98
+ - lib/plugins/plugin.rb
99
+ - lib/plugins/post_exec_hook_sample.rb
100
+ - lib/plugins/pre_exec_hook_sample.rb
101
+ - lib/plugins/primes.rb
102
+ - lib/plugins/quicklook.rb
103
+ - lib/plugins/random.rb
104
+ - lib/plugins/reblog.rb
105
+ - lib/plugins/reload.rb
106
+ - lib/plugins/reply.rb
107
+ - lib/plugins/reverse.rb
108
+ - lib/plugins/say.rb
109
+ - lib/plugins/scrape.rb
110
+ - lib/plugins/screen-notify.rb
111
+ - lib/plugins/screen.rb
112
+ - lib/plugins/shell.rb
113
+ - lib/plugins/sl.rb
114
+ - lib/plugins/spam.rb
115
+ - lib/plugins/standard_plugins.rb
116
+ - lib/plugins/stdout.rb
117
+ - lib/plugins/storage/DB.rb
118
+ - lib/plugins/storage/status.rb
119
+ - lib/plugins/storage/status_mook.rb
120
+ - lib/plugins/storage.rb
121
+ - lib/plugins/system_status.rb
122
+ - lib/plugins/translation.rb
123
+ - lib/plugins/update_editor.rb
124
+ - lib/plugins/uri-open.rb
125
+ - lib/plugins/url_addspace.rb
126
+ - lib/plugins/wassr_post.rb
127
+ - lib/plugins/yhara.rb
128
+ - lib/plugins/yhara_filter.rb
129
+ - lib/plugins/yonda.rb
127
130
  - lib/termtter/api.rb
128
131
  - lib/termtter/client.rb
129
132
  - lib/termtter/command.rb
133
+ - lib/termtter/config.rb
130
134
  - lib/termtter/connection.rb
131
135
  - lib/termtter/hook.rb
132
- - lib/termtter/status.rb
136
+ - lib/termtter/optparse.rb
133
137
  - lib/termtter/system_extensions.rb
134
138
  - lib/termtter/task.rb
135
139
  - lib/termtter/task_manager.rb
136
- - lib/termtter/twitter.rb
137
- - lib/termtter/user.rb
138
140
  - lib/termtter/version.rb
139
141
  - lib/termtter.rb
140
142
  - spec/plugin/cool_spec.rb
143
+ - spec/plugin/english_spec.rb
144
+ - spec/plugin/favorite_spec.rb
141
145
  - spec/plugin/fib_spec.rb
142
146
  - spec/plugin/filter_spec.rb
147
+ - spec/plugin/pause_spec.rb
143
148
  - spec/plugin/plugin_spec.rb
149
+ - spec/plugin/primes_spec.rb
144
150
  - spec/plugin/shell_spec.rb
151
+ - spec/plugin/sl_spec.rb
145
152
  - spec/plugin/spam_spec.rb
146
153
  - spec/plugin/standard_plugins_spec.rb
154
+ - spec/plugin/storage/DB_spec.rb
155
+ - spec/plugin/storage/status_spec.rb
147
156
  - spec/spec_helper.rb
148
157
  - spec/termtter/client_spec.rb
149
158
  - spec/termtter/command_spec.rb
159
+ - spec/termtter/config_spec.rb
160
+ - spec/termtter/hook_spec.rb
150
161
  - spec/termtter/task_manager_spec.rb
151
162
  - spec/termtter/task_spec.rb
152
- - spec/termtter/user_spec.rb
153
163
  - spec/termtter_spec.rb
154
- - test/test_termtter.rb
155
164
  - test/friends_timeline.json
156
165
  - test/search.json
157
166
  - README.rdoc
@@ -1,8 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- Termtter::Client.add_filter do |statuses|
4
- statuses.select{|s| s.english? }
5
- end
6
-
7
- # filter-english.rb
8
- # select English post only
data/lib/filter/ignore.rb DELETED
@@ -1,19 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
-
4
- configatron.filters.ignore.set_default(:words, [])
5
-
6
- module Termtter::Client
7
- add_filter do |statuses|
8
- ignore_words = configatron.filters.ignore.words
9
- statuses.delete_if do |s|
10
- ignore_words.any? {|i| i =~ s.text }
11
- end
12
- end
13
- end
14
-
15
- # filter/ignore.rb
16
- # ignore words
17
- # setting
18
- # configatron.filters.ignore.words = [ /ignore/, /words/ ]
19
-
data/lib/filter/yhara.rb DELETED
@@ -1,20 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- module Termtter
4
-
5
- class Status
6
- def yharian?
7
- self.text =~ /^(?:\s|(y\s)|(?:hara\s))+\s*(?:y|(?:hara))(?:\?|!|\.)?\s*$/
8
- end
9
- end
10
-
11
- module Client
12
- add_filter do |statuses|
13
- statuses.select{|s| s.yharian? }
14
- end
15
- end
16
- end
17
-
18
- # filter-yhara.rb
19
- # select Yharian post only
20
-
data/lib/plugin/bomb.rb DELETED
@@ -1,29 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- module Termtter
4
- class Status
5
- def bomb?
6
- /爆発|bomb/ =~ self.text
7
- end
8
- end
9
-
10
- module Client
11
- register_command(
12
- :name => :bomb, :aliases => [],
13
- :exec_proc => lambda {|arg|
14
- text = "#{arg.strip} 爆発しろ!"
15
- Termtter::API::twitter.update_status(text)
16
- puts "=> #{text}"
17
- },
18
- :help => ['bomb WORD', 'Bomb it']
19
- )
20
- end
21
- end
22
-
23
- # bomb.rb
24
- # Bomb it!
25
- #
26
- # See http://gyazo.com/4b33517380673d92f51a52e675ecdb02.png .
27
- # configatron.plugins.stdout.timeline_format =
28
- # %q[<90><%=time%></90> <%= s.bomb? ? "<37><41>#{status}</41></37>" : "<#{status_color}>#{status}</#{status_color}>" %> <90><%=id%></90>]
29
- # vim: fenc=utf8