sidekick-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. data/.document +5 -0
  2. data/.gitignore +21 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +17 -0
  5. data/Rakefile +52 -0
  6. data/VERSION +1 -0
  7. data/lib/ext/README +1 -0
  8. data/lib/ext/bunny-0.6.0/LICENSE +20 -0
  9. data/lib/ext/bunny-0.6.0/README.rdoc +66 -0
  10. data/lib/ext/bunny-0.6.0/Rakefile +24 -0
  11. data/lib/ext/bunny-0.6.0/bunny.gemspec +65 -0
  12. data/lib/ext/bunny-0.6.0/examples/simple_08.rb +30 -0
  13. data/lib/ext/bunny-0.6.0/examples/simple_09.rb +30 -0
  14. data/lib/ext/bunny-0.6.0/examples/simple_ack_08.rb +33 -0
  15. data/lib/ext/bunny-0.6.0/examples/simple_ack_09.rb +33 -0
  16. data/lib/ext/bunny-0.6.0/examples/simple_consumer_08.rb +53 -0
  17. data/lib/ext/bunny-0.6.0/examples/simple_consumer_09.rb +53 -0
  18. data/lib/ext/bunny-0.6.0/examples/simple_fanout_08.rb +39 -0
  19. data/lib/ext/bunny-0.6.0/examples/simple_fanout_09.rb +39 -0
  20. data/lib/ext/bunny-0.6.0/examples/simple_headers_08.rb +40 -0
  21. data/lib/ext/bunny-0.6.0/examples/simple_headers_09.rb +40 -0
  22. data/lib/ext/bunny-0.6.0/examples/simple_publisher_08.rb +27 -0
  23. data/lib/ext/bunny-0.6.0/examples/simple_publisher_09.rb +27 -0
  24. data/lib/ext/bunny-0.6.0/examples/simple_topic_08.rb +59 -0
  25. data/lib/ext/bunny-0.6.0/examples/simple_topic_09.rb +59 -0
  26. data/lib/ext/bunny-0.6.0/lib/bunny/channel08.rb +39 -0
  27. data/lib/ext/bunny-0.6.0/lib/bunny/channel09.rb +39 -0
  28. data/lib/ext/bunny-0.6.0/lib/bunny/client08.rb +494 -0
  29. data/lib/ext/bunny-0.6.0/lib/bunny/client09.rb +460 -0
  30. data/lib/ext/bunny-0.6.0/lib/bunny/exchange08.rb +175 -0
  31. data/lib/ext/bunny-0.6.0/lib/bunny/exchange09.rb +177 -0
  32. data/lib/ext/bunny-0.6.0/lib/bunny/queue08.rb +389 -0
  33. data/lib/ext/bunny-0.6.0/lib/bunny/queue09.rb +395 -0
  34. data/lib/ext/bunny-0.6.0/lib/bunny/subscription08.rb +85 -0
  35. data/lib/ext/bunny-0.6.0/lib/bunny/subscription09.rb +85 -0
  36. data/lib/ext/bunny-0.6.0/lib/bunny.rb +87 -0
  37. data/lib/ext/bunny-0.6.0/lib/qrack/channel.rb +18 -0
  38. data/lib/ext/bunny-0.6.0/lib/qrack/client.rb +204 -0
  39. data/lib/ext/bunny-0.6.0/lib/qrack/protocol/protocol08.rb +132 -0
  40. data/lib/ext/bunny-0.6.0/lib/qrack/protocol/protocol09.rb +133 -0
  41. data/lib/ext/bunny-0.6.0/lib/qrack/protocol/spec08.rb +823 -0
  42. data/lib/ext/bunny-0.6.0/lib/qrack/protocol/spec09.rb +521 -0
  43. data/lib/ext/bunny-0.6.0/lib/qrack/qrack08.rb +23 -0
  44. data/lib/ext/bunny-0.6.0/lib/qrack/qrack09.rb +23 -0
  45. data/lib/ext/bunny-0.6.0/lib/qrack/queue.rb +53 -0
  46. data/lib/ext/bunny-0.6.0/lib/qrack/subscription.rb +102 -0
  47. data/lib/ext/bunny-0.6.0/lib/qrack/transport/buffer08.rb +276 -0
  48. data/lib/ext/bunny-0.6.0/lib/qrack/transport/buffer09.rb +276 -0
  49. data/lib/ext/bunny-0.6.0/lib/qrack/transport/frame08.rb +112 -0
  50. data/lib/ext/bunny-0.6.0/lib/qrack/transport/frame09.rb +94 -0
  51. data/lib/ext/bunny-0.6.0/spec/spec_08/bunny_spec.rb +65 -0
  52. data/lib/ext/bunny-0.6.0/spec/spec_08/connection_spec.rb +12 -0
  53. data/lib/ext/bunny-0.6.0/spec/spec_08/exchange_spec.rb +162 -0
  54. data/lib/ext/bunny-0.6.0/spec/spec_08/queue_spec.rb +206 -0
  55. data/lib/ext/bunny-0.6.0/spec/spec_09/bunny_spec.rb +65 -0
  56. data/lib/ext/bunny-0.6.0/spec/spec_09/connection_spec.rb +12 -0
  57. data/lib/ext/bunny-0.6.0/spec/spec_09/exchange_spec.rb +162 -0
  58. data/lib/ext/bunny-0.6.0/spec/spec_09/queue_spec.rb +205 -0
  59. data/lib/ext/eventmachine-0.12.10/.gitignore +14 -0
  60. data/lib/ext/eventmachine-0.12.10/README +82 -0
  61. data/lib/ext/eventmachine-0.12.10/Rakefile +374 -0
  62. data/lib/ext/eventmachine-0.12.10/docs/COPYING +60 -0
  63. data/lib/ext/eventmachine-0.12.10/docs/ChangeLog +211 -0
  64. data/lib/ext/eventmachine-0.12.10/docs/DEFERRABLES +133 -0
  65. data/lib/ext/eventmachine-0.12.10/docs/EPOLL +141 -0
  66. data/lib/ext/eventmachine-0.12.10/docs/GNU +281 -0
  67. data/lib/ext/eventmachine-0.12.10/docs/INSTALL +13 -0
  68. data/lib/ext/eventmachine-0.12.10/docs/KEYBOARD +38 -0
  69. data/lib/ext/eventmachine-0.12.10/docs/LEGAL +25 -0
  70. data/lib/ext/eventmachine-0.12.10/docs/LIGHTWEIGHT_CONCURRENCY +70 -0
  71. data/lib/ext/eventmachine-0.12.10/docs/PURE_RUBY +75 -0
  72. data/lib/ext/eventmachine-0.12.10/docs/RELEASE_NOTES +94 -0
  73. data/lib/ext/eventmachine-0.12.10/docs/SMTP +2 -0
  74. data/lib/ext/eventmachine-0.12.10/docs/SPAWNED_PROCESSES +89 -0
  75. data/lib/ext/eventmachine-0.12.10/docs/TODO +8 -0
  76. data/lib/ext/eventmachine-0.12.10/eventmachine.gemspec +40 -0
  77. data/lib/ext/eventmachine-0.12.10/examples/ex_channel.rb +43 -0
  78. data/lib/ext/eventmachine-0.12.10/examples/ex_queue.rb +2 -0
  79. data/lib/ext/eventmachine-0.12.10/examples/helper.rb +2 -0
  80. data/lib/ext/eventmachine-0.12.10/ext/binder.cpp +125 -0
  81. data/lib/ext/eventmachine-0.12.10/ext/binder.h +46 -0
  82. data/lib/ext/eventmachine-0.12.10/ext/cmain.cpp +827 -0
  83. data/lib/ext/eventmachine-0.12.10/ext/cplusplus.cpp +202 -0
  84. data/lib/ext/eventmachine-0.12.10/ext/ed.cpp +1893 -0
  85. data/lib/ext/eventmachine-0.12.10/ext/ed.h +424 -0
  86. data/lib/ext/eventmachine-0.12.10/ext/em.cpp +2282 -0
  87. data/lib/ext/eventmachine-0.12.10/ext/em.h +232 -0
  88. data/lib/ext/eventmachine-0.12.10/ext/emwin.cpp +300 -0
  89. data/lib/ext/eventmachine-0.12.10/ext/emwin.h +94 -0
  90. data/lib/ext/eventmachine-0.12.10/ext/epoll.cpp +26 -0
  91. data/lib/ext/eventmachine-0.12.10/ext/epoll.h +25 -0
  92. data/lib/ext/eventmachine-0.12.10/ext/eventmachine.h +122 -0
  93. data/lib/ext/eventmachine-0.12.10/ext/eventmachine_cpp.h +96 -0
  94. data/lib/ext/eventmachine-0.12.10/ext/extconf.rb +148 -0
  95. data/lib/ext/eventmachine-0.12.10/ext/fastfilereader/extconf.rb +83 -0
  96. data/lib/ext/eventmachine-0.12.10/ext/fastfilereader/mapper.cpp +214 -0
  97. data/lib/ext/eventmachine-0.12.10/ext/fastfilereader/mapper.h +59 -0
  98. data/lib/ext/eventmachine-0.12.10/ext/fastfilereader/rubymain.cpp +127 -0
  99. data/lib/ext/eventmachine-0.12.10/ext/files.cpp +94 -0
  100. data/lib/ext/eventmachine-0.12.10/ext/files.h +65 -0
  101. data/lib/ext/eventmachine-0.12.10/ext/kb.cpp +81 -0
  102. data/lib/ext/eventmachine-0.12.10/ext/page.cpp +107 -0
  103. data/lib/ext/eventmachine-0.12.10/ext/page.h +51 -0
  104. data/lib/ext/eventmachine-0.12.10/ext/pipe.cpp +349 -0
  105. data/lib/ext/eventmachine-0.12.10/ext/project.h +151 -0
  106. data/lib/ext/eventmachine-0.12.10/ext/rubymain.cpp +1166 -0
  107. data/lib/ext/eventmachine-0.12.10/ext/sigs.cpp +89 -0
  108. data/lib/ext/eventmachine-0.12.10/ext/sigs.h +32 -0
  109. data/lib/ext/eventmachine-0.12.10/ext/ssl.cpp +460 -0
  110. data/lib/ext/eventmachine-0.12.10/ext/ssl.h +94 -0
  111. data/lib/ext/eventmachine-0.12.10/java/.classpath +8 -0
  112. data/lib/ext/eventmachine-0.12.10/java/.project +17 -0
  113. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EmReactor.java +570 -0
  114. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EmReactorException.java +40 -0
  115. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EventableChannel.java +69 -0
  116. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EventableDatagramChannel.java +189 -0
  117. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EventableSocketChannel.java +364 -0
  118. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/Application.java +194 -0
  119. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/Connection.java +74 -0
  120. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/ConnectionFactory.java +37 -0
  121. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/DefaultConnectionFactory.java +46 -0
  122. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/PeriodicTimer.java +38 -0
  123. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/Timer.java +54 -0
  124. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/ApplicationTest.java +109 -0
  125. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/ConnectTest.java +148 -0
  126. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/EMTest.java +80 -0
  127. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/TestDatagrams.java +53 -0
  128. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/TestServers.java +75 -0
  129. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/TestTimers.java +90 -0
  130. data/lib/ext/eventmachine-0.12.10/lib/em/buftok.rb +138 -0
  131. data/lib/ext/eventmachine-0.12.10/lib/em/callback.rb +26 -0
  132. data/lib/ext/eventmachine-0.12.10/lib/em/channel.rb +57 -0
  133. data/lib/ext/eventmachine-0.12.10/lib/em/connection.rb +564 -0
  134. data/lib/ext/eventmachine-0.12.10/lib/em/deferrable.rb +192 -0
  135. data/lib/ext/eventmachine-0.12.10/lib/em/file_watch.rb +54 -0
  136. data/lib/ext/eventmachine-0.12.10/lib/em/future.rb +61 -0
  137. data/lib/ext/eventmachine-0.12.10/lib/em/messages.rb +66 -0
  138. data/lib/ext/eventmachine-0.12.10/lib/em/process_watch.rb +44 -0
  139. data/lib/ext/eventmachine-0.12.10/lib/em/processes.rb +119 -0
  140. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/header_and_content.rb +138 -0
  141. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/httpclient.rb +263 -0
  142. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/httpclient2.rb +590 -0
  143. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/line_and_text.rb +125 -0
  144. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/linetext2.rb +161 -0
  145. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/memcache.rb +323 -0
  146. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/object_protocol.rb +45 -0
  147. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/postgres3.rb +247 -0
  148. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/saslauth.rb +175 -0
  149. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/smtpclient.rb +357 -0
  150. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/smtpserver.rb +547 -0
  151. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/socks4.rb +66 -0
  152. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/stomp.rb +200 -0
  153. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/tcptest.rb +53 -0
  154. data/lib/ext/eventmachine-0.12.10/lib/em/protocols.rb +36 -0
  155. data/lib/ext/eventmachine-0.12.10/lib/em/queue.rb +61 -0
  156. data/lib/ext/eventmachine-0.12.10/lib/em/spawnable.rb +85 -0
  157. data/lib/ext/eventmachine-0.12.10/lib/em/streamer.rb +130 -0
  158. data/lib/ext/eventmachine-0.12.10/lib/em/timers.rb +56 -0
  159. data/lib/ext/eventmachine-0.12.10/lib/em/version.rb +3 -0
  160. data/lib/ext/eventmachine-0.12.10/lib/eventmachine.rb +1592 -0
  161. data/lib/ext/eventmachine-0.12.10/lib/evma/callback.rb +32 -0
  162. data/lib/ext/eventmachine-0.12.10/lib/evma/container.rb +75 -0
  163. data/lib/ext/eventmachine-0.12.10/lib/evma/factory.rb +77 -0
  164. data/lib/ext/eventmachine-0.12.10/lib/evma/protocol.rb +87 -0
  165. data/lib/ext/eventmachine-0.12.10/lib/evma/reactor.rb +48 -0
  166. data/lib/ext/eventmachine-0.12.10/lib/evma.rb +32 -0
  167. data/lib/ext/eventmachine-0.12.10/lib/jeventmachine.rb +257 -0
  168. data/lib/ext/eventmachine-0.12.10/lib/pr_eventmachine.rb +1022 -0
  169. data/lib/ext/eventmachine-0.12.10/setup.rb +1585 -0
  170. data/lib/ext/eventmachine-0.12.10/tasks/cpp.rake_example +77 -0
  171. data/lib/ext/eventmachine-0.12.10/tests/client.crt +31 -0
  172. data/lib/ext/eventmachine-0.12.10/tests/client.key +51 -0
  173. data/lib/ext/eventmachine-0.12.10/tests/test_attach.rb +126 -0
  174. data/lib/ext/eventmachine-0.12.10/tests/test_basic.rb +284 -0
  175. data/lib/ext/eventmachine-0.12.10/tests/test_channel.rb +63 -0
  176. data/lib/ext/eventmachine-0.12.10/tests/test_connection_count.rb +35 -0
  177. data/lib/ext/eventmachine-0.12.10/tests/test_defer.rb +47 -0
  178. data/lib/ext/eventmachine-0.12.10/tests/test_epoll.rb +160 -0
  179. data/lib/ext/eventmachine-0.12.10/tests/test_error_handler.rb +35 -0
  180. data/lib/ext/eventmachine-0.12.10/tests/test_errors.rb +82 -0
  181. data/lib/ext/eventmachine-0.12.10/tests/test_exc.rb +55 -0
  182. data/lib/ext/eventmachine-0.12.10/tests/test_file_watch.rb +49 -0
  183. data/lib/ext/eventmachine-0.12.10/tests/test_futures.rb +198 -0
  184. data/lib/ext/eventmachine-0.12.10/tests/test_get_sock_opt.rb +30 -0
  185. data/lib/ext/eventmachine-0.12.10/tests/test_handler_check.rb +37 -0
  186. data/lib/ext/eventmachine-0.12.10/tests/test_hc.rb +218 -0
  187. data/lib/ext/eventmachine-0.12.10/tests/test_httpclient.rb +218 -0
  188. data/lib/ext/eventmachine-0.12.10/tests/test_httpclient2.rb +153 -0
  189. data/lib/ext/eventmachine-0.12.10/tests/test_inactivity_timeout.rb +50 -0
  190. data/lib/ext/eventmachine-0.12.10/tests/test_kb.rb +60 -0
  191. data/lib/ext/eventmachine-0.12.10/tests/test_ltp.rb +182 -0
  192. data/lib/ext/eventmachine-0.12.10/tests/test_ltp2.rb +317 -0
  193. data/lib/ext/eventmachine-0.12.10/tests/test_next_tick.rb +133 -0
  194. data/lib/ext/eventmachine-0.12.10/tests/test_object_protocol.rb +37 -0
  195. data/lib/ext/eventmachine-0.12.10/tests/test_pause.rb +70 -0
  196. data/lib/ext/eventmachine-0.12.10/tests/test_pending_connect_timeout.rb +48 -0
  197. data/lib/ext/eventmachine-0.12.10/tests/test_process_watch.rb +48 -0
  198. data/lib/ext/eventmachine-0.12.10/tests/test_processes.rb +128 -0
  199. data/lib/ext/eventmachine-0.12.10/tests/test_proxy_connection.rb +92 -0
  200. data/lib/ext/eventmachine-0.12.10/tests/test_pure.rb +125 -0
  201. data/lib/ext/eventmachine-0.12.10/tests/test_queue.rb +44 -0
  202. data/lib/ext/eventmachine-0.12.10/tests/test_running.rb +42 -0
  203. data/lib/ext/eventmachine-0.12.10/tests/test_sasl.rb +72 -0
  204. data/lib/ext/eventmachine-0.12.10/tests/test_send_file.rb +242 -0
  205. data/lib/ext/eventmachine-0.12.10/tests/test_servers.rb +76 -0
  206. data/lib/ext/eventmachine-0.12.10/tests/test_smtpclient.rb +83 -0
  207. data/lib/ext/eventmachine-0.12.10/tests/test_smtpserver.rb +85 -0
  208. data/lib/ext/eventmachine-0.12.10/tests/test_spawn.rb +322 -0
  209. data/lib/ext/eventmachine-0.12.10/tests/test_ssl_args.rb +79 -0
  210. data/lib/ext/eventmachine-0.12.10/tests/test_ssl_methods.rb +50 -0
  211. data/lib/ext/eventmachine-0.12.10/tests/test_ssl_verify.rb +82 -0
  212. data/lib/ext/eventmachine-0.12.10/tests/test_timers.rb +162 -0
  213. data/lib/ext/eventmachine-0.12.10/tests/test_ud.rb +36 -0
  214. data/lib/ext/eventmachine-0.12.10/tests/testem.rb +31 -0
  215. data/lib/ext/eventmachine-0.12.10/web/whatis +7 -0
  216. data/lib/ext/misc/README +1 -0
  217. data/lib/ext/misc/indifferent_access.rb +131 -0
  218. data/lib/ext/uuidtools-2.1.1/CHANGELOG +56 -0
  219. data/lib/ext/uuidtools-2.1.1/LICENSE +20 -0
  220. data/lib/ext/uuidtools-2.1.1/README +13 -0
  221. data/lib/ext/uuidtools-2.1.1/Rakefile +48 -0
  222. data/lib/ext/uuidtools-2.1.1/lib/compat/securerandom.rb +202 -0
  223. data/lib/ext/uuidtools-2.1.1/lib/uuidtools/version.rb +35 -0
  224. data/lib/ext/uuidtools-2.1.1/lib/uuidtools.rb +618 -0
  225. data/lib/ext/uuidtools-2.1.1/spec/spec.opts +1 -0
  226. data/lib/ext/uuidtools-2.1.1/spec/spec_helper.rb +7 -0
  227. data/lib/ext/uuidtools-2.1.1/spec/uuidtools/mac_address_spec.rb +15 -0
  228. data/lib/ext/uuidtools-2.1.1/spec/uuidtools/utility_spec.rb +21 -0
  229. data/lib/ext/uuidtools-2.1.1/spec/uuidtools/uuid_creation_spec.rb +121 -0
  230. data/lib/ext/uuidtools-2.1.1/spec/uuidtools/uuid_parsing_spec.rb +127 -0
  231. data/lib/ext/uuidtools-2.1.1/tasks/benchmark.rake +38 -0
  232. data/lib/ext/uuidtools-2.1.1/tasks/clobber.rake +2 -0
  233. data/lib/ext/uuidtools-2.1.1/tasks/gem.rake +68 -0
  234. data/lib/ext/uuidtools-2.1.1/tasks/git.rake +40 -0
  235. data/lib/ext/uuidtools-2.1.1/tasks/metrics.rake +22 -0
  236. data/lib/ext/uuidtools-2.1.1/tasks/rdoc.rake +29 -0
  237. data/lib/ext/uuidtools-2.1.1/tasks/rubyforge.rake +89 -0
  238. data/lib/ext/uuidtools-2.1.1/tasks/spec.rake +64 -0
  239. data/lib/ext/uuidtools-2.1.1/website/index.html +95 -0
  240. data/lib/sidekick/client/sidekick_client.rb +46 -0
  241. data/lib/sidekick/shared/sidekick_logger.rb +14 -0
  242. data/lib/sidekick/shared/sidekick_queue_publisher.rb +91 -0
  243. data/lib/sidekick-client.rb +7 -0
  244. data/sidekick-client.gemspec +289 -0
  245. data/test/helper.rb +10 -0
  246. data/test/test_sidekick-client.rb +7 -0
  247. metadata +311 -0
