butler 1.8.3 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. data/CHANGELOG.txt +293 -37
  2. data/README.txt +10 -0
  3. data/Rakefile +24 -13
  4. data/bin/botcontrol +6 -5
  5. data/data/butler/dialogs/create.rb +21 -6
  6. data/data/butler/dialogs/create_config.rb +5 -2
  7. data/data/butler/dialogs/en/create.yaml +6 -3
  8. data/data/butler/dialogs/en/create_config.yaml +1 -0
  9. data/data/butler/dialogs/en/quickcreate.yaml +1 -1
  10. data/data/butler/dialogs/en/sync.yaml +7 -0
  11. data/data/butler/dialogs/en/username.yaml +2 -0
  12. data/data/butler/dialogs/quickcreate.rb +6 -2
  13. data/data/butler/dialogs/sync.rb +83 -0
  14. data/data/butler/dialogs/username.rb +1 -0
  15. data/data/butler/plugins/core/ping.rb +22 -0
  16. data/data/butler/plugins/core/remote.rb +38 -0
  17. data/data/butler/plugins/dev/eval.rb +6 -4
  18. data/data/butler/plugins/dev/onhandlers.rb +93 -0
  19. data/data/butler/plugins/dev/rawlog.rb +109 -45
  20. data/data/butler/plugins/games/countdown.rb +23 -14
  21. data/data/butler/plugins/games/eightball.rb +21 -13
  22. data/data/butler/plugins/games/roll.rb +12 -12
  23. data/data/butler/plugins/irc/join.rb +2 -2
  24. data/data/butler/plugins/irc/notice.rb +10 -10
  25. data/data/butler/plugins/irc/part.rb +12 -12
  26. data/data/butler/plugins/irc/privmsg.rb +10 -10
  27. data/data/butler/plugins/irc/quit.rb +12 -12
  28. data/data/butler/plugins/operator/devoice.rb +1 -1
  29. data/data/butler/plugins/public/help.rb +10 -4
  30. data/data/butler/plugins/{util → service}/calculator.rb +0 -0
  31. data/data/butler/plugins/service/define.rb +16 -13
  32. data/data/butler/plugins/service/log.rb +85 -0
  33. data/data/butler/plugins/service/seen.rb +64 -0
  34. data/data/butler/plugins/service/svn.rb +6 -5
  35. data/data/butler/plugins/util/load.rb +3 -1
  36. data/data/butler/services/org.rubyforge.butler/calculator/1/service.rb +96 -0
  37. data/data/butler/services/org.rubyforge.butler/log/1/service.rb +148 -68
  38. data/lib/access/admin.rb +5 -0
  39. data/lib/blank.rb +32 -0
  40. data/lib/butler.rb +4 -4
  41. data/lib/butler/bot.rb +118 -33
  42. data/lib/butler/control.rb +5 -4
  43. data/lib/butler/debuglog.rb +12 -4
  44. data/lib/butler/dialog.rb +1 -1
  45. data/lib/butler/initialvalues.rb +1 -1
  46. data/lib/butler/irc/client.rb +31 -12
  47. data/lib/butler/irc/message.rb +32 -13
  48. data/lib/butler/irc/parser.rb +67 -30
  49. data/lib/butler/irc/parser/{commands.rb → command.rb} +0 -38
  50. data/lib/butler/irc/parser/generic.rb +9 -12
  51. data/lib/butler/irc/parser/rfc2812.rb +40 -2
  52. data/lib/butler/irc/socket.rb +66 -41
  53. data/lib/butler/irc/string.rb +1 -5
  54. data/lib/butler/plugin.rb +56 -23
  55. data/lib/butler/plugin/configproxy.rb +1 -0
  56. data/lib/butler/plugin/more.rb +2 -2
  57. data/lib/butler/plugins.rb +7 -1
  58. data/lib/butler/remote/connection.rb +113 -0
  59. data/lib/butler/remote/message.rb +157 -0
  60. data/lib/butler/remote/server.rb +85 -0
  61. data/lib/butler/remote/user.rb +46 -0
  62. data/lib/butler/service.rb +2 -1
  63. data/lib/butler/services.rb +2 -2
  64. data/lib/butler/version.rb +2 -2
  65. data/lib/configuration.rb +13 -16
  66. data/lib/ostructfixed.rb +0 -6
  67. data/lib/ruby/array/random.rb +2 -1
  68. data/lib/scriptfile.rb +63 -14
  69. data/lib/timingoutresource.rb +54 -0
  70. data/test/test_scriptfile.rb +51 -0
  71. metadata +63 -61
  72. data/data/butler/dialogs/en/sync_plugins.yaml +0 -3
  73. data/data/butler/dialogs/sync_plugins.rb +0 -30
  74. data/data/butler/services/org.rubyforge.butler/calculator/1/calculator.rb +0 -68
  75. data/lib/log/splitter.rb +0 -30
  76. data/test/test_access/privilege/banners.statistics.yaml +0 -3
  77. data/test/test_access/privilege/banners.yaml +0 -3
  78. data/test/test_access/privilege/news.create.yaml +0 -3
  79. data/test/test_access/privilege/news.delete.yaml +0 -3
  80. data/test/test_access/privilege/news.edit.yaml +0 -3
  81. data/test/test_access/privilege/news.read.yaml +0 -3
  82. data/test/test_access/privilege/news.yaml +0 -3
  83. data/test/test_access/privilege/paid_content.yaml +0 -3
  84. data/test/test_access/privilege/statistics.ftp.yaml +0 -3
  85. data/test/test_access/privilege/statistics.web.yaml +0 -3
  86. data/test/test_access/privilege/statistics.yaml +0 -3
  87. data/test/test_access/role/chiefeditor.yaml +0 -7
  88. data/test/test_access/role/editor.yaml +0 -9
  89. data/test/test_access/user/test.yaml +0 -12
