butler 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. data/CHANGELOG +4 -0
  2. data/GPL.txt +340 -0
  3. data/LICENSE.txt +52 -0
  4. data/README +37 -0
  5. data/Rakefile +334 -0
  6. data/bin/botcontrol +230 -0
  7. data/data/butler/config_template.yaml +4 -0
  8. data/data/butler/dialogs/backup.rb +19 -0
  9. data/data/butler/dialogs/botcontrol.rb +4 -0
  10. data/data/butler/dialogs/config.rb +1 -0
  11. data/data/butler/dialogs/create.rb +53 -0
  12. data/data/butler/dialogs/delete.rb +3 -0
  13. data/data/butler/dialogs/en/backup.yaml +6 -0
  14. data/data/butler/dialogs/en/botcontrol.yaml +5 -0
  15. data/data/butler/dialogs/en/create.yaml +11 -0
  16. data/data/butler/dialogs/en/delete.yaml +2 -0
  17. data/data/butler/dialogs/en/help.yaml +17 -0
  18. data/data/butler/dialogs/en/info.yaml +13 -0
  19. data/data/butler/dialogs/en/list.yaml +4 -0
  20. data/data/butler/dialogs/en/notyetimplemented.yaml +2 -0
  21. data/data/butler/dialogs/en/rename.yaml +3 -0
  22. data/data/butler/dialogs/en/start.yaml +3 -0
  23. data/data/butler/dialogs/en/sync_plugins.yaml +3 -0
  24. data/data/butler/dialogs/en/uninstall.yaml +5 -0
  25. data/data/butler/dialogs/en/unknown_command.yaml +2 -0
  26. data/data/butler/dialogs/help.rb +11 -0
  27. data/data/butler/dialogs/info.rb +27 -0
  28. data/data/butler/dialogs/interactive.rb +1 -0
  29. data/data/butler/dialogs/list.rb +10 -0
  30. data/data/butler/dialogs/notyetimplemented.rb +1 -0
  31. data/data/butler/dialogs/rename.rb +4 -0
  32. data/data/butler/dialogs/selectbot.rb +2 -0
  33. data/data/butler/dialogs/start.rb +5 -0
  34. data/data/butler/dialogs/sync_plugins.rb +30 -0
  35. data/data/butler/dialogs/uninstall.rb +17 -0
  36. data/data/butler/dialogs/unknown_command.rb +1 -0
  37. data/data/butler/plugins/core/logout.rb +41 -0
  38. data/data/butler/plugins/core/plugins.rb +134 -0
  39. data/data/butler/plugins/core/privilege.rb +103 -0
  40. data/data/butler/plugins/core/user.rb +166 -0
  41. data/data/butler/plugins/dev/eval.rb +64 -0
  42. data/data/butler/plugins/dev/nometa.rb +14 -0
  43. data/data/butler/plugins/dev/onhandlers.rb +93 -0
  44. data/data/butler/plugins/dev/raw.rb +36 -0
  45. data/data/butler/plugins/dev/rawlog.rb +77 -0
  46. data/data/butler/plugins/games/eightball.rb +54 -0
  47. data/data/butler/plugins/games/mastermind.rb +174 -0
  48. data/data/butler/plugins/irc/action.rb +36 -0
  49. data/data/butler/plugins/irc/join.rb +38 -0
  50. data/data/butler/plugins/irc/notice.rb +36 -0
  51. data/data/butler/plugins/irc/part.rb +38 -0
  52. data/data/butler/plugins/irc/privmsg.rb +36 -0
  53. data/data/butler/plugins/irc/quit.rb +36 -0
  54. data/data/butler/plugins/operator/deop.rb +41 -0
  55. data/data/butler/plugins/operator/devoice.rb +41 -0
  56. data/data/butler/plugins/operator/limit.rb +47 -0
  57. data/data/butler/plugins/operator/op.rb +41 -0
  58. data/data/butler/plugins/operator/voice.rb +41 -0
  59. data/data/butler/plugins/public/help.rb +69 -0
  60. data/data/butler/plugins/public/login.rb +72 -0
  61. data/data/butler/plugins/public/usage.rb +49 -0
  62. data/data/butler/plugins/service/clones.rb +56 -0
  63. data/data/butler/plugins/service/define.rb +47 -0
  64. data/data/butler/plugins/service/log.rb +183 -0
  65. data/data/butler/plugins/service/svn.rb +91 -0
  66. data/data/butler/plugins/util/cycle.rb +98 -0
  67. data/data/butler/plugins/util/load.rb +41 -0
  68. data/data/butler/plugins/util/pong.rb +29 -0
  69. data/data/butler/strings/random/acknowledge.en.yaml +5 -0
  70. data/data/butler/strings/random/gratitude.en.yaml +3 -0
  71. data/data/butler/strings/random/hello.en.yaml +4 -0
  72. data/data/butler/strings/random/ignorance.en.yaml +7 -0
  73. data/data/butler/strings/random/ignorance_about.en.yaml +3 -0
  74. data/data/butler/strings/random/insult.en.yaml +3 -0
  75. data/data/butler/strings/random/rejection.en.yaml +12 -0
  76. data/data/man/botcontrol.1 +17 -0
  77. data/lib/access.rb +187 -0
  78. data/lib/access/admin.rb +16 -0
  79. data/lib/access/privilege.rb +122 -0
  80. data/lib/access/role.rb +102 -0
  81. data/lib/access/savable.rb +18 -0
  82. data/lib/access/user.rb +180 -0
  83. data/lib/access/yamlbase.rb +126 -0
  84. data/lib/butler.rb +188 -0
  85. data/lib/butler/bot.rb +247 -0
  86. data/lib/butler/control.rb +93 -0
  87. data/lib/butler/dialog.rb +64 -0
  88. data/lib/butler/initialvalues.rb +40 -0
  89. data/lib/butler/irc/channel.rb +135 -0
  90. data/lib/butler/irc/channels.rb +96 -0
  91. data/lib/butler/irc/client.rb +351 -0
  92. data/lib/butler/irc/hostmask.rb +53 -0
  93. data/lib/butler/irc/message.rb +184 -0
  94. data/lib/butler/irc/parser.rb +125 -0
  95. data/lib/butler/irc/parser/commands.rb +83 -0
  96. data/lib/butler/irc/parser/generic.rb +343 -0
  97. data/lib/butler/irc/socket.rb +378 -0
  98. data/lib/butler/irc/string.rb +186 -0
  99. data/lib/butler/irc/topic.rb +15 -0
  100. data/lib/butler/irc/user.rb +265 -0
  101. data/lib/butler/irc/users.rb +112 -0
  102. data/lib/butler/plugin.rb +249 -0
  103. data/lib/butler/plugin/configproxy.rb +35 -0
  104. data/lib/butler/plugin/mapper.rb +85 -0
  105. data/lib/butler/plugin/matcher.rb +55 -0
  106. data/lib/butler/plugin/onhandlers.rb +70 -0
  107. data/lib/butler/plugin/trigger.rb +58 -0
  108. data/lib/butler/plugins.rb +147 -0
  109. data/lib/butler/version.rb +17 -0
  110. data/lib/cloptions.rb +217 -0
  111. data/lib/cloptions/adapters.rb +24 -0
  112. data/lib/cloptions/switch.rb +132 -0
  113. data/lib/configuration.rb +223 -0
  114. data/lib/dialogline.rb +296 -0
  115. data/lib/dialogline/localizations.rb +24 -0
  116. data/lib/durations.rb +57 -0
  117. data/lib/event.rb +295 -0
  118. data/lib/event/at.rb +64 -0
  119. data/lib/event/every.rb +56 -0
  120. data/lib/event/timed.rb +112 -0
  121. data/lib/installer.rb +75 -0
  122. data/lib/iterator.rb +34 -0
  123. data/lib/log.rb +68 -0
  124. data/lib/log/comfort.rb +85 -0
  125. data/lib/log/converter.rb +23 -0
  126. data/lib/log/entry.rb +152 -0
  127. data/lib/log/fakeio.rb +55 -0
  128. data/lib/log/file.rb +54 -0
  129. data/lib/log/filereader.rb +81 -0
  130. data/lib/log/forward.rb +49 -0
  131. data/lib/log/methods.rb +39 -0
  132. data/lib/log/nolog.rb +18 -0
  133. data/lib/log/splitter.rb +26 -0
  134. data/lib/ostructfixed.rb +26 -0
  135. data/lib/ruby/array/columnize.rb +38 -0
  136. data/lib/ruby/dir/mktree.rb +28 -0
  137. data/lib/ruby/enumerable/join.rb +13 -0
  138. data/lib/ruby/exception/detailed.rb +24 -0
  139. data/lib/ruby/file/append.rb +11 -0
  140. data/lib/ruby/file/write.rb +11 -0
  141. data/lib/ruby/hash/zip.rb +15 -0
  142. data/lib/ruby/kernel/bench.rb +15 -0
  143. data/lib/ruby/kernel/daemonize.rb +42 -0
  144. data/lib/ruby/kernel/non_verbose.rb +17 -0
  145. data/lib/ruby/kernel/safe_fork.rb +18 -0
  146. data/lib/ruby/range/stepped.rb +11 -0
  147. data/lib/ruby/string/arguments.rb +72 -0
  148. data/lib/ruby/string/chunks.rb +15 -0
  149. data/lib/ruby/string/post_arguments.rb +44 -0
  150. data/lib/ruby/string/unescaped.rb +17 -0
  151. data/lib/scheduler.rb +164 -0
  152. data/lib/scriptfile.rb +101 -0
  153. data/lib/templater.rb +86 -0
  154. data/test/cloptions.rb +134 -0
  155. data/test/cv.rb +28 -0
  156. data/test/irc/client.rb +85 -0
  157. data/test/irc/client_login.txt +53 -0
  158. data/test/irc/client_subscribe.txt +8 -0
  159. data/test/irc/message.rb +30 -0
  160. data/test/irc/messages.txt +64 -0
  161. data/test/irc/parser.rb +13 -0
  162. data/test/irc/profile_parser.rb +12 -0
  163. data/test/irc/users.rb +28 -0
  164. metadata +256 -0