@@ -0,0 +1,7 @@
1
+ EventMachine is a library for Ruby, C++, and Java programs. It provides event-driven I/O using the Reactor pattern.
2
+
3
+ EventMachine is designed to simultaneously meet two key needs:
4
+ - Extremely high scalability, performance and stability for the most demanding production environments; and
5
+ - An API that <i>eliminates</i> the complexities of high-performance threaded network programming, allowing engineers to concentrate on their application logic.
6
+
7
+ This unique combination makes EventMachine a premier choice for designers of critical networked applications, including web servers and proxies, email and IM production systems, authentication/authorization processors, and many more.
@@ -0,0 +1 @@
1
+ Miscellaneous libraries, non-gems, etc, go here
@@ -0,0 +1,131 @@
1
+ # This class has dubious semantics and we only have it so that
2
+ # people can write params[:key] instead of params['key']
3
+ # and they get the same value for both keys.
4
+
5
+ class HashWithIndifferentAccess < Hash
6
+ def initialize(constructor = {})
7
+ if constructor.is_a?(Hash)
8
+ super()
9
+ update(constructor)
10
+ else
11
+ super(constructor)
12
+ end
13
+ end
14
+
15
+ def default(key = nil)
16
+ if key.is_a?(Symbol) && include?(key = key.to_s)
17
+ self[key]
18
+ else
19
+ super
20
+ end
21
+ end
22
+
23
+ alias_method :regular_writer, :[]= unless method_defined?(:regular_writer)
24
+ alias_method :regular_update, :update unless method_defined?(:regular_update)
25
+
26
+ # Assigns a new value to the hash:
27
+ #
28
+ # hash = HashWithIndifferentAccess.new
29
+ # hash[:key] = "value"
30
+ #
31
+ def []=(key, value)
32
+ regular_writer(convert_key(key), convert_value(value))
33
+ end
34
+
35
+ # Updates the instantized hash with values from the second:
36
+ #
37
+ # hash_1 = HashWithIndifferentAccess.new
38
+ # hash_1[:key] = "value"
39
+ #
40
+ # hash_2 = HashWithIndifferentAccess.new
41
+ # hash_2[:key] = "New Value!"
42
+ #
43
+ # hash_1.update(hash_2) # => {"key"=>"New Value!"}
44
+ #
45
+ def update(other_hash)
46
+ other_hash.each_pair { |key, value| regular_writer(convert_key(key), convert_value(value)) }
47
+ self
48
+ end
49
+
50
+ alias_method :merge!, :update
51
+
52
+ # Checks the hash for a key matching the argument passed in:
53
+ #
54
+ # hash = HashWithIndifferentAccess.new
55
+ # hash["key"] = "value"
56
+ # hash.key? :key # => true
57
+ # hash.key? "key" # => true
58
+ #
59
+ def key?(key)
60
+ super(convert_key(key))
61
+ end
62
+
63
+ alias_method :include?, :key?
64
+ alias_method :has_key?, :key?
65
+ alias_method :member?, :key?
66
+
67
+ # Fetches the value for the specified key, same as doing hash[key]
68
+ def fetch(key, *extras)
69
+ super(convert_key(key), *extras)
70
+ end
71
+
72
+ # Returns an array of the values at the specified indices:
73
+ #
74
+ # hash = HashWithIndifferentAccess.new
75
+ # hash[:a] = "x"
76
+ # hash[:b] = "y"
77
+ # hash.values_at("a", "b") # => ["x", "y"]
78
+ #
79
+ def values_at(*indices)
80
+ indices.collect {|key| self[convert_key(key)]}
81
+ end
82
+
83
+ # Returns an exact copy of the hash.
84
+ def dup
85
+ HashWithIndifferentAccess.new(self)
86
+ end
87
+
88
+ # Merges the instantized and the specified hashes together, giving precedence to the values from the second hash
89
+ # Does not overwrite the existing hash.
90
+ def merge(hash)
91
+ self.dup.update(hash)
92
+ end
93
+
94
+ # Removes a specified key from the hash.
95
+ def delete(key)
96
+ super(convert_key(key))
97
+ end
98
+
99
+ def stringify_keys!; self end
100
+ def symbolize_keys!; self end
101
+ def to_options!; self end
102
+
103
+ # Convert to a Hash with String keys.
104
+ def to_hash
105
+ Hash.new(default).merge(self)
106
+ end
107
+
108
+ protected
109
+ def convert_key(key)
110
+ key.kind_of?(Symbol) ? key.to_s : key
111
+ end
112
+
113
+ def convert_value(value)
114
+ case value
115
+ when Hash
116
+ value.with_indifferent_access
117
+ when Array
118
+ value.collect { |e| e.is_a?(Hash) ? e.with_indifferent_access : e }
119
+ else
120
+ value
121
+ end
122
+ end
123
+ end
124
+
125
+ class Hash #:nodoc:
126
+ def with_indifferent_access
127
+ hash = HashWithIndifferentAccess.new(self)
128
+ hash.default = self.default
129
+ hash
130
+ end
131
+ end
@@ -0,0 +1,56 @@
1
+ == UUIDTools 2.1.1
2
+ * fixed issue with Ruby 1.9 compatibility
3
+ == UUIDTools 2.1.0
4
+ * completely reworked the MAC address detection code
5
+ * added additional parsing methods
6
+ == UUIDTools 2.0.0
7
+ * moved to its own module to avoid collisions
8
+ == UUIDTools 1.0.7
9
+ * fixed incompatible SecureRandom implementation
10
+ == UUIDTools 1.0.6
11
+ * fixed Bignum hash issue
12
+ * added implicit to_str cast
13
+ == UUIDTools 1.0.5
14
+ * improved specs
15
+ * fixed minor bugs
16
+ * better JRuby compatibility
17
+ * uses securerandom library
18
+ * updated rake tasks
19
+ == UUIDTools 1.0.4
20
+ * calculates random node id with multicast bit if there is no MAC address
21
+ * uses RSpec instead of Test::Unit
22
+ * works in Ruby 1.9
23
+ * cleaned up some code
24
+ * removed deprecated methods
25
+ * changed version constant
26
+ * new gem file structure
27
+ == UUIDTools 1.0.3
28
+ * improved code for obtaining a MAC address within JRuby
29
+ == UUIDTools 1.0.2
30
+ * improved code for obtaining a MAC address for Solaris and OpenBSD
31
+ * added hash and eql? methods
32
+ == UUIDTools 1.0.1
33
+ * improved code for obtaining a MAC address for Solaris and NetBSD
34
+ * MAC addresses can now be set manually
35
+ * replaced random number generator, less effective on Windows, but faster
36
+ * fixed inheritance issues
37
+ * changed UUID#to_uri method to return a string instead of a URI object
38
+ * removed UUID#to_uri_string
39
+ == UUIDTools 1.0.0
40
+ * slight improvements to the random number generator
41
+ * fixed issue with failing to obtain mac address in certain environments
42
+ == UUIDTools 0.1.4
43
+ * improved speed when generating timestamp-based uuids
44
+ * fixed bug with rapid generation of timestamp uuids leading to duplicates
45
+ * improved code for detection of mac address
46
+ == UUIDTools 0.1.3
47
+ * fixed issue with UUID#raw attempting to call protected class methods
48
+ == UUIDTools 0.1.2
49
+ * fixed variant method
50
+ * added valid? method
51
+ * changed timestamp_create method to allow creation of UUIDs from
52
+ arbitrary timestamps
53
+ == UUIDTools 0.1.1
54
+ * changed helper methods to be protected like they should have been
55
+ == UUIDTools 0.1.0
56
+ * parsing and generation of UUIDs implemented
@@ -0,0 +1,20 @@
1
+ UUIDTools, Copyright (c) 2005-2008 Bob Aman
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ UUIDTools was designed to be a simple library for generating any
2
+ of the various types of UUIDs. It conforms to RFC 4122 whenever
3
+ possible.
4
+
5
+ == Example
6
+ UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com")
7
+ => #<UUID:0x287576 UUID:3d813cbb-47fb-32ba-91df-831e1593ac29>
8
+ UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com")
9
+ => #<UUID:0x2a0116 UUID:21f7f8de-8051-5b89-8680-0195ef798b6a>
10
+ UUIDTools::UUID.timestamp_create
11
+ => #<UUID:0x2adfdc UUID:64a5189c-25b3-11da-a97b-00c04fd430c8>
12
+ UUIDTools::UUID.random_create
13
+ => #<UUID:0x19013a UUID:984265dc-4200-4f02-ae70-fe4f48964159>
@@ -0,0 +1,48 @@
1
+ lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "lib"))
2
+ $:.unshift(lib_dir)
3
+ $:.uniq!
4
+
5
+ require 'rubygems'
6
+ require 'rake'
7
+ require 'rake/testtask'
8
+ require 'rake/rdoctask'
9
+ require 'rake/packagetask'
10
+ require 'rake/gempackagetask'
11
+ require 'spec/rake/spectask'
12
+
13
+ require File.join(File.dirname(__FILE__), 'lib/uuidtools', 'version')
14
+
15
+ PKG_DISPLAY_NAME = 'UUIDTools'
16
+ PKG_NAME = PKG_DISPLAY_NAME.downcase
17
+ PKG_VERSION = UUID::VERSION::STRING
18
+ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
19
+
20
+ RELEASE_NAME = "REL #{PKG_VERSION}"
21
+
22
+ RUBY_FORGE_PROJECT = PKG_NAME
23
+ RUBY_FORGE_USER = "sporkmonger"
24
+ RUBY_FORGE_PATH = "/var/www/gforge-projects/#{RUBY_FORGE_PROJECT}"
25
+ RUBY_FORGE_URL = "http://#{RUBY_FORGE_PROJECT}.rubyforge.org/"
26
+
27
+ PKG_SUMMARY = "UUID generator"
28
+ PKG_DESCRIPTION = <<-TEXT
29
+ A simple universally unique ID generation library.
30
+ TEXT
31
+
32
+ PKG_FILES = FileList[
33
+ "lib/**/*", "spec/**/*", "vendor/**/*",
34
+ "tasks/**/*", "website/**/*",
35
+ "[A-Z]*", "Rakefile"
36
+ ].exclude(/database\.yml/).exclude(/[_\.]git$/)
37
+
38
+ RCOV_ENABLED = (RUBY_PLATFORM != "java" && RUBY_VERSION =~ /^1\.8/)
39
+ if RCOV_ENABLED
40
+ task :default => "spec:verify"
41
+ else
42
+ task :default => "spec"
43
+ end
44
+
45
+ WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false
46
+ SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS'])
47
+
48
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
@@ -0,0 +1,202 @@
1
+ # = Secure random number generator interface.
2
+ #
3
+ # This library is an interface for secure random number generator which is
4
+ # suitable for generating session key in HTTP cookies, etc.
5
+ #
6
+ # It supports following secure random number generators.
7
+ #
8
+ # * openssl
9
+ # * /dev/urandom
10
+ # * Win32
11
+ #
12
+ # == Example
13
+ #
14
+ # # random hexadecimal string.
15
+ # p SecureRandom.hex(10) #=> "52750b30ffbc7de3b362"
16
+ # p SecureRandom.hex(10) #=> "92b15d6c8dc4beb5f559"
17
+ # p SecureRandom.hex(11) #=> "6aca1b5c58e4863e6b81b8"
18
+ # p SecureRandom.hex(12) #=> "94b2fff3e7fd9b9c391a2306"
19
+ # p SecureRandom.hex(13) #=> "39b290146bea6ce975c37cfc23"
20
+ # ...
21
+ #
22
+ # # random base64 string.
23
+ # p SecureRandom.base64(10) #=> "EcmTPZwWRAozdA=="
24
+ # p SecureRandom.base64(10) #=> "9b0nsevdwNuM/w=="
25
+ # p SecureRandom.base64(10) #=> "KO1nIU+p9DKxGg=="
26
+ # p SecureRandom.base64(11) #=> "l7XEiFja+8EKEtY="
27
+ # p SecureRandom.base64(12) #=> "7kJSM/MzBJI+75j8"
28
+ # p SecureRandom.base64(13) #=> "vKLJ0tXBHqQOuIcSIg=="
29
+ # ...
30
+ #
31
+ # # random binary string.
32
+ # p SecureRandom.random_bytes(10) #=> "\016\t{\370g\310pbr\301"
33
+ # p SecureRandom.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337"
34
+ # ...
35
+
36
+ if !defined?(SecureRandom)
37
+ begin
38
+ require 'openssl'
39
+ rescue LoadError
40
+ end
41
+
42
+ module SecureRandom
43
+ # SecureRandom.random_bytes generates a random binary string.
44
+ #
45
+ # The argument n specifies the length of the result string.
46
+ #
47
+ # If n is not specified, 16 is assumed.
48
+ # It may be larger in future.
49
+ #
50
+ # If secure random number generator is not available,
51
+ # NotImplementedError is raised.
52
+ def self.random_bytes(n=nil)
53
+ n ||= 16
54
+
55
+ if defined? OpenSSL::Random
56
+ return OpenSSL::Random.random_bytes(n)
57
+ end
58
+
59
+ if !defined?(@has_urandom) || @has_urandom
60
+ flags = File::RDONLY
61
+ flags |= File::NONBLOCK if defined? File::NONBLOCK
62
+ flags |= File::NOCTTY if defined? File::NOCTTY
63
+ flags |= File::NOFOLLOW if defined? File::NOFOLLOW
64
+ begin
65
+ File.open("/dev/urandom", flags) {|f|
66
+ unless f.stat.chardev?
67
+ raise Errno::ENOENT
68
+ end
69
+ @has_urandom = true
70
+ ret = f.readpartial(n)
71
+ if ret.length != n
72
+ raise NotImplementedError,
73
+ "Unexpected partial read from random device"
74
+ end
75
+ return ret
76
+ }
77
+ rescue Errno::ENOENT
78
+ @has_urandom = false
79
+ end
80
+ end
81
+
82
+ if !defined?(@has_win32)
83
+ begin
84
+ require 'Win32API'
85
+
86
+ crypt_acquire_context = Win32API.new(
87
+ "advapi32", "CryptAcquireContext", 'PPPII', 'L'
88
+ )
89
+ @crypt_gen_random = Win32API.new(
90
+ "advapi32", "CryptGenRandom", 'LIP', 'L'
91
+ )
92
+
93
+ hProvStr = " " * 4
94
+ prov_rsa_full = 1
95
+ crypt_verifycontext = 0xF0000000
96
+
97
+ if crypt_acquire_context.call(
98
+ hProvStr, nil, nil, prov_rsa_full, crypt_verifycontext) == 0
99
+ raise SystemCallError,
100
+ "CryptAcquireContext failed: #{lastWin32ErrorMessage}"
101
+ end
102
+ @hProv, = hProvStr.unpack('L')
103
+
104
+ @has_win32 = true
105
+ rescue LoadError
106
+ @has_win32 = false
107
+ end
108
+ end
109
+ if @has_win32
110
+ bytes = " " * n
111
+ if @crypt_gen_random.call(@hProv, bytes.size, bytes) == 0
112
+ raise SystemCallError,
113
+ "CryptGenRandom failed: #{lastWin32ErrorMessage}"
114
+ end
115
+ return bytes
116
+ end
117
+
118
+ raise NotImplementedError, "No random device"
119
+ end
120
+
121
+ # SecureRandom.hex generates a random hex string.
122
+ #
123
+ # The argument n specifies the length of the random length.
124
+ # The length of the result string is twice of n.
125
+ #
126
+ # If n is not specified, 16 is assumed.
127
+ # It may be larger in future.
128
+ #
129
+ # If secure random number generator is not available,
130
+ # NotImplementedError is raised.
131
+ def self.hex(n=nil)
132
+ random_bytes(n).unpack("H*")[0]
133
+ end
134
+
135
+ # SecureRandom.base64 generates a random base64 string.
136
+ #
137
+ # The argument n specifies the length of the random length.
138
+ # The length of the result string is about 4/3 of n.
139
+ #
140
+ # If n is not specified, 16 is assumed.
141
+ # It may be larger in future.
142
+ #
143
+ # If secure random number generator is not available,
144
+ # NotImplementedError is raised.
145
+ def self.base64(n=nil)
146
+ [random_bytes(n)].pack("m*").delete("\n")
147
+ end
148
+
149
+ # SecureRandom.random_number generates a random number.
150
+ #
151
+ # If an positive integer is given as n,
152
+ # SecureRandom.random_number returns an integer:
153
+ # 0 <= SecureRandom.random_number(n) < n.
154
+ #
155
+ # If 0 is given or an argument is not given,
156
+ # SecureRandom.random_number returns an float:
157
+ # 0.0 <= SecureRandom.random_number() < 1.0.
158
+ def self.random_number(n=0)
159
+ if 0 < n
160
+ hex = n.to_s(16)
161
+ hex = '0' + hex if (hex.length & 1) == 1
162
+ bin = [hex].pack("H*")
163
+ first = bin[0..0]
164
+ mask = first.respond_to?(:ord) ? first.ord : first.sum(8)
165
+ mask |= mask >> 1
166
+ mask |= mask >> 2
167
+ mask |= mask >> 4
168
+ begin
169
+ rnd = SecureRandom.random_bytes(bin.length)
170
+ first = rnd[0..0]
171
+ ordinal = first.respond_to?(:ord) ? first.ord : first.sum(8)
172
+ rnd[0..0] = (ordinal & mask).chr
173
+ end until rnd < bin
174
+ rnd.unpack("H*")[0].hex
175
+ else
176
+ # assumption: Float::MANT_DIG <= 64
177
+ i64 = SecureRandom.random_bytes(8).unpack("Q")[0]
178
+ Math.ldexp(i64 >> (64-Float::MANT_DIG), -Float::MANT_DIG)
179
+ end
180
+ end
181
+
182
+ # Following code is based on David Garamond's GUID library for Ruby.
183
+ def self.lastWin32ErrorMessage # :nodoc:
184
+ get_last_error = Win32API.new(
185
+ "kernel32", "GetLastError", '', 'L'
186
+ )
187
+ format_message = Win32API.new(
188
+ "kernel32", "FormatMessageA", 'LPLLPLPPPPPPPP', 'L'
189
+ )
190
+ format_message_ignore_inserts = 0x00000200
191
+ format_message_from_system = 0x00001000
192
+
193
+ code = get_last_error.call
194
+ msg = "\0" * 1024
195
+ len = format_message.call(
196
+ format_message_ignore_inserts + format_message_from_system,
197
+ 0, code, 0, msg, 1024, nil, nil, nil, nil, nil, nil, nil, nil
198
+ )
199
+ msg[0, len].tr("\r", '').chomp
200
+ end
201
+ end
202
+ end