metadata CHANGED
@@ -1,33 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
4
2
  name: butler
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.8.3
7
- date: 2007-12-06 00:00:00 +01:00
8
- summary: Butler - the IRC bot with class
9
- require_paths:
10
- - lib
11
- email: apeiros@gmx.net
12
- homepage: http://butler.rubyforge.org/
13
- rubyforge_project: butler
14
- description: Butler - the IRC bot with class
15
- autorequire:
16
- default_executable: botcontrol
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.8.0
24
- version:
4
+ version: 1.9.0
25
5
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
6
  authors:
30
7
  - Stefan Rusterholz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-01-01 00:00:00 +01:00
13
+ default_executable: botcontrol
14
+ dependencies: []
15
+
16
+ description: Butler - the IRC bot with class
17
+ email: apeiros@gmx.net
18
+ executables:
19
+ - botcontrol
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.txt
24
+ - CHANGELOG.txt
25
+ - GPL.txt
26
+ - LICENSE.txt
31
27
  files:
32
28
  - CHANGELOG.txt
33
29
  - LICENSE.txt
@@ -59,9 +55,10 @@ files:
59
55
  - data/butler/dialogs/en/quickcreate.yaml
60
56
  - data/butler/dialogs/en/rename.yaml
61
57
  - data/butler/dialogs/en/start.yaml
62
- - data/butler/dialogs/en/sync_plugins.yaml
58
+ - data/butler/dialogs/en/sync.yaml
63
59
  - data/butler/dialogs/en/uninstall.yaml
64
60
  - data/butler/dialogs/en/unknown_command.yaml
61
+ - data/butler/dialogs/en/username.yaml
65
62
  - data/butler/dialogs/help.rb
66
63
  - data/butler/dialogs/info.rb
67
64
  - data/butler/dialogs/interactive.rb
@@ -71,18 +68,22 @@ files:
71
68
  - data/butler/dialogs/rename.rb
72
69
  - data/butler/dialogs/selectbot.rb
73
70
  - data/butler/dialogs/start.rb
74
- - data/butler/dialogs/sync_plugins.rb
71
+ - data/butler/dialogs/sync.rb
75
72
  - data/butler/dialogs/uninstall.rb
76
73
  - data/butler/dialogs/unknown_command.rb
74
+ - data/butler/dialogs/username.rb
77
75
  - data/butler/plugins
78
76
  - data/butler/plugins/core
79
77
  - data/butler/plugins/core/access.rb
80
78
  - data/butler/plugins/core/logout.rb