@@ -0,0 +1,4 @@
1
+ = Butler2
2
+
3
+ === 7th Oct, 2007
4
+ * Initial release of Butler2. Butler 1.8.x series is the alpha series of Butler2.
data/GPL.txt ADDED
@@ -0,0 +1,340 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
5
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Library General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) 19yy <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License
307
+ along with this program; if not, write to the Free Software
308
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
309
+
310
+
311
+ Also add information on how to contact you by electronic and paper mail.
312
+
313
+ If the program is interactive, make it output a short notice like this
314
+ when it starts in an interactive mode:
315
+
316
+ Gnomovision version 69, Copyright (C) 19yy name of author
317
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
318
+ This is free software, and you are welcome to redistribute it
319
+ under certain conditions; type `show c' for details.
320
+
321
+ The hypothetical commands `show w' and `show c' should show the appropriate
322
+ parts of the General Public License. Of course, the commands you use may
323
+ be called something other than `show w' and `show c'; they could even be
324
+ mouse-clicks or menu items--whatever suits your program.
325
+
326
+ You should also get your employer (if you work as a programmer) or your
327
+ school, if any, to sign a "copyright disclaimer" for the program, if
328
+ necessary. Here is a sample; alter the names:
329
+
330
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
331
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
332
+
333
+ <signature of Ty Coon>, 1 April 1989
334
+ Ty Coon, President of Vice
335
+
336
+ This General Public License does not permit incorporating your program into
337
+ proprietary programs. If your program is a subroutine library, you may
338
+ consider it more useful to permit linking proprietary applications with the
339
+ library. If this is what you want to do, use the GNU Library General
340
+ Public License instead of this License.
@@ -0,0 +1,52 @@
1
+ Butler is copyrighted free software by Stefan Rusterholz. You can redistribute
2
+ it and/or modify it under either the terms of the GPL (see the GPL.txt file),
3
+ or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) rename any non-standard executables so the names do not conflict
21
+ with standard executables, which must also be provided.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or executable
26
+ form, provided that you do at least ONE of the following:
27
+
28
+ a) distribute the executables and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard executables non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial).
42
+
43
+ 5. The scripts and library files supplied as input to or produced as
44
+ output from the software do not automatically fall under the
45
+ copyright of the software, but belong to whomever generated them,
46
+ and may be sold commercially, and may be aggregated with this
47
+ software.
48
+
49
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
50
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
51
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
52
+ PURPOSE.
data/README ADDED
@@ -0,0 +1,37 @@
1
+ = README for Butler2
2
+
3
+ == Indexing
4
+ Author: Stefan Rusterholz <apeiros@gmx.net>
5
+ Version: 2.0.0
6
+ Website: http://butler.rubyforge.org
7
+
8
+ == About
9
+ Butler is an easy to use IRC bot, extensible via plugins, with a full
10
+ authorization system, a remote login server and thorough localization support.
11
+
12
+ == Installing
13
+ === Via RubyGems
14
+ gem install butler
15
+ sudo botcontrol setup
16
+
17
+ === From Tarball
18
+ Download the latest release from
19
+ cd butler2
20
+ sudo rake install
21
+
22
+ === Notes
23
+ The "botcontrol setup" creates the entries in the main config file that
24
+ is on most installations owned by root, which is why I put a "sudo" in
25
+ front of it.
26
+ Botcontrol setup is only required once per user.
27
+
28
+ == Synopsis
29
+ botcontrol create butler
30
+ botcontrol start butler
31
+ botcontrol stop butler
32
+ botcontrol list
33
+ botcontrol delete butler
34
+
35
+ == Links
36
+ * Butlers home: http://butler.rubyforge.org
37
+ * The project site: http://rubyforge.org/projects/butler
@@ -0,0 +1,334 @@
1
+ $LOAD_PATH.unshift("lib")
2
+
3
+ # This Rakefile makes use of some task taken from Hoe, a gem by Ryan Davis.
4
+
5
+ require 'ostructfixed'
6
+ require 'rubyforge'
7
+ require 'rubygems'
8
+ require 'rbconfig'
9
+ require 'rake'
10
+ require 'rake/clean'
11
+ require 'rake/testtask'
12
+ require 'rake/packagetask'
13
+ require 'rake/gempackagetask'
14
+ require 'rake/rdoctask'
15
+ require 'rake/contrib/rubyforgepublisher'
16
+ require 'fileutils'
17
+ require 'scriptfile'
18
+ require 'yaml'
19
+ require 'pp'
20
+
21
+ include FileUtils
22
+ require File.join(File.dirname(__FILE__), 'lib', 'butler', 'version')
23
+
24
+ RDOC_OPTS = [
25
+ '--quiet',
26
+ '--title', 'Butler library API',
27
+ '--main', 'README',
28
+ '--charset', 'utf-8',
29
+ '--inline-source',
30
+ '--tab-width', '2',
31
+ '--line-numbers',
32
+ ]
33
+ GEM_NAME = 'butler'
34
+ RUBYFORGE_PROJECT = 'butler' # The unix name for your project
35
+ RUBYFORGE_USERNAME = 'rstefan'
36
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org/"
37
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
38
+ NAME = "butler"
39
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
40
+ REV = nil
41
+ VERS = Butler::VERSION::STRING + (REV ? ".#{REV}" : "")
42
+ CLEAN.include [
43
+ '**/.*.sw?', '**/*.o', '*.gem', '.config',
44
+ '**/.DS_Store', '**/._*',
45
+ ]
46
+ PKG_FILES =
47
+ %w[CHANGELOG LICENSE.txt GPL.txt README Rakefile] +
48
+ %w[bin/botcontrol] +
49
+ Dir.glob("{data,conf,lib,test}/**/*")
50
+ LOCAL_PATHS = {}
51
+ LOCAL_PATHS['man'] = "#{Config::CONFIG['mandir']}/man1/botcontrol.1"
52
+ LOCAL_PATHS['share'] = "#{Config::CONFIG['datadir']}/botcontrol"
53
+ LOCAL_PATHS['config'] = "#{Config::CONFIG['sysconfdir']}/botcontrol"
54
+ LOCAL_PATHS['data'] = "#{Config::CONFIG['datadir']}/butler"
55
+ LOCAL_PATHS['bots'] = "#{LOCAL_PATHS['data']}/bots"
56
+ LOCAL_PATHS['backups'] = "#{LOCAL_PATHS['data']}/backups"
57
+ LOCAL_PATHS['strings'] = "#{LOCAL_PATHS['data']}/strings"
58
+ LOCAL_PATHS['plugins'] = "#{LOCAL_PATHS['data']}/plugins"
59
+ #LOCAL_PATHS['config'] = "#{Config::CONFIG['sysconfdir']}/butler"
60
+ LOCAL_PATHS['pids'] = "#{Config::CONFIG['localstatedir']}/run/butler"
61
+ CHANGES = "See CHANGELOG"
62
+ DESC = "Current alpha release of Butler"
63
+
64
+ GemSpec = Gem::Specification.new do |s|
65
+ s.homepage = HOMEPATH
66
+ s.name = GEM_NAME
67
+ s.version = VERS
68
+
69
+ s.author = "Stefan Rusterholz"
70
+ s.email = 'apeiros@gmx.net'
71
+
72
+ s.platform = Gem::Platform::RUBY
73
+ s.required_ruby_version = '>= 1.8.0'
74
+ s.has_rdoc = true
75
+ s.extra_rdoc_files = %w[README CHANGELOG GPL.txt LICENSE.txt]
76
+ s.summary = "Butler - the IRC bot with class"
77
+ s.description = s.summary
78
+ s.files = PKG_FILES
79
+ #s.require_paths = %w[lib]
80
+ s.rubyforge_project = RUBYFORGE_PROJECT
81
+ s.default_executable = "botcontrol"
82
+ s.bindir = "bin"
83
+ s.executables = "botcontrol"
84
+ s.rdoc_options += RDOC_OPTS
85
+ end
86
+
87
+ Rake::RDocTask.new do |rdoc|
88
+ rdoc.rdoc_dir = 'doc/rdoc'
89
+ rdoc.options += RDOC_OPTS
90
+ rdoc.main = "README"
91
+ rdoc.rdoc_files.add [
92
+ 'README',
93
+ 'CHANGELOG',
94
+ 'GPL.txt',
95
+ 'LICENSE.txt',
96
+ 'lib/**/*.rb'
97
+ ]
98
+ end
99
+
100
+ GemPackage = Rake::GemPackageTask.new(GemSpec) do |p|
101
+ p.need_tar = true
102
+ p.gem_spec = GemSpec
103
+ end
104
+
105
+ Rake::TestTask.new do |t|
106
+ t.libs << "test"
107
+ t.test_files = FileList['test/**/test_*.rb']
108
+ t.verbose = true
109
+ end
110
+
111
+ task :default => :install
112
+ desc "Default task, will install butler from tarball"
113
+
114
+ task :install do
115
+ path = OpenStruct.new(
116
+ :bin => Config::CONFIG["bindir"],
117
+ :lib => Config::CONFIG["sitedir"],
118
+ :etc => Config::CONFIG["sysconfdir"]+'/butler',
119
+ :data => Config::CONFIG["datadir"]+'/butler',
120
+ :man => Config::CONFIG["mandir"]+'/butler'
121
+ )
122
+ path.dialogs = path.data+'/dialogs'
123
+ path.plugins = path.data+'/plugins'
124
+ path.strings = path.data+'/strings'
125
+
126
+ install = [
127
+ ["src/bin/botcontrol", path.bin, "Installing Executable..."],
128
+ [Dir["src/lib/*"], path.lib, "Installing Library..."],
129
+ [Dir["src/data/butler/dialogs/*"], path.dialogs, "Installing Dialogs..."],
130
+ [Dir["src/data/butler/plugins/*"], path.plugins, "Installing Plugins..."],
131
+ [Dir["src/data/butler/strings/*"], path.strings, "Installing Strings..."],
132
+ [Dir["src/data/man/*"], path.man, "Installing Man page..."],
133
+ ]
134
+ replace = [
135
+ [path.lib+'/butler/control.rb', {
136
+ '%CONFIG_DIR%' => path.etc.inspect,
137
+ '%DIALOGS_DIR%' => path.dialogs.inspect,
138
+ '%PLUGINS_DIR%' => path.plugins.inspect,
139
+ '%STRINGS_DIR%' => path.strings.inspect,
140
+ }]
141
+ ]
142
+ config = {
143
+ :language => 'en',
144
+ :version => Butler::VERSION::STRING,
145
+ :users => {},
146
+ }
147
+
148
+ puts "Preparing installation..."
149
+ rm_r("src") if File.exist?("src")
150
+ package = Dir["./*"]
151
+ mkdir("src")
152
+ cp_r(package, "src")
153
+ Dir.glob("src/**/.*") { |remove|
154
+ next if remove =~ /\/\.?\.$/ or !File.exist?(remove)
155
+ rm_r(remove)
156
+ }
157
+
158
+ install.each { |source, target, info|
159
+ puts info
160
+ mkdir_p(target)
161
+ cp_r(source, target, :remove_destination => true)
162
+ }
163
+
164
+ replace.each { |file, replacements|
165
+ control = File.read(file)
166
+ control.gsub!(/^[^\n]*# DELETE.*?\n/, '')
167
+ control.gsub!(/^(\s*).*?# REPLACE: (.*)$/) {
168
+ replace_with = $1+$2
169
+ replace_with.gsub(/%[A-Z_]+%/) { |m| replacements[m] }
170
+ }
171
+ File.open(file, 'w') { |fh| fh.write(control) }
172
+ }
173
+
174
+ unless File.exist?(path.etc+'/config.yaml') then
175
+ mkdir_p(path.etc)
176
+ File.open(path.etc+'/config.yaml', 'w') { |fh| fh.write(config.to_yaml) }
177
+ end
178
+
179
+ puts "Done."
180
+ end
181
+ desc 'Install butler from tarball'
182
+
183
+ desc 'Release the website and new gem version'
184
+ task :deploy => [:check_version, :website, :release] do
185
+ puts "Remember to create SVN tag:"
186
+ puts "svn copy svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/trunk " +
187
+ "svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
188
+ puts "Suggested comment:"
189
+ puts "Tagging release #{CHANGES}"
190
+ end
191
+
192
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
193
+ task :local_deploy => [:install_gem_nodoc] # :clean_local,
194
+
195
+ desc 'Removing local files to allow a first-run'
196
+ task :local_clean do
197
+ LOCAL_PATHS.values_at('man', 'share', 'config').each { |path| #
198
+ sh "sudo rm -r #{path}" if File.exist?(path)
199
+ }
200
+ end
201
+
202
+ desc 'Install the package as a gem'
203
+ task :install_gem => [:clean, :package] do sh "sudo gem install pkg/*.gem" end
204
+
205
+ desc 'Install the package as a gem without rdoc'
206
+ task :install_gem_nodoc => [:clean, :package] do
207
+ sh "sudo gem install --no-rdoc --no-ri pkg/*.gem"
208
+ end
209
+
210
+ desc 'Generate plugins repository'
211
+ task :generate_plugin_repository do
212
+ fields = %w[PLUGIN REVISION VERSION AUTHOR DOWNLOAD SIZE]
213
+ descriptions = Hash.new { |h,k| h[k] = {} }
214
+ plugins = {}
215
+ rm_r("web/compiled/downloads/plugins") if File.exist?("web/compiled/downloads/plugins")
216
+ rm_r("web/compiled/repository/plugins") if File.exist?("web/compiled/repository/plugins")
217
+ mkdir_p("web/compiled/downloads/plugins")
218
+ mkdir_p("web/compiled/repository/plugins/descriptions")
219
+ Dir.glob("data/plugins/**/*.rb") { |plugin|
220
+ puts " - #{plugin}"
221
+ begin
222
+ yaml = YAML.load(ScriptFile.read(plugin))
223
+ rescue => e
224
+ puts e
225
+ puts "failed to read data of #{plugin}, ignoring"
226
+ next
227
+ end
228
+
229
+ unless yaml[:revision] && yaml[:revision][:plugin]
230
+ puts "plugin #{plugin} does not have a plugin-revision, ignoring"
231
+ next
232
+ end
233
+ unless yaml[:summary] && yaml[:summary]["en"]
234
+ puts "plugin #{plugin} does not have a summary, ignoring"
235
+ next
236
+ end
237
+
238
+ tbz = "web/compiled/downloads/plugins/#{plugin[13..-4]}.tgz"
239
+ mkdir_p(File.dirname(tbz))
240
+ begin
241
+ sh %{ tar -czf #{tbz} #{plugin} }
242
+ version = yaml[:about] && yaml[:about][:version]
243
+ version = version[0,16] if version
244
+ author = yaml[:about] && yaml[:about][:author]
245
+ author = author[0,64] if author
246
+ plugins[plugin] = {
247
+ :plugin => plugin.sub(/\.rb$/,''),
248
+ :revision => Integer(yaml[:revision][:plugin]),
249
+ :version => version,
250
+ :author => author,
251
+ :download => "/downloads/plugins/#{plugin}.tgz",
252
+ :size => File.size(tbz)
253
+ }
254
+ yaml[:summary].each { |k,v|
255
+ descriptions[k][plugin] = v[0,128]
256
+ }
257
+ rescue => e
258
+ puts e
259
+ puts "plugin #{plugin} had an error, ignoring"
260
+ plugins.delete(plugin)
261
+ descriptions.each_value { |v| v.delete(plugin) }
262
+ end
263
+ }
264
+ descriptions.reject! { |k,v| v.empty? }
265
+ File.open("web/compiled/repository/plugins/list.yaml", "w") { |fh|
266
+ fh.write(plugins.to_yaml)
267
+ }
268
+ descriptions.each { |k,v|
269
+ dir = "web/compiled/repository/plugins/"+k
270
+ mkdir(dir)
271
+ File.open(dir+"/summaries.yaml", "w") { |fh| fh.write(v.to_yaml) }
272
+ }
273
+ end
274
+
275
+ desc 'Generate website files'
276
+ task :website_generate do
277
+ cd "web" do
278
+ sh %{ ruby compile.rb }
279
+ end
280
+ end
281
+
282
+ # WARNING, this task is only intended for use on the authors system
283
+ task :update_plugins do
284
+ puts "This has been moved to botcontrol sync_plugins"
285
+ end
286
+
287
+ desc 'Upload website files to rubyforge'
288
+ task :website_upload do
289
+ host = "#{RUBYFORGE_USERNAME}@rubyforge.org"
290
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
291
+ local_dir = 'web/compiled'
292
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
293
+ end
294
+
295
+ desc 'Generate and upload website files'
296
+ #, :generate_plugin_repository
297
+ task :website => [:website_generate, :website_upload] # , :publish_docs
298
+
299
+ desc 'Package and upload the release to rubyforge.'
300
+ task :release => [:clean, :package] do |t|
301
+ pkg = "pkg/#{GEM_NAME}-#{VERS}"
302
+
303
+ #if $DEBUG then
304
+ # puts "release_id = rf.add_release #{RUBYFORGE_PROJECT.inspect}, #{GEM_NAME.inspect}, #{VERS.inspect}, \"#{pkg}.tgz\""
305
+ # puts "rf.add_file #{RUBYFORGE_PROJECT.inspect}, #{GEM_NAME.inspect}, release_id, \"#{pkg}.gem\""
306
+ #end
307
+
308
+ rf = RubyForge.new
309
+ puts "Logging in"
310
+ rf.login
311
+
312
+ c = rf.userconfig
313
+ c["release_notes"] = DESC if DESC
314
+ c["release_changes"] = CHANGES if CHANGES
315
+ c["preformatted"] = true
316
+
317
+ files = [(GemPackage.need_tar ? "#{pkg}.tgz" : nil),
318
+ (GemPackage.need_zip ? "#{pkg}.zip" : nil),
319
+ "#{pkg}.gem"].compact
320
+
321
+ puts "Releasing #{GEM_NAME} v. #{VERS}"
322
+ rf.add_release RUBYFORGE_PROJECT, GEM_NAME, "#{GEM_NAME} #{VERS}", *files
323
+ end
324
+
325
+ task :check_version do
326
+ unless ENV['VERSION']
327
+ puts 'Must pass a VERSION=x.y.z release version'
328
+ exit
329
+ end
330
+ unless ENV['VERSION'] == VERS
331
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
332
+ exit
333
+ end
334
+ end