gmcmillan-xmpp4r 0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (215) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +91 -0
  3. data/COPYING +340 -0
  4. data/LICENSE +59 -0
  5. data/README.rdoc +122 -0
  6. data/README_ruby19.txt +43 -0
  7. data/Rakefile +258 -0
  8. data/data/doc/xmpp4r/examples/advanced/adventure/README +56 -0
  9. data/data/doc/xmpp4r/examples/advanced/adventure/adventure.rb +23 -0
  10. data/data/doc/xmpp4r/examples/advanced/adventure/adventuremuc.rb +136 -0
  11. data/data/doc/xmpp4r/examples/advanced/adventure/cube.xml +15 -0
  12. data/data/doc/xmpp4r/examples/advanced/adventure/tower.xml +69 -0
  13. data/data/doc/xmpp4r/examples/advanced/adventure/world.rb +424 -0
  14. data/data/doc/xmpp4r/examples/advanced/fileserve.conf +11 -0
  15. data/data/doc/xmpp4r/examples/advanced/fileserve.rb +346 -0
  16. data/data/doc/xmpp4r/examples/advanced/getonline.rb +56 -0
  17. data/data/doc/xmpp4r/examples/advanced/gtkmucclient.rb +315 -0
  18. data/data/doc/xmpp4r/examples/advanced/migrate.rb +88 -0
  19. data/data/doc/xmpp4r/examples/advanced/minimuc.rb +266 -0
  20. data/data/doc/xmpp4r/examples/advanced/pep-aggregator/index.xsl +235 -0
  21. data/data/doc/xmpp4r/examples/advanced/pep-aggregator/pep-aggregator.rb +147 -0
  22. data/data/doc/xmpp4r/examples/advanced/recvfile.rb +85 -0
  23. data/data/doc/xmpp4r/examples/advanced/rosterdiscovery.rb +129 -0
  24. data/data/doc/xmpp4r/examples/advanced/sendfile.conf +10 -0
  25. data/data/doc/xmpp4r/examples/advanced/sendfile.rb +72 -0
  26. data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr.rb +51 -0
  27. data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_jabber.rb +43 -0
  28. data/data/doc/xmpp4r/examples/advanced/shellmgr/shellmgr_test.rb +10 -0
  29. data/data/doc/xmpp4r/examples/advanced/versionpoll.rb +109 -0
  30. data/data/doc/xmpp4r/examples/advanced/xmpping.rb +146 -0
  31. data/data/doc/xmpp4r/examples/advanced/xmppingrc.sample +14 -0
  32. data/data/doc/xmpp4r/examples/basic/change_password.rb +41 -0
  33. data/data/doc/xmpp4r/examples/basic/client.rb +70 -0
  34. data/data/doc/xmpp4r/examples/basic/component.rb +11 -0
  35. data/data/doc/xmpp4r/examples/basic/echo.rb +37 -0
  36. data/data/doc/xmpp4r/examples/basic/jabbersend.rb +41 -0
  37. data/data/doc/xmpp4r/examples/basic/mass_sender.rb +68 -0
  38. data/data/doc/xmpp4r/examples/basic/muc_owner_config.rb +12 -0
  39. data/data/doc/xmpp4r/examples/basic/mucinfo.rb +41 -0
  40. data/data/doc/xmpp4r/examples/basic/mucsimplebot.rb +82 -0
  41. data/data/doc/xmpp4r/examples/basic/register.rb +42 -0
  42. data/data/doc/xmpp4r/examples/basic/remove_registration.rb +18 -0
  43. data/data/doc/xmpp4r/examples/basic/roster.rb +44 -0
  44. data/data/doc/xmpp4r/examples/basic/rosterprint.rb +50 -0
  45. data/data/doc/xmpp4r/examples/basic/rosterrename.rb +34 -0
  46. data/data/doc/xmpp4r/examples/basic/rosterwatch.rb +171 -0
  47. data/data/doc/xmpp4r/examples/basic/send_vcard.rb +67 -0
  48. data/data/doc/xmpp4r/examples/basic/tune_client.rb +56 -0
  49. data/data/doc/xmpp4r/examples/basic/tune_server.rb +58 -0
  50. data/data/doc/xmpp4r/examples/basic/versionbot.rb +75 -0
  51. data/lib/xmpp4r.rb +118 -0
  52. data/lib/xmpp4r/base64.rb +32 -0
  53. data/lib/xmpp4r/bytestreams.rb +15 -0
  54. data/lib/xmpp4r/bytestreams/helper/filetransfer.rb +321 -0
  55. data/lib/xmpp4r/bytestreams/helper/ibb/base.rb +257 -0
  56. data/lib/xmpp4r/bytestreams/helper/ibb/initiator.rb +31 -0
  57. data/lib/xmpp4r/bytestreams/helper/ibb/target.rb +54 -0
  58. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/base.rb +153 -0
  59. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/initiator.rb +86 -0
  60. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/server.rb +198 -0
  61. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/socks5.rb +65 -0
  62. data/lib/xmpp4r/bytestreams/helper/socks5bytestreams/target.rb +82 -0
  63. data/lib/xmpp4r/bytestreams/iq/bytestreams.rb +170 -0
  64. data/lib/xmpp4r/bytestreams/iq/si.rb +206 -0
  65. data/lib/xmpp4r/callbacks.rb +133 -0
  66. data/lib/xmpp4r/caps.rb +1 -0
  67. data/lib/xmpp4r/caps/c.rb +67 -0
  68. data/lib/xmpp4r/caps/helper/generator.rb +160 -0
  69. data/lib/xmpp4r/caps/helper/helper.rb +84 -0
  70. data/lib/xmpp4r/client.rb +345 -0
  71. data/lib/xmpp4r/command/helper/responder.rb +53 -0
  72. data/lib/xmpp4r/command/iq/command.rb +154 -0
  73. data/lib/xmpp4r/component.rb +103 -0
  74. data/lib/xmpp4r/connection.rb +231 -0
  75. data/lib/xmpp4r/dataforms.rb +5 -0
  76. data/lib/xmpp4r/dataforms/x/data.rb +297 -0
  77. data/lib/xmpp4r/debuglog.rb +63 -0
  78. data/lib/xmpp4r/delay.rb +5 -0
  79. data/lib/xmpp4r/delay/x/delay.rb +99 -0
  80. data/lib/xmpp4r/discovery.rb +8 -0
  81. data/lib/xmpp4r/discovery/helper/helper.rb +58 -0
  82. data/lib/xmpp4r/discovery/helper/responder.rb +165 -0
  83. data/lib/xmpp4r/discovery/iq/discoinfo.rb +211 -0
  84. data/lib/xmpp4r/discovery/iq/discoitems.rb +147 -0
  85. data/lib/xmpp4r/entity_time.rb +6 -0
  86. data/lib/xmpp4r/entity_time/iq.rb +45 -0
  87. data/lib/xmpp4r/entity_time/responder.rb +57 -0
  88. data/lib/xmpp4r/errors.rb +284 -0
  89. data/lib/xmpp4r/feature_negotiation.rb +5 -0
  90. data/lib/xmpp4r/feature_negotiation/iq/feature.rb +28 -0
  91. data/lib/xmpp4r/framework/base.rb +55 -0
  92. data/lib/xmpp4r/framework/bot.rb +148 -0
  93. data/lib/xmpp4r/httpbinding.rb +5 -0
  94. data/lib/xmpp4r/httpbinding/client.rb +275 -0
  95. data/lib/xmpp4r/idgenerator.rb +37 -0
  96. data/lib/xmpp4r/iq.rb +221 -0
  97. data/lib/xmpp4r/jid.rb +167 -0
  98. data/lib/xmpp4r/last.rb +2 -0
  99. data/lib/xmpp4r/last/helper/helper.rb +37 -0
  100. data/lib/xmpp4r/last/iq/last.rb +67 -0
  101. data/lib/xmpp4r/location.rb +2 -0
  102. data/lib/xmpp4r/location/helper/helper.rb +56 -0
  103. data/lib/xmpp4r/location/location.rb +179 -0
  104. data/lib/xmpp4r/message.rb +226 -0
  105. data/lib/xmpp4r/muc.rb +14 -0
  106. data/lib/xmpp4r/muc/helper/mucbrowser.rb +92 -0
  107. data/lib/xmpp4r/muc/helper/mucclient.rb +469 -0
  108. data/lib/xmpp4r/muc/helper/simplemucclient.rb +332 -0
  109. data/lib/xmpp4r/muc/iq/mucadmin.rb +23 -0
  110. data/lib/xmpp4r/muc/iq/mucadminitem.rb +20 -0
  111. data/lib/xmpp4r/muc/iq/mucowner.rb +15 -0
  112. data/lib/xmpp4r/muc/item.rb +143 -0
  113. data/lib/xmpp4r/muc/x/muc.rb +70 -0
  114. data/lib/xmpp4r/muc/x/mucuserinvite.rb +60 -0
  115. data/lib/xmpp4r/muc/x/mucuseritem.rb +36 -0
  116. data/lib/xmpp4r/presence.rb +232 -0
  117. data/lib/xmpp4r/pubsub.rb +8 -0
  118. data/lib/xmpp4r/pubsub/children/configuration.rb +86 -0
  119. data/lib/xmpp4r/pubsub/children/event.rb +49 -0
  120. data/lib/xmpp4r/pubsub/children/item.rb +35 -0
  121. data/lib/xmpp4r/pubsub/children/items.rb +53 -0
  122. data/lib/xmpp4r/pubsub/children/node_config.rb +48 -0
  123. data/lib/xmpp4r/pubsub/children/publish.rb +38 -0
  124. data/lib/xmpp4r/pubsub/children/retract.rb +41 -0
  125. data/lib/xmpp4r/pubsub/children/subscription.rb +62 -0
  126. data/lib/xmpp4r/pubsub/children/subscription_config.rb +67 -0
  127. data/lib/xmpp4r/pubsub/children/unsubscribe.rb +63 -0
  128. data/lib/xmpp4r/pubsub/helper/nodebrowser.rb +129 -0
  129. data/lib/xmpp4r/pubsub/helper/nodehelper.rb +156 -0
  130. data/lib/xmpp4r/pubsub/helper/oauth_service_helper.rb +90 -0
  131. data/lib/xmpp4r/pubsub/helper/servicehelper.rb +490 -0
  132. data/lib/xmpp4r/pubsub/iq/pubsub.rb +19 -0
  133. data/lib/xmpp4r/query.rb +15 -0
  134. data/lib/xmpp4r/reliable.rb +168 -0
  135. data/lib/xmpp4r/rexmladdons.rb +197 -0
  136. data/lib/xmpp4r/roster.rb +7 -0
  137. data/lib/xmpp4r/roster/helper/roster.rb +532 -0
  138. data/lib/xmpp4r/roster/iq/roster.rb +215 -0
  139. data/lib/xmpp4r/roster/x/roster.rb +138 -0
  140. data/lib/xmpp4r/rpc.rb +2 -0
  141. data/lib/xmpp4r/rpc/helper/client.rb +123 -0
  142. data/lib/xmpp4r/rpc/helper/server.rb +74 -0
  143. data/lib/xmpp4r/rpc/helper/xmlrpcaddons.rb +67 -0
  144. data/lib/xmpp4r/rpc/iq/rpc.rb +23 -0
  145. data/lib/xmpp4r/sasl.rb +259 -0
  146. data/lib/xmpp4r/semaphore.rb +38 -0
  147. data/lib/xmpp4r/stream.rb +611 -0
  148. data/lib/xmpp4r/streamparser.rb +66 -0
  149. data/lib/xmpp4r/test/listener_mocker.rb +118 -0
  150. data/lib/xmpp4r/tune.rb +2 -0
  151. data/lib/xmpp4r/tune/helper/helper.rb +58 -0
  152. data/lib/xmpp4r/tune/tune.rb +113 -0
  153. data/lib/xmpp4r/vcard.rb +6 -0
  154. data/lib/xmpp4r/vcard/helper/vcard.rb +84 -0
  155. data/lib/xmpp4r/vcard/iq/vcard.rb +109 -0
  156. data/lib/xmpp4r/version.rb +7 -0
  157. data/lib/xmpp4r/version/helper/responder.rb +72 -0
  158. data/lib/xmpp4r/version/helper/simpleresponder.rb +44 -0
  159. data/lib/xmpp4r/version/iq/version.rb +105 -0
  160. data/lib/xmpp4r/x.rb +37 -0
  161. data/lib/xmpp4r/xhtml.rb +1 -0
  162. data/lib/xmpp4r/xhtml/html.rb +115 -0
  163. data/lib/xmpp4r/xmpp4r.rb +20 -0
  164. data/lib/xmpp4r/xmppelement.rb +168 -0
  165. data/lib/xmpp4r/xmppstanza.rb +162 -0
  166. data/setup.rb +1586 -0
  167. data/test/bytestreams/tc_ibb.rb +188 -0
  168. data/test/bytestreams/tc_socks5bytestreams.rb +114 -0
  169. data/test/caps/tc_helper.rb +158 -0
  170. data/test/dataforms/tc_data.rb +81 -0
  171. data/test/delay/tc_xdelay.rb +51 -0
  172. data/test/discovery/tc_responder.rb +91 -0
  173. data/test/entity_time/tc_responder.rb +65 -0
  174. data/test/last/tc_helper.rb +75 -0
  175. data/test/lib/assert_equal_xml.rb +14 -0
  176. data/test/lib/clienttester.rb +149 -0
  177. data/test/muc/tc_muc_mucclient.rb +834 -0
  178. data/test/muc/tc_muc_simplemucclient.rb +114 -0
  179. data/test/muc/tc_mucowner.rb +50 -0
  180. data/test/pubsub/tc_helper.rb +785 -0
  181. data/test/pubsub/tc_nodeconfig.rb +61 -0
  182. data/test/pubsub/tc_subscriptionconfig.rb +41 -0
  183. data/test/roster/tc_helper.rb +523 -0
  184. data/test/roster/tc_iqqueryroster.rb +173 -0
  185. data/test/roster/tc_xroster.rb +73 -0
  186. data/test/rpc/tc_helper.rb +96 -0
  187. data/test/tc_callbacks.rb +129 -0
  188. data/test/tc_class_names.rb +146 -0
  189. data/test/tc_client.rb +30 -0
  190. data/test/tc_errors.rb +146 -0
  191. data/test/tc_idgenerator.rb +30 -0
  192. data/test/tc_iq.rb +113 -0
  193. data/test/tc_iqquery.rb +31 -0
  194. data/test/tc_jid.rb +204 -0
  195. data/test/tc_presence.rb +150 -0
  196. data/test/tc_rexml.rb +139 -0
  197. data/test/tc_stream.rb +193 -0
  198. data/test/tc_streamComponent.rb +105 -0
  199. data/test/tc_streamError.rb +129 -0
  200. data/test/tc_streamSend.rb +59 -0
  201. data/test/tc_streamparser.rb +137 -0
  202. data/test/tc_xmppstanza.rb +135 -0
  203. data/test/ts_xmpp4r.rb +44 -0
  204. data/test/tune/tc_helper_recv.rb +82 -0
  205. data/test/tune/tc_helper_send.rb +74 -0
  206. data/test/tune/tc_tune.rb +79 -0
  207. data/test/vcard/tc_helper.rb +49 -0
  208. data/test/vcard/tc_iqvcard.rb +62 -0
  209. data/test/version/tc_helper.rb +60 -0
  210. data/test/version/tc_iqqueryversion.rb +97 -0
  211. data/test/xhtml/tc_html.rb +41 -0
  212. data/tools/gen_requires.bash +31 -0
  213. data/tools/xmpp4r-gemspec-test.rb +11 -0
  214. data/xmpp4r.gemspec +249 -0
  215. metadata +299 -0