79
+ - data/butler/plugins/core/ping.rb
81
80
  - data/butler/plugins/core/plugins.rb
81
+ - data/butler/plugins/core/remote.rb
82
82
  - data/butler/plugins/dev
83
83
  - data/butler/plugins/dev/bleakhouse.rb
84
84
  - data/butler/plugins/dev/eval.rb
85
85
  - data/butler/plugins/dev/nometa.rb
86
+ - data/butler/plugins/dev/onhandlers.rb
86
87
  - data/butler/plugins/dev/raw.rb
87
88
  - data/butler/plugins/dev/rawlog.rb
88
89
  - data/butler/plugins/games
@@ -108,12 +109,14 @@ files:
108
109
  - data/butler/plugins/public/login.rb
109
110
  - data/butler/plugins/public/usage.rb
110
111
  - data/butler/plugins/service
112
+ - data/butler/plugins/service/calculator.rb
111
113
  - data/butler/plugins/service/clones.rb
112
114
  - data/butler/plugins/service/define.rb
115
+ - data/butler/plugins/service/log.rb
113
116
  - data/butler/plugins/service/more.rb
117
+ - data/butler/plugins/service/seen.rb
114
118
  - data/butler/plugins/service/svn.rb
115
119
  - data/butler/plugins/util
116
- - data/butler/plugins/util/calculator.rb
117
120
  - data/butler/plugins/util/cycle.rb
118
121
  - data/butler/plugins/util/load.rb
119
122
  - data/butler/plugins/util/pong.rb
@@ -121,7 +124,7 @@ files:
121
124
  - data/butler/services/org.rubyforge.butler
122
125
  - data/butler/services/org.rubyforge.butler/calculator
123
126
  - data/butler/services/org.rubyforge.butler/calculator/1
124
- - data/butler/services/org.rubyforge.butler/calculator/1/calculator.rb
127
+ - data/butler/services/org.rubyforge.butler/calculator/1/service.rb
125
128
  - data/butler/services/org.rubyforge.butler/log
126
129
  - data/butler/services/org.rubyforge.butler/log/1
127
130
  - data/butler/services/org.rubyforge.butler/log/1/service.rb
@@ -161,6 +164,7 @@ files:
161
164
  - lib/access/version.rb
162
165
  - lib/access/yamlbase.rb
163
166
  - lib/access.rb
167
+ - lib/blank.rb
164
168
  - lib/butler
165
169
  - lib/butler/bot.rb
166
170
  - lib/butler/control.rb
@@ -178,7 +182,7 @@ files:
178
182
  - lib/butler/irc/hostmask.rb
179
183
  - lib/butler/irc/message.rb
180
184
  - lib/butler/irc/parser
181
- - lib/butler/irc/parser/commands.rb
185
+ - lib/butler/irc/parser/command.rb
182
186
  - lib/butler/irc/parser/generic.rb
183
187
  - lib/butler/irc/parser/rfc2812.rb
184
188
  - lib/butler/irc/parser.rb
@@ -197,6 +201,11 @@ files:
197
201
  - lib/butler/plugin/trigger.rb
198
202
  - lib/butler/plugin.rb
199
203
  - lib/butler/plugins.rb
204
+ - lib/butler/remote
205
+ - lib/butler/remote/connection.rb
206
+ - lib/butler/remote/message.rb
207
+ - lib/butler/remote/server.rb
208
+ - lib/butler/remote/user.rb
200
209
  - lib/butler/service.rb
201
210
  - lib/butler/services.rb
202
211
  - lib/butler/session.rb
@@ -229,7 +238,6 @@ files:
229
238
  - lib/log/forward.rb
230
239
  - lib/log/methods.rb
231
240
  - lib/log/nolog.rb
232
- - lib/log/splitter.rb
233
241
  - lib/log.rb
234
242
  - lib/ostructfixed.rb
235
243
  - lib/ruby
@@ -269,8 +277,8 @@ files:
269
277
  - lib/string/utf8.rb
270
278
  - lib/string.rb
271
279
  - lib/templater.rb
280
+ - lib/timingoutresource.rb
272
281
  - lib/w3validator.rb
273
- - test/access
274
282
  - test/butler
275
283
  - test/butler/plugin
276
284
  - test/butler/plugin/mapper.rb
@@ -287,28 +295,12 @@ files:
287
295
  - test/irc/serverlistings
288
296
  - test/irc/serverlistings/test_rpl_hiddenhost.txt
289
297
  - test/irc/users.rb
290
- - test/test_access
291
- - test/test_access/privilege
292
- - test/test_access/privilege/banners.statistics.yaml
293
- - test/test_access/privilege/banners.yaml
294
- - test/test_access/privilege/news.create.yaml
295
- - test/test_access/privilege/news.delete.yaml
296
- - test/test_access/privilege/news.edit.yaml
297
- - test/test_access/privilege/news.read.yaml
298
- - test/test_access/privilege/news.yaml
299
- - test/test_access/privilege/paid_content.yaml
300
- - test/test_access/privilege/statistics.ftp.yaml
301
- - test/test_access/privilege/statistics.web.yaml
302
- - test/test_access/privilege/statistics.yaml
303
- - test/test_access/role
304
- - test/test_access/role/chiefeditor.yaml
305
- - test/test_access/role/editor.yaml
306
- - test/test_access/user
307
- - test/test_access/user/test.yaml
308
298
  - test/test_access.rb
309
299
  - test/test_configuration.rb
310
- test_files: []
311
-
300
+ - test/test_scriptfile.rb
301
+ has_rdoc: true
302
+ homepage: http://butler.rubyforge.org/
303
+ post_install_message:
312
304
  rdoc_options:
313
305
  - --quiet
314
306
  - --title
@@ -321,16 +313,26 @@ rdoc_options:
321
313
  - --tab-width
322
314
  - "2"
323
315
  - --line-numbers
324
- extra_rdoc_files:
325
- - README.txt
326
- - CHANGELOG.txt
327
- - GPL.txt
328
- - LICENSE.txt
329
- executables:
330
- - botcontrol
331
- extensions: []
332
-
316
+ require_paths:
317
+ - lib
318
+ required_ruby_version: !ruby/object:Gem::Requirement
319
+ requirements:
320
+ - - ">="
321
+ - !ruby/object:Gem::Version
322
+ version: 1.8.0
323
+ version:
324
+ required_rubygems_version: !ruby/object:Gem::Requirement
325
+ requirements:
326
+ - - ">="
327
+ - !ruby/object:Gem::Version
328
+ version: "0"
329
+ version:
333
330
  requirements: []
334
331
 
335
- dependencies: []
332
+ rubyforge_project: butler
333
+ rubygems_version: 1.0.0
334
+ signing_key:
335
+ specification_version: 2
336
+ summary: Butler - the IRC bot with class
337
+ test_files: []
336
338
 
@@ -1,3 +0,0 @@
1
- ---
2
- :updating: "Updating plugins for '<%= name %>'"
3
- :override_newer: "Override newer plugin <%= name %> (Yours <%= a.strftime('%F %T') %>, Copying <%= b.strftime('%F %T') %>"
@@ -1,30 +0,0 @@
1
- bots = variables.botname ? [variables.botname] : Butler.list(variables.path)
2
- bots_path = variables.path.bots
3
- dirlist = Dir[variables.path.plugin_repository+"/**/*"]
4
- dirs, plugins = dirlist.partition { |filepath| File.directory?(filepath) }
5
- slice = (variables.path.plugin_repository.length+1)..-1
6
- dirs.map! { |dir| dir[slice] }
7
- plugins.map! { |plugin| [plugin, plugin[slice], File.mtime(plugin)] }
8
-
9
- bots.each { |name|
10
- say(:updating, :name => name)
11
- bot_path = "#{bots_path}/#{name}"
12
- FileUtils.mkdir_p(dirs.map { |dir| "#{bot_path}/plugins/#{dir}" }, :mode => 0755)
13
- plugins.each { |from, to, mtime|
14
- full_to = "#{bot_path}/plugins/#{to}"
15
- if File.exist?(full_to) then
16
- if mtime > File.mtime(full_to) then
17
- next unless prompt(:override_newer, true,
18
- :name => to,
19
- :a => File.mtime(full_to),
20
- :b => mtime
21
- )
22
- end
23
- #puts("Deleting #{full_to}")
24
- File.delete(full_to)
25
- end
26
- #puts("Copying #{from} to #{full_to}")
27
- FileUtils.cp(from, "#{full_to}")
28
- }
29
- }
30
-
@@ -1,68 +0,0 @@
1
- require 'blank'
2
-
3
- class Calculator < Blank('inspect', 'binding', 'method_missing')
4
- class Functions
5
- def initialize
6
- @functions = {}
7
- end
8
-
9
- def [](name)
10
- @functions[name.to_s]
11
- end
12
-
13
- def []=(name, definition)
14
- @functions[name.to_s] = definition
15
- end
16
-
17
- def call(m, *args)
18
- @functions[m.to_s].call(*args)
19
- end
20
-
21
- def respond_to?(m, *a)
22
- super || @functions.has_key?(m.to_s)
23
- end
24
-
25
- def method_missing(m, *args)
26
- super unless @functions.has_key?(m.to_s)
27
- @functions[m.to_s].call(*args)
28
- end
29
- end
30
-
31
- include Math
32
-
33
- attr_reader :term
34
-
35
- def initialize(term, delegate=nil)
36
- @term = term.scan(/\s+|,|[a-z]*\(|\)|-?\d(?:\.\d+)?|[a-z]+|[*\/%+-]/).join
37
- @variables = {}
38
- @delegate = delegate
39
- @results = []
40
- end
41
-
42
- def result(variables={})
43
- @variables=variables
44
- @results.unshift Thread.new {
45
- $SAFE = 3
46
- Kernel.eval(@term, binding)
47
- }.value
48
- @results.pop if @results.length > 10
49
- @results.first
50
- end
51
- alias call result
52
-
53
- def load(result)
54
- @results[result]
55
- end
56
-
57
- def method_missing(m, *a)
58
- if a.empty? && @variables.has_key?(m) then
59
- @variables[m]
60
- elsif @delegate.respond_to?(m) then
61
- @delegate.call(m, *a)
62
- else
63
- super
64
- end
65
- end
66
- end
67
-
68
- register_service("org.rubyforge.butler.calculator", Calculator)
@@ -1,30 +0,0 @@
1
- module Log
2
- class Splitter
3
- def initialize(*receivers)
4
- @receivers = receivers
5
- end
6
-
7
- def __delete__(receiver)
8
- @receivers.delete(receiver)
9
- end
10
-
11
- def __add__(receiver)
12
- @receivers << receiver
13
- end
14
-
15
- def each(&block)
16
- @receivers.each(&block)
17
- end
18
-
19
- def method_missing(*a, &b)
20
- @receivers.each { |r| r.__send__(*a, &b)
21
- end
22
-
23
- def inspect
24
- "#<%s:%08x %s %s>" % [
25
- self.class,
26
- object_id,
27
- @receivers.map { |r| r.inspect }.join(', ')
28
- ]
29
- end
30
- end
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege banners/statistics
3
- :oid: banners/statistics
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege banners
3
- :oid: banners
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege news/create
3
- :oid: news/create
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege news/delete
3
- :oid: news/delete
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege news/edit
3
- :oid: news/edit
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege news/read
3
- :oid: news/read
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege news
3
- :oid: news
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege paid_content
3
- :oid: paid_content
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege statistics/ftp
3
- :oid: statistics/ftp
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege statistics/web
3
- :oid: statistics/web
@@ -1,3 +0,0 @@
1
- ---
2
- :description: test-privilege statistics
3
- :oid: statistics
@@ -1,7 +0,0 @@
1
- ---
2
- :description: testrole description 2
3
- :oid: chiefeditor
4
- :roles:
5
- - editor
6
- :privileges:
7
- news:
@@ -1,9 +0,0 @@
1
- ---
2
- :description: testrole description 1
3
- :oid: editor
4
- :roles: []
5
-
6
- :privileges:
7
- news/create:
8
- statistics:
9
- news/edit:
@@ -1,12 +0,0 @@
1
- ---
2
- :oid: test
3
- :roles:
4
- - editor
5
- :privileges:
6
- banners:
7
- statistics/web:
8
- paid_content:
9
- :credentials: 2F3BC18C0D3E6B1B8A445075535D26E9
10
- :active: true
11
- :meta:
12
- :admin: false