@@ -0,0 +1,122 @@
1
+ = XMPP4R
2
+
3
+ == whitehat101 notes
4
+
5
+ lib/xmpp4r/stream.rb:82 -- IO::WaitReadable is not in ruby 1.8.7
6
+
7
+ WIP dependencys
8
+ * rake
9
+ * nokogiri
10
+ * rdoc
11
+
12
+ == Project Home
13
+
14
+ You can find info about the xmpp4r project and how to contribute
15
+ at the project home page:
16
+
17
+ http://home.gna.org/xmpp4r/
18
+
19
+ If you need to ask questions, or want feedback on proposed changes
20
+ please feel free to ask them on the 'xmpp4r-devel@gna.org' mailing
21
+ list. You can join or view archives of the mailing list at:
22
+
23
+ https://gna.org/mail/?group=xmpp4r
24
+
25
+ If you are having a problem and would like to report it
26
+ to the mailing list please include a protocol dump
27
+ which can be enabled in your code with:
28
+
29
+ Jabber::debug = true
30
+
31
+
32
+ == Contributors
33
+
34
+ Lucas Nussbaum <lucas@lucas-nussbaum.net>
35
+ Stephan Maka <stephan@spaceboyz.net>
36
+ Kirill A. Shutemov <k.shutemov@gmail.com>
37
+ Glenn Rempe <glenn@rempe.us>
38
+ Jacob Burkhart <jacob@brontes3d.com>
39
+ Yuki Mitsui
40
+ Peter Schrammel
41
+ Olli
42
+ Vojtech Vobr
43
+ Andreas Wiese
44
+ Chris Zelenak
45
+ Matthew Wood
46
+ Sam Ruby
47
+ Tim Carey-Smith
48
+ Scott Lillibridge
49
+ Joshua Sierles
50
+ Ripta Pasay <github@r8y.org>
51
+ Seth Fitzsimmons
52
+
53
+
54
+ == Source Code
55
+
56
+ The source for xmpp4r is managed using the Git SCM and can be
57
+ found in our GitHub.com project page:
58
+
59
+ http://github.com/ln/xmpp4r/tree/master
60
+
61
+
62
+ == Installation
63
+
64
+ There are a number of ways that you can install xmpp4r depending
65
+ on your needs and the methods you prefer.
66
+
67
+ === Install over the network using RubyGems
68
+
69
+ You can install the current release of the xmpp4r library from a stable
70
+ release gem on RubyForge using RubyGems:
71
+
72
+ sudo gem install xmpp4r
73
+
74
+ === Install over the network using a Debian package
75
+
76
+ You can install the current release of the xmpp4r library from a stable release copy
77
+ on your .deb friendly linux system (e.g. Debian or Ubuntu) using apt:
78
+
79
+ sudo apt-get install libxmpp4r-ruby
80
+
81
+ === Install from local source code (Developers Only)
82
+
83
+ If you have a local Git clone of the source repository or a tarball
84
+ you can install xmpp4r using several methods. First you'll
85
+ need to get a local copy.
86
+
87
+ Clone the Git repository (recommended):
88
+
89
+ git clone git://github.com/ln/xmpp4r.git
90
+
91
+ OR download a stable release tarball from:
92
+
93
+ http://download.gna.org/xmpp4r/xmpp4r-0.3.2.tgz
94
+
95
+ OR download a snapshot of the latest source in .tar.gz format from:
96
+
97
+ http://github.com/ln/xmpp4r/tarball/master
98
+
99
+ ==== Install : Using Rake
100
+
101
+ # Show all available rake tasks
102
+ cd xmpp4r/
103
+ rake -T
104
+
105
+ # Package up the gem file and install it
106
+ rake gem:install
107
+
108
+ ==== Install : Using setup.rb
109
+
110
+ This will install a copy of the library in your Ruby path and does not
111
+ require RubyGems to be installed.
112
+
113
+ cd xmpp4r/
114
+ ./setup.rb
115
+
116
+
117
+ == License
118
+
119
+ XMPP4R is released under the Ruby license (see the LICENSE file), which is
120
+ compatible with the GNU GPL (see the COPYING file) via an explicit
121
+ dual-licensing clause.
122
+
@@ -0,0 +1,43 @@
1
+ Ruby 1.9 is a development release in anticipation of Ruby 2.0, which has
2
+ overall better performance, real threading, and character encoding support.
3
+ Note: Ruby 1.9 is a development release, meaning that everything is
4
+ subject to change without prior notice. Among other things, this means
5
+ that xmpp4r could stop working on Ruby 1.9 at any time.
6
+
7
+ This version of xmpp4r has made a number of internal changes (nothing visible
8
+ at the API) to remove depency on deprecated Ruby Kernel APIs, support the new
9
+ encoding APIs, etc.
10
+
11
+ At the present time, all tests pass except tc_helper.rb and tc_stream.rb.
12
+ These tests themselves make assumptions about timinings of events,
13
+ assumptions that are not guaranteed with true multi-tasking. Initial
14
+ analysis indicates that xmpp4r is operating correctly, it is the tests
15
+ themselves that need to be corrected, but this could turn out to be
16
+ incorrect.
17
+
18
+ The executing of these two tests are disabled by a check in ts_xmpp4r.rb,
19
+ which is marked as a TODO.
20
+
21
+ A specific example: test_bidi in test/tc_stream.rb defines two threads,
22
+ one pumps out requests, the other echoes them. The receiver then verifies
23
+ that it gets back what it sent. With Ruby 1.8, these threads tend to
24
+ alternate in lock step, and the test usually passes. What happens in Ruby 1.9
25
+ is that the first thread waits for a message, and the second one creates a
26
+ callback block, generates a message, and then proceeds on to create a second
27
+ callback block -- even before the first message has been responded to.
28
+ The way xmpp4r works is that callbacks are saved on a pushdown stack.
29
+
30
+ The net result is that the first response typically is processed first by
31
+ the second callback, which decides that the ids don't match, and the test fails.
32
+
33
+ The way it is supposed to work is that the reply callback is supposed to
34
+ only process requests destined for it (and return true) and ignore
35
+ everything else (returning false).
36
+
37
+ This is but one test. Many of the tests in these two files are of this
38
+ nature.
39
+
40
+ The current status of the tests that are expected to pass on Ruby 1.9
41
+ can generally be found here:
42
+
43
+ http://intertwingly.net/projects/ruby19/logs/xmpp4r.html
@@ -0,0 +1,258 @@
1
+ require 'rake'
2
+ require 'rake/tasklib'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rdoc/task'
6
+
7
+ $:.unshift 'lib'
8
+ require "xmpp4r"
9
+
10
+ ##############################################################################
11
+ # OPTIONS
12
+ ##############################################################################
13
+
14
+ PKG_NAME = 'xmpp4r'
15
+ PKG_VERSION = Jabber::XMPP4R_VERSION
16
+ AUTHORS = ['Lucas Nussbaum', 'Stephan Maka', 'Glenn Rempe']
17
+ EMAIL = "xmpp4r-devel@gna.org"
18
+ HOMEPAGE = "http://home.gna.org/xmpp4r/"
19
+ SUMMARY = "XMPP4R is an XMPP/Jabber library for Ruby."
20
+
21
+ # These are the common rdoc options that are shared between generation of
22
+ # rdoc files using BOTH 'rake rdoc' and the installation by users of a
23
+ # RubyGem version which builds rdoc's along with its installation. Any
24
+ # rdoc options that are ONLY for developers running 'rake rdoc' should be
25
+ # added in the 'Rake::RDocTask' block below.
26
+ RDOC_OPTIONS = [
27
+ "--quiet",
28
+ "--title", SUMMARY,
29
+ "--opname", "index.html",
30
+ "--main", "lib/xmpp4r.rb",
31
+ "--line-numbers",
32
+ "--inline-source"
33
+ ]
34
+
35
+ # Extra files outside of the lib dir that should be included with the rdocs.
36
+ RDOC_FILES = (%w( README.rdoc README_ruby19.txt CHANGELOG LICENSE COPYING )).sort
37
+
38
+ # The full file list used for rdocs, tarballs, gems, and for generating the xmpp4r.gemspec.
39
+ PKG_FILES = (%w( Rakefile setup.rb xmpp4r.gemspec ) + RDOC_FILES + Dir["{lib,test,data,tools}/**/*"]).sort
40
+
41
+ ##############################################################################
42
+ # DEFAULT TASK
43
+ ##############################################################################
44
+
45
+ # The task that will run when a simple 'rake' command is issued.
46
+ # Default to running the test suite as that's a nice safe command
47
+ # we should run frequently.
48
+ task :default => [:test]
49
+
50
+ ##############################################################################
51
+ # TESTING TASKS
52
+ ##############################################################################
53
+
54
+ Rake::TestTask.new do |t|
55
+ t.libs << "test"
56
+ t.test_files = ['test/ts_xmpp4r.rb']
57
+ end
58
+
59
+ ##############################################################################
60
+ # DOCUMENTATION TASKS
61
+ ##############################################################################
62
+
63
+ # RDOC
64
+ #######
65
+ Rake::RDocTask.new do |rd|
66
+
67
+ # which dir should rdoc files be installed in?
68
+ rd.rdoc_dir = 'rdoc'
69
+
70
+ # the full list of files to be included
71
+ rd.rdoc_files.include(RDOC_FILES, "lib/**/*.rb")
72
+
73
+ # the full list of options that are common between gem build
74
+ # and 'rake rdoc' build of docs.
75
+ rd.options = RDOC_OPTIONS
76
+
77
+ # Devs Only : Uncomment to also document private methods in the rdocs
78
+ # Please don't check this change in to the source repo.
79
+ #rd.options << '--all'
80
+
81
+ # Devs Only : Uncomment to generate dot (graphviz) diagrams along with rdocs.
82
+ # This requires that graphiz (dot) be installed as a local binary and on your path.
83
+ # See : http://www.graphviz.org/
84
+ # Please don't check this change in to the source repo as it introduces a binary dependency.
85
+ #rd.options << '--diagram'
86
+ #rd.options << '--fileboxes'
87
+
88
+ end
89
+
90
+
91
+ # RCOV
92
+ #######
93
+
94
+ # Conditional require rcov/rcovtask if present
95
+ begin
96
+ require 'rcov/rcovtask'
97
+
98
+ Rcov::RcovTask.new do |t|
99
+ t.test_files = ['test/ts_xmpp4r.rb']
100
+ t.output_dir = "coverage"
101
+ end
102
+ rescue LoadError
103
+ end
104
+
105
+ # DOT GRAPH
106
+ ############
107
+ desc "Generate requires graph"
108
+ task :gen_requires_graph do
109
+ sh %{cd tools; ./gen_requires.bash}
110
+ end
111
+
112
+ # UPDATE WEBSITE (for Lucas only)
113
+ #################################
114
+ desc "Update website (for Lucas only)"
115
+ task :update_website do
116
+ sh %{cp website/* ~/dev/xmpp4r/website/ && cd ~/dev/xmpp4r/website/ && svn commit -m "website update"}
117
+ end
118
+
119
+
120
+ ##############################################################################
121
+ # SYNTAX CHECKING
122
+ ##############################################################################
123
+
124
+ desc "Check syntax of all Ruby files."
125
+ task :check_syntax do
126
+ `find . -name "*.rb" |xargs -n1 ruby -c |grep -v "Syntax OK"`
127
+ puts "* Done"
128
+ end
129
+
130
+ ##############################################################################
131
+ # PACKAGING & INSTALLATION
132
+ ##############################################################################
133
+
134
+ # What files/dirs should 'rake clean' remove?
135
+ CLEAN.include ["*.gem", "pkg", "rdoc", "coverage", "tools/*.png"]
136
+
137
+ begin
138
+ require 'rubygems/package_task'
139
+
140
+ spec = Gem::Specification.new do |s|
141
+ s.name = PKG_NAME
142
+ s.version = PKG_VERSION
143
+ s.authors = AUTHORS
144
+ s.email = EMAIL
145
+ s.homepage = HOMEPAGE
146
+ s.rubyforge_project = PKG_NAME
147
+ s.summary = SUMMARY
148
+ s.description = s.summary
149
+ s.platform = Gem::Platform::RUBY
150
+ s.require_path = 'lib'
151
+ s.executables = []
152
+ s.files = PKG_FILES
153
+ s.test_files = []
154
+ s.has_rdoc = true
155
+ s.extra_rdoc_files = RDOC_FILES
156
+ s.rdoc_options = RDOC_OPTIONS
157
+ s.required_ruby_version = ">= 1.8.4"
158
+
159
+ s.add_dependency 'nokogiri'
160
+ s.add_dependency 'rdoc', '>2.4.2'
161
+ s.add_dependency 'rake'
162
+ end
163
+
164
+ Gem::PackageTask.new(spec) do |pkg|
165
+ pkg.gem_spec = spec
166
+ pkg.need_tar = true
167
+ pkg.need_zip = true
168
+ end
169
+
170
+ namespace :gem do
171
+
172
+ desc "Run :package and install the .gem locally"
173
+ task :install => [:update_gemspec, :package] do
174
+ sh %{sudo gem install --local pkg/#{PKG_NAME}-#{PKG_VERSION}.gem}
175
+ end
176
+
177
+ desc "Like gem:install but without ri or rdocs"
178
+ task :install_fast => [:update_gemspec, :package] do
179
+ sh %{sudo gem install --local pkg/#{PKG_NAME}-#{PKG_VERSION}.gem --no-rdoc --no-ri}
180
+ end
181
+
182
+ desc "Run :clean and uninstall the .gem"
183
+ task :uninstall => :clean do
184
+ sh %{sudo gem uninstall #{PKG_NAME}}
185
+ end
186
+
187
+ # Thanks to the Merb project for this code.
188
+ desc "Update Github Gemspec"
189
+ task :update_gemspec do
190
+ skip_fields = %w(new_platform original_platform date)
191
+
192
+ result = "# WARNING : RAKE AUTO-GENERATED FILE. DO NOT MANUALLY EDIT!\n"
193
+ result << "# RUN : 'rake gem:update_gemspec'\n\n"
194
+ result << "Gem::Specification.new do |s|\n"
195
+ spec.instance_variables.sort.each do |ivar|
196
+ value = spec.instance_variable_get(ivar)
197
+ name = ivar.split("@").last
198
+ next if skip_fields.include?(name) || value.nil? || value == "" || (value.respond_to?(:empty?) && value.empty?)
199
+ if name == "dependencies"
200
+ value.each do |d|
201
+ dep, *ver = d.to_s.split(" ")
202
+ result << " s.add_dependency #{dep.inspect}, #{ver.join(" ").inspect.gsub(/[()]/, "")}\n"
203
+ end
204
+ else
205
+ case value
206
+ when Array
207
+ value = name != "files" ? value.inspect : value.sort.uniq.inspect.split(",").join(",\n")
208
+ when String, Fixnum, true, false
209
+ value = value.inspect
210
+ else
211
+ value = value.to_s.inspect
212
+ end
213
+ result << " s.#{name} = #{value}\n"
214
+ end
215
+ end
216
+ result << "end"
217
+ File.open(File.join(File.dirname(__FILE__), "#{spec.name}.gemspec"), "w"){|f| f << result}
218
+ end
219
+
220
+ end # namespace :gem
221
+
222
+ # also keep the gemspec up to date each time we package a tarball or gem
223
+ task :package => ['gem:update_gemspec']
224
+ task :gem => ['gem:update_gemspec']
225
+
226
+ rescue LoadError
227
+ raise
228
+ puts <<EOF
229
+ ###
230
+ Packaging Warning : RubyGems is apparently not installed on this
231
+ system and any file add/remove/rename will not
232
+ be auto-updated in the 'xmpp4r.gemspec' when you run any
233
+ package tasks. All such file changes are recommended
234
+ to be packaged on a system with RubyGems installed
235
+ if you intend to push commits to the Git repo so the
236
+ gemspec will also stay in sync for others.
237
+ ###
238
+ EOF
239
+ end
240
+
241
+ # we are apparently on a system that does not have RubyGems installed.
242
+ # Lets try to provide only the basic tarball package tasks as a fallback.
243
+ unless defined? Gem
244
+ begin
245
+ require 'rake/packagetask'
246
+ Rake::PackageTask.new(PKG_NAME, PKG_VERSION) do |p|
247
+ p.package_files = PKG_FILES
248
+ p.need_tar = true
249
+ p.need_zip = true
250
+ end
251
+ rescue LoadError
252
+ puts <<EOF
253
+ ###
254
+ Warning : Unable to require the 'rake/packagetask'. Is Rake installed?
255
+ ###
256
+ EOF
257
+ end
258
+ end
@@ -0,0 +1,56 @@
1
+ What is this?
2
+
3
+ This is an example of what you can do with XMPP4R. It is a conferencing
4
+ component in which you can walk around, travel to various places, look
5
+ at things and talk to other visitors on the same places. If you like
6
+ Multi-User Dungeons (MUDs) this is for you!
7
+
8
+ ---
9
+
10
+ How does it work?
11
+
12
+ The component loads a few worlds from a few XML files. Each world is a
13
+ component. Once joined the chat will tell you what you can do. Remember
14
+ that you can get a command listing anytime by saying '?'.
15
+
16
+ Reading 'You can go north, west' you may say 'go north' to go in the
17
+ northern direction and 'go west' to go in the western direction. You'll
18
+ then find yourself at some other place but still in the same MUC
19
+ conference. Your groupchat roster will change as you'll notice different
20
+ people and things that are just in the same place, not other places.
21
+
22
+ Before starting to hack the scripts you may want to take a look at
23
+ tower.xml. Note that users are <thing/>s, too and the whole world could
24
+ be serialized back to XML by just issuing "world.to_s".
25
+
26
+ Please note that the code, especially the error handling, is of extreme
27
+ poor quality and was mostly written in one afternoon. If I'm going to
28
+ develop this further everything should be rewritten...
29
+
30
+ ---
31
+
32
+ How to try?
33
+
34
+ Because this is a component you are going to need your own Jabber
35
+ Daemon - which you'll need anyways if you're going to experiment with
36
+ XMPP4R. ;-)
37
+
38
+ Syntax:
39
+ ./adventure.rb <JID> <Password> <Host>
40
+
41
+ Example:
42
+ ./adventure.rb mud.example.com geheimnis localhost
43
+
44
+ ---
45
+
46
+ Messages seem to have random order?
47
+
48
+ I don't know any solution for this. One may add short delays between
49
+ messages, but that would only be a very dirty hack.
50
+
51
+ RFC3920:
52
+
53
+ "10. Server Rules for Handling XML Stanzas
54
+
55
+ Compliant server implementations MUST ensure in-order processing of
56
+ XML stanzas between any two entities."