remq 0.0.1a → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (789) hide show
  1. data/Rakefile +8 -0
  2. data/Readme.md +31 -17
  3. data/lib/remq/version.rb +1 -1
  4. data/lib/remq.rb +130 -28
  5. data/remq.gemspec +2 -4
  6. data/spec/remq_spec.rb +68 -42
  7. data/vendor/bundle/bin/autospec +23 -0
  8. data/vendor/bundle/bin/htmldiff +25 -0
  9. data/vendor/bundle/bin/ldiff +25 -0
  10. data/vendor/bundle/bin/rake +23 -0
  11. data/vendor/bundle/bin/rspec +23 -0
  12. data/vendor/bundle/cache/diff-lcs-1.1.3.gem +0 -0
  13. data/vendor/bundle/cache/hiredis-0.4.5.gem +0 -0
  14. data/vendor/bundle/cache/multi_json-1.6.1.gem +0 -0
  15. data/vendor/bundle/cache/rake-10.0.3.gem +0 -0
  16. data/vendor/bundle/cache/redis-3.0.2.gem +0 -0
  17. data/vendor/bundle/cache/rspec-2.12.0.gem +0 -0
  18. data/vendor/bundle/cache/rspec-core-2.12.2.gem +0 -0
  19. data/vendor/bundle/cache/rspec-expectations-2.12.1.gem +0 -0
  20. data/vendor/bundle/cache/rspec-mocks-2.12.2.gem +0 -0
  21. data/vendor/bundle/gems/diff-lcs-1.1.3/History.rdoc +54 -0
  22. data/vendor/bundle/gems/diff-lcs-1.1.3/License.rdoc +38 -0
  23. data/vendor/bundle/gems/diff-lcs-1.1.3/Manifest.txt +27 -0
  24. data/vendor/bundle/gems/diff-lcs-1.1.3/README.rdoc +72 -0
  25. data/vendor/bundle/gems/diff-lcs-1.1.3/Rakefile +26 -0
  26. data/vendor/bundle/gems/diff-lcs-1.1.3/bin/htmldiff +32 -0
  27. data/vendor/bundle/gems/diff-lcs-1.1.3/bin/ldiff +6 -0
  28. data/vendor/bundle/gems/diff-lcs-1.1.3/diff-lcs.gemspec +51 -0
  29. data/vendor/bundle/gems/diff-lcs-1.1.3/docs/COPYING.txt +340 -0
  30. data/vendor/bundle/gems/diff-lcs-1.1.3/docs/artistic.html +289 -0
  31. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff/lcs/array.rb +21 -0
  32. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff/lcs/block.rb +51 -0
  33. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff/lcs/callbacks.rb +322 -0
  34. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff/lcs/change.rb +169 -0
  35. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff/lcs/htmldiff.rb +151 -0
  36. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff/lcs/hunk.rb +242 -0
  37. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff/lcs/ldiff.rb +210 -0
  38. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff/lcs/string.rb +19 -0
  39. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff/lcs.rb +1105 -0
  40. data/vendor/bundle/gems/diff-lcs-1.1.3/lib/diff-lcs.rb +5 -0
  41. data/vendor/bundle/gems/diff-lcs-1.1.3/spec/diff_spec.rb +35 -0
  42. data/vendor/bundle/gems/diff-lcs-1.1.3/spec/lcs_spec.rb +36 -0
  43. data/vendor/bundle/gems/diff-lcs-1.1.3/spec/patch_spec.rb +390 -0
  44. data/vendor/bundle/gems/diff-lcs-1.1.3/spec/sdiff_spec.rb +204 -0
  45. data/vendor/bundle/gems/diff-lcs-1.1.3/spec/spec_helper.rb +284 -0
  46. data/vendor/bundle/gems/diff-lcs-1.1.3/spec/traverse_balanced_spec.rb +286 -0
  47. data/vendor/bundle/gems/diff-lcs-1.1.3/spec/traverse_sequences_spec.rb +83 -0
  48. data/vendor/bundle/gems/hiredis-0.4.5/COPYING +28 -0
  49. data/vendor/bundle/gems/hiredis-0.4.5/Rakefile +45 -0
  50. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/Makefile +213 -0
  51. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/connection.c +472 -0
  52. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/connection.o +0 -0
  53. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/extconf.rb +17 -0
  54. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/hiredis_ext.bundle +0 -0
  55. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/hiredis_ext.c +13 -0
  56. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/hiredis_ext.h +37 -0
  57. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/hiredis_ext.o +0 -0
  58. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/reader.c +114 -0
  59. data/vendor/bundle/gems/hiredis-0.4.5/ext/hiredis_ext/reader.o +0 -0
  60. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis/connection.rb +10 -0
  61. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis/errors.rb +5 -0
  62. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis/ext/connection.rb +29 -0
  63. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis/ext/hiredis_ext.bundle +0 -0
  64. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis/ext/reader.rb +2 -0
  65. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis/reader.rb +10 -0
  66. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis/ruby/connection.rb +298 -0
  67. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis/ruby/reader.rb +183 -0
  68. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis/version.rb +3 -0
  69. data/vendor/bundle/gems/hiredis-0.4.5/lib/hiredis.rb +2 -0
  70. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/COPYING +29 -0
  71. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/Makefile +148 -0
  72. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/async.c +604 -0
  73. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/async.h +125 -0
  74. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/async.o +0 -0
  75. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/dict.c +338 -0
  76. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/dict.h +126 -0
  77. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/fmacros.h +16 -0
  78. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/hiredis.c +1283 -0
  79. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/hiredis.h +204 -0
  80. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/hiredis.o +0 -0
  81. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/libhiredis.a +0 -0
  82. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/net.c +279 -0
  83. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/net.h +47 -0
  84. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/net.o +0 -0
  85. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/sds.c +605 -0
  86. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/sds.h +88 -0
  87. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/sds.o +0 -0
  88. data/vendor/bundle/gems/hiredis-0.4.5/vendor/hiredis/test.c +653 -0
  89. data/vendor/bundle/gems/multi_json-1.6.1/CHANGELOG.md +121 -0
  90. data/vendor/bundle/gems/multi_json-1.6.1/CONTRIBUTING.md +46 -0
  91. data/vendor/bundle/gems/multi_json-1.6.1/Gemfile +31 -0
  92. data/vendor/bundle/gems/multi_json-1.6.1/LICENSE.md +20 -0
  93. data/vendor/bundle/gems/multi_json-1.6.1/README.md +105 -0
  94. data/vendor/bundle/gems/multi_json-1.6.1/Rakefile +12 -0
  95. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/adapters/gson.rb +20 -0
  96. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/adapters/json_common.rb +35 -0
  97. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/adapters/json_gem.rb +12 -0
  98. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/adapters/json_pure.rb +12 -0
  99. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/adapters/nsjsonserialization.rb +35 -0
  100. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/adapters/oj.rb +29 -0
  101. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/adapters/ok_json.rb +58 -0
  102. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/adapters/yajl.rb +20 -0
  103. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/vendor/okjson.rb +602 -0
  104. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json/version.rb +3 -0
  105. data/vendor/bundle/gems/multi_json-1.6.1/lib/multi_json.rb +137 -0
  106. data/vendor/bundle/gems/multi_json-1.6.1/multi_json.gemspec +22 -0
  107. data/vendor/bundle/gems/multi_json-1.6.1/spec/adapter_shared_example.rb +162 -0
  108. data/vendor/bundle/gems/multi_json-1.6.1/spec/helper.rb +45 -0
  109. data/vendor/bundle/gems/multi_json-1.6.1/spec/json_common_shared_example.rb +36 -0
  110. data/vendor/bundle/gems/multi_json-1.6.1/spec/multi_json_spec.rb +151 -0
  111. data/vendor/bundle/gems/rake-10.0.3/CHANGES +526 -0
  112. data/vendor/bundle/gems/rake-10.0.3/MIT-LICENSE +21 -0
  113. data/vendor/bundle/gems/rake-10.0.3/README.rdoc +187 -0
  114. data/vendor/bundle/gems/rake-10.0.3/Rakefile +374 -0
  115. data/vendor/bundle/gems/rake-10.0.3/TODO +21 -0
  116. data/vendor/bundle/gems/rake-10.0.3/bin/rake +33 -0
  117. data/vendor/bundle/gems/rake-10.0.3/doc/command_line_usage.rdoc +152 -0
  118. data/vendor/bundle/gems/rake-10.0.3/doc/example/Rakefile1 +38 -0
  119. data/vendor/bundle/gems/rake-10.0.3/doc/example/Rakefile2 +35 -0
  120. data/vendor/bundle/gems/rake-10.0.3/doc/example/a.c +6 -0
  121. data/vendor/bundle/gems/rake-10.0.3/doc/example/b.c +6 -0
  122. data/vendor/bundle/gems/rake-10.0.3/doc/example/main.c +11 -0
  123. data/vendor/bundle/gems/rake-10.0.3/doc/glossary.rdoc +51 -0
  124. data/vendor/bundle/gems/rake-10.0.3/doc/jamis.rb +591 -0
  125. data/vendor/bundle/gems/rake-10.0.3/doc/proto_rake.rdoc +127 -0
  126. data/vendor/bundle/gems/rake-10.0.3/doc/rake.1.gz +0 -0
  127. data/vendor/bundle/gems/rake-10.0.3/doc/rakefile.rdoc +557 -0
  128. data/vendor/bundle/gems/rake-10.0.3/doc/rational.rdoc +151 -0
  129. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.4.14.rdoc +23 -0
  130. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.4.15.rdoc +35 -0
  131. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.5.0.rdoc +53 -0
  132. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.5.3.rdoc +78 -0
  133. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.5.4.rdoc +46 -0
  134. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.6.0.rdoc +141 -0
  135. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.7.0.rdoc +119 -0
  136. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.7.1.rdoc +59 -0
  137. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.7.2.rdoc +121 -0
  138. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.7.3.rdoc +47 -0
  139. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.8.0.rdoc +114 -0
  140. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.8.2.rdoc +165 -0
  141. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.8.3.rdoc +112 -0
  142. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.8.4.rdoc +147 -0
  143. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.8.5.rdoc +53 -0
  144. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.8.6.rdoc +55 -0
  145. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.8.7.rdoc +55 -0
  146. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.9.0.rdoc +112 -0
  147. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.9.1.rdoc +52 -0
  148. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
  149. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.9.2.rdoc +49 -0
  150. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.9.3.rdoc +102 -0
  151. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.9.4.rdoc +110 -0
  152. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.9.5.rdoc +114 -0
  153. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-0.9.6.rdoc +127 -0
  154. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-10.0.0.rdoc +178 -0
  155. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-10.0.1.rdoc +187 -0
  156. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-10.0.2.rdoc +191 -0
  157. data/vendor/bundle/gems/rake-10.0.3/doc/release_notes/rake-10.0.3.rdoc +191 -0
  158. data/vendor/bundle/gems/rake-10.0.3/install.rb +90 -0
  159. data/vendor/bundle/gems/rake-10.0.3/lib/rake/alt_system.rb +109 -0
  160. data/vendor/bundle/gems/rake-10.0.3/lib/rake/application.rb +669 -0
  161. data/vendor/bundle/gems/rake-10.0.3/lib/rake/backtrace.rb +18 -0
  162. data/vendor/bundle/gems/rake-10.0.3/lib/rake/clean.rb +32 -0
  163. data/vendor/bundle/gems/rake-10.0.3/lib/rake/cloneable.rb +16 -0
  164. data/vendor/bundle/gems/rake-10.0.3/lib/rake/contrib/compositepublisher.rb +21 -0
  165. data/vendor/bundle/gems/rake-10.0.3/lib/rake/contrib/ftptools.rb +151 -0
  166. data/vendor/bundle/gems/rake-10.0.3/lib/rake/contrib/publisher.rb +73 -0
  167. data/vendor/bundle/gems/rake-10.0.3/lib/rake/contrib/rubyforgepublisher.rb +16 -0
  168. data/vendor/bundle/gems/rake-10.0.3/lib/rake/contrib/sshpublisher.rb +50 -0
  169. data/vendor/bundle/gems/rake-10.0.3/lib/rake/contrib/sys.rb +1 -0
  170. data/vendor/bundle/gems/rake-10.0.3/lib/rake/default_loader.rb +10 -0
  171. data/vendor/bundle/gems/rake-10.0.3/lib/rake/dsl_definition.rb +156 -0
  172. data/vendor/bundle/gems/rake-10.0.3/lib/rake/early_time.rb +18 -0
  173. data/vendor/bundle/gems/rake-10.0.3/lib/rake/ext/core.rb +27 -0
  174. data/vendor/bundle/gems/rake-10.0.3/lib/rake/ext/module.rb +0 -0
  175. data/vendor/bundle/gems/rake-10.0.3/lib/rake/ext/string.rb +168 -0
  176. data/vendor/bundle/gems/rake-10.0.3/lib/rake/ext/time.rb +15 -0
  177. data/vendor/bundle/gems/rake-10.0.3/lib/rake/file_creation_task.rb +24 -0
  178. data/vendor/bundle/gems/rake-10.0.3/lib/rake/file_list.rb +410 -0
  179. data/vendor/bundle/gems/rake-10.0.3/lib/rake/file_task.rb +47 -0
  180. data/vendor/bundle/gems/rake-10.0.3/lib/rake/file_utils.rb +114 -0
  181. data/vendor/bundle/gems/rake-10.0.3/lib/rake/file_utils_ext.rb +146 -0
  182. data/vendor/bundle/gems/rake-10.0.3/lib/rake/gempackagetask.rb +1 -0
  183. data/vendor/bundle/gems/rake-10.0.3/lib/rake/invocation_chain.rb +51 -0
  184. data/vendor/bundle/gems/rake-10.0.3/lib/rake/invocation_exception_mixin.rb +16 -0
  185. data/vendor/bundle/gems/rake-10.0.3/lib/rake/loaders/makefile.rb +40 -0
  186. data/vendor/bundle/gems/rake-10.0.3/lib/rake/multi_task.rb +13 -0
  187. data/vendor/bundle/gems/rake-10.0.3/lib/rake/name_space.rb +25 -0
  188. data/vendor/bundle/gems/rake-10.0.3/lib/rake/packagetask.rb +185 -0
  189. data/vendor/bundle/gems/rake-10.0.3/lib/rake/pathmap.rb +1 -0
  190. data/vendor/bundle/gems/rake-10.0.3/lib/rake/phony.rb +15 -0
  191. data/vendor/bundle/gems/rake-10.0.3/lib/rake/private_reader.rb +20 -0
  192. data/vendor/bundle/gems/rake-10.0.3/lib/rake/promise.rb +99 -0
  193. data/vendor/bundle/gems/rake-10.0.3/lib/rake/pseudo_status.rb +24 -0
  194. data/vendor/bundle/gems/rake-10.0.3/lib/rake/rake_module.rb +37 -0
  195. data/vendor/bundle/gems/rake-10.0.3/lib/rake/rake_test_loader.rb +22 -0
  196. data/vendor/bundle/gems/rake-10.0.3/lib/rake/rdoctask.rb +1 -0
  197. data/vendor/bundle/gems/rake-10.0.3/lib/rake/ruby182_test_unit_fix.rb +25 -0
  198. data/vendor/bundle/gems/rake-10.0.3/lib/rake/rule_recursion_overflow_error.rb +20 -0
  199. data/vendor/bundle/gems/rake-10.0.3/lib/rake/runtest.rb +22 -0
  200. data/vendor/bundle/gems/rake-10.0.3/lib/rake/task.rb +350 -0
  201. data/vendor/bundle/gems/rake-10.0.3/lib/rake/task_argument_error.rb +7 -0
  202. data/vendor/bundle/gems/rake-10.0.3/lib/rake/task_arguments.rb +78 -0
  203. data/vendor/bundle/gems/rake-10.0.3/lib/rake/task_manager.rb +296 -0
  204. data/vendor/bundle/gems/rake-10.0.3/lib/rake/tasklib.rb +22 -0
  205. data/vendor/bundle/gems/rake-10.0.3/lib/rake/testtask.rb +198 -0
  206. data/vendor/bundle/gems/rake-10.0.3/lib/rake/thread_history_display.rb +48 -0
  207. data/vendor/bundle/gems/rake-10.0.3/lib/rake/thread_pool.rb +155 -0
  208. data/vendor/bundle/gems/rake-10.0.3/lib/rake/trace_output.rb +19 -0
  209. data/vendor/bundle/gems/rake-10.0.3/lib/rake/version.rb +13 -0
  210. data/vendor/bundle/gems/rake-10.0.3/lib/rake/win32.rb +55 -0
  211. data/vendor/bundle/gems/rake-10.0.3/lib/rake.rb +71 -0
  212. data/vendor/bundle/gems/rake-10.0.3/test/file_creation.rb +34 -0
  213. data/vendor/bundle/gems/rake-10.0.3/test/helper.rb +562 -0
  214. data/vendor/bundle/gems/rake-10.0.3/test/test_private_reader.rb +42 -0
  215. data/vendor/bundle/gems/rake-10.0.3/test/test_rake.rb +40 -0
  216. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_application.rb +515 -0
  217. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_application_options.rb +443 -0
  218. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_backtrace.rb +89 -0
  219. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_clean.rb +14 -0
  220. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_definitions.rb +80 -0
  221. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_directory_task.rb +57 -0
  222. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_dsl.rb +40 -0
  223. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_early_time.rb +31 -0
  224. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_extension.rb +59 -0
  225. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_file_creation_task.rb +56 -0
  226. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_file_list.rb +628 -0
  227. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_file_list_path_map.rb +8 -0
  228. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_file_task.rb +122 -0
  229. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_file_utils.rb +305 -0
  230. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_ftp_file.rb +59 -0
  231. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_functional.rb +496 -0
  232. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_invocation_chain.rb +52 -0
  233. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_makefile_loader.rb +44 -0
  234. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_multi_task.rb +59 -0
  235. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_name_space.rb +43 -0
  236. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_package_task.rb +79 -0
  237. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_path_map.rb +157 -0
  238. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_path_map_explode.rb +34 -0
  239. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_path_map_partial.rb +18 -0
  240. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_pseudo_status.rb +21 -0
  241. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_rake_test_loader.rb +21 -0
  242. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_reduce_compat.rb +30 -0
  243. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_require.rb +40 -0
  244. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_rules.rb +327 -0
  245. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_task.rb +316 -0
  246. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_task_argument_parsing.rb +103 -0
  247. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_task_arguments.rb +88 -0
  248. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_task_lib.rb +9 -0
  249. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_task_manager.rb +157 -0
  250. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_task_manager_argument_resolution.rb +19 -0
  251. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_task_with_arguments.rb +171 -0
  252. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_test_task.rb +120 -0
  253. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_thread_pool.rb +123 -0
  254. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_top_level_functions.rb +71 -0
  255. data/vendor/bundle/gems/rake-10.0.3/test/test_rake_win32.rb +72 -0
  256. data/vendor/bundle/gems/rake-10.0.3/test/test_thread_history_display.rb +91 -0
  257. data/vendor/bundle/gems/rake-10.0.3/test/test_trace_output.rb +43 -0
  258. data/vendor/bundle/gems/redis-3.0.2/CHANGELOG.md +238 -0
  259. data/vendor/bundle/gems/redis-3.0.2/LICENSE +20 -0
  260. data/vendor/bundle/gems/redis-3.0.2/README.md +232 -0
  261. data/vendor/bundle/gems/redis-3.0.2/Rakefile +392 -0
  262. data/vendor/bundle/gems/redis-3.0.2/benchmarking/logging.rb +62 -0
  263. data/vendor/bundle/gems/redis-3.0.2/benchmarking/pipeline.rb +51 -0
  264. data/vendor/bundle/gems/redis-3.0.2/benchmarking/speed.rb +21 -0
  265. data/vendor/bundle/gems/redis-3.0.2/benchmarking/suite.rb +24 -0
  266. data/vendor/bundle/gems/redis-3.0.2/benchmarking/worker.rb +71 -0
  267. data/vendor/bundle/gems/redis-3.0.2/examples/basic.rb +15 -0
  268. data/vendor/bundle/gems/redis-3.0.2/examples/dist_redis.rb +43 -0
  269. data/vendor/bundle/gems/redis-3.0.2/examples/incr-decr.rb +17 -0
  270. data/vendor/bundle/gems/redis-3.0.2/examples/list.rb +26 -0
  271. data/vendor/bundle/gems/redis-3.0.2/examples/pubsub.rb +37 -0
  272. data/vendor/bundle/gems/redis-3.0.2/examples/sets.rb +36 -0
  273. data/vendor/bundle/gems/redis-3.0.2/examples/unicorn/config.ru +3 -0
  274. data/vendor/bundle/gems/redis-3.0.2/examples/unicorn/unicorn.rb +20 -0
  275. data/vendor/bundle/gems/redis-3.0.2/lib/redis/client.rb +401 -0
  276. data/vendor/bundle/gems/redis-3.0.2/lib/redis/connection/command_helper.rb +44 -0
  277. data/vendor/bundle/gems/redis-3.0.2/lib/redis/connection/hiredis.rb +63 -0
  278. data/vendor/bundle/gems/redis-3.0.2/lib/redis/connection/registry.rb +12 -0
  279. data/vendor/bundle/gems/redis-3.0.2/lib/redis/connection/ruby.rb +285 -0
  280. data/vendor/bundle/gems/redis-3.0.2/lib/redis/connection/synchrony.rb +124 -0
  281. data/vendor/bundle/gems/redis-3.0.2/lib/redis/connection.rb +9 -0
  282. data/vendor/bundle/gems/redis-3.0.2/lib/redis/distributed.rb +816 -0
  283. data/vendor/bundle/gems/redis-3.0.2/lib/redis/errors.rb +40 -0
  284. data/vendor/bundle/gems/redis-3.0.2/lib/redis/hash_ring.rb +131 -0
  285. data/vendor/bundle/gems/redis-3.0.2/lib/redis/pipeline.rb +130 -0
  286. data/vendor/bundle/gems/redis-3.0.2/lib/redis/subscribe.rb +79 -0
  287. data/vendor/bundle/gems/redis-3.0.2/lib/redis/version.rb +3 -0
  288. data/vendor/bundle/gems/redis-3.0.2/lib/redis.rb +2233 -0
  289. data/vendor/bundle/gems/redis-3.0.2/redis.gemspec +41 -0
  290. data/vendor/bundle/gems/redis-3.0.2/test/blocking_commands_test.rb +42 -0
  291. data/vendor/bundle/gems/redis-3.0.2/test/command_map_test.rb +30 -0
  292. data/vendor/bundle/gems/redis-3.0.2/test/commands_on_hashes_test.rb +21 -0
  293. data/vendor/bundle/gems/redis-3.0.2/test/commands_on_lists_test.rb +20 -0
  294. data/vendor/bundle/gems/redis-3.0.2/test/commands_on_sets_test.rb +77 -0
  295. data/vendor/bundle/gems/redis-3.0.2/test/commands_on_sorted_sets_test.rb +109 -0
  296. data/vendor/bundle/gems/redis-3.0.2/test/commands_on_strings_test.rb +83 -0
  297. data/vendor/bundle/gems/redis-3.0.2/test/commands_on_value_types_test.rb +99 -0
  298. data/vendor/bundle/gems/redis-3.0.2/test/connection_handling_test.rb +189 -0
  299. data/vendor/bundle/gems/redis-3.0.2/test/distributed_blocking_commands_test.rb +46 -0
  300. data/vendor/bundle/gems/redis-3.0.2/test/distributed_commands_on_hashes_test.rb +10 -0
  301. data/vendor/bundle/gems/redis-3.0.2/test/distributed_commands_on_lists_test.rb +22 -0
  302. data/vendor/bundle/gems/redis-3.0.2/test/distributed_commands_on_sets_test.rb +83 -0
  303. data/vendor/bundle/gems/redis-3.0.2/test/distributed_commands_on_sorted_sets_test.rb +18 -0
  304. data/vendor/bundle/gems/redis-3.0.2/test/distributed_commands_on_strings_test.rb +48 -0
  305. data/vendor/bundle/gems/redis-3.0.2/test/distributed_commands_on_value_types_test.rb +87 -0
  306. data/vendor/bundle/gems/redis-3.0.2/test/distributed_commands_requiring_clustering_test.rb +148 -0
  307. data/vendor/bundle/gems/redis-3.0.2/test/distributed_connection_handling_test.rb +23 -0
  308. data/vendor/bundle/gems/redis-3.0.2/test/distributed_internals_test.rb +41 -0
  309. data/vendor/bundle/gems/redis-3.0.2/test/distributed_key_tags_test.rb +52 -0
  310. data/vendor/bundle/gems/redis-3.0.2/test/distributed_persistence_control_commands_test.rb +26 -0
  311. data/vendor/bundle/gems/redis-3.0.2/test/distributed_publish_subscribe_test.rb +92 -0
  312. data/vendor/bundle/gems/redis-3.0.2/test/distributed_remote_server_control_commands_test.rb +66 -0
  313. data/vendor/bundle/gems/redis-3.0.2/test/distributed_scripting_test.rb +102 -0
  314. data/vendor/bundle/gems/redis-3.0.2/test/distributed_sorting_test.rb +20 -0
  315. data/vendor/bundle/gems/redis-3.0.2/test/distributed_test.rb +58 -0
  316. data/vendor/bundle/gems/redis-3.0.2/test/distributed_transactions_test.rb +32 -0
  317. data/vendor/bundle/gems/redis-3.0.2/test/encoding_test.rb +18 -0
  318. data/vendor/bundle/gems/redis-3.0.2/test/error_replies_test.rb +59 -0
  319. data/vendor/bundle/gems/redis-3.0.2/test/helper.rb +194 -0
  320. data/vendor/bundle/gems/redis-3.0.2/test/helper_test.rb +22 -0
  321. data/vendor/bundle/gems/redis-3.0.2/test/internals_test.rb +301 -0
  322. data/vendor/bundle/gems/redis-3.0.2/test/lint/blocking_commands.rb +124 -0
  323. data/vendor/bundle/gems/redis-3.0.2/test/lint/hashes.rb +162 -0
  324. data/vendor/bundle/gems/redis-3.0.2/test/lint/lists.rb +143 -0
  325. data/vendor/bundle/gems/redis-3.0.2/test/lint/sets.rb +96 -0
  326. data/vendor/bundle/gems/redis-3.0.2/test/lint/sorted_sets.rb +238 -0
  327. data/vendor/bundle/gems/redis-3.0.2/test/lint/strings.rb +157 -0
  328. data/vendor/bundle/gems/redis-3.0.2/test/lint/value_types.rb +106 -0
  329. data/vendor/bundle/gems/redis-3.0.2/test/persistence_control_commands_test.rb +26 -0
  330. data/vendor/bundle/gems/redis-3.0.2/test/pipelining_commands_test.rb +195 -0
  331. data/vendor/bundle/gems/redis-3.0.2/test/publish_subscribe_test.rb +153 -0
  332. data/vendor/bundle/gems/redis-3.0.2/test/remote_server_control_commands_test.rb +117 -0
  333. data/vendor/bundle/gems/redis-3.0.2/test/scripting_test.rb +78 -0
  334. data/vendor/bundle/gems/redis-3.0.2/test/sorting_test.rb +45 -0
  335. data/vendor/bundle/gems/redis-3.0.2/test/support/connection/hiredis.rb +1 -0
  336. data/vendor/bundle/gems/redis-3.0.2/test/support/connection/ruby.rb +1 -0
  337. data/vendor/bundle/gems/redis-3.0.2/test/support/connection/synchrony.rb +17 -0
  338. data/vendor/bundle/gems/redis-3.0.2/test/support/redis_mock.rb +110 -0
  339. data/vendor/bundle/gems/redis-3.0.2/test/support/wire/synchrony.rb +24 -0
  340. data/vendor/bundle/gems/redis-3.0.2/test/support/wire/thread.rb +5 -0
  341. data/vendor/bundle/gems/redis-3.0.2/test/synchrony_driver.rb +88 -0
  342. data/vendor/bundle/gems/redis-3.0.2/test/test.conf +9 -0
  343. data/vendor/bundle/gems/redis-3.0.2/test/thread_safety_test.rb +32 -0
  344. data/vendor/bundle/gems/redis-3.0.2/test/transactions_test.rb +260 -0
  345. data/vendor/bundle/gems/redis-3.0.2/test/unknown_commands_test.rb +14 -0
  346. data/vendor/bundle/gems/redis-3.0.2/test/url_param_test.rb +132 -0
  347. data/vendor/bundle/gems/rspec-2.12.0/License.txt +24 -0
  348. data/vendor/bundle/gems/rspec-2.12.0/README.md +47 -0
  349. data/vendor/bundle/gems/rspec-2.12.0/lib/rspec/version.rb +5 -0
  350. data/vendor/bundle/gems/rspec-2.12.0/lib/rspec.rb +4 -0
  351. data/vendor/bundle/gems/rspec-core-2.12.2/Changelog.md +655 -0
  352. data/vendor/bundle/gems/rspec-core-2.12.2/License.txt +24 -0
  353. data/vendor/bundle/gems/rspec-core-2.12.2/README.md +257 -0
  354. data/vendor/bundle/gems/rspec-core-2.12.2/exe/autospec +13 -0
  355. data/vendor/bundle/gems/rspec-core-2.12.2/exe/rspec +25 -0
  356. data/vendor/bundle/gems/rspec-core-2.12.2/features/Autotest.md +38 -0
  357. data/vendor/bundle/gems/rspec-core-2.12.2/features/README.md +17 -0
  358. data/vendor/bundle/gems/rspec-core-2.12.2/features/Upgrade.md +364 -0
  359. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/README.md +28 -0
  360. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/example_name_option.feature +101 -0
  361. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/exit_status.feature +82 -0
  362. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/format_option.feature +81 -0
  363. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/init.feature +18 -0
  364. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/line_number_appended_to_path.feature +140 -0
  365. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/line_number_option.feature +58 -0
  366. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/order.feature +29 -0
  367. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/pattern_option.feature +31 -0
  368. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/rake_task.feature +122 -0
  369. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/ruby.feature +22 -0
  370. data/vendor/bundle/gems/rspec-core-2.12.2/features/command_line/tag.feature +91 -0
  371. data/vendor/bundle/gems/rspec-core-2.12.2/features/configuration/alias_example_to.feature +48 -0
  372. data/vendor/bundle/gems/rspec-core-2.12.2/features/configuration/custom_settings.feature +84 -0
  373. data/vendor/bundle/gems/rspec-core-2.12.2/features/configuration/default_path.feature +38 -0
  374. data/vendor/bundle/gems/rspec-core-2.12.2/features/configuration/fail_fast.feature +77 -0
  375. data/vendor/bundle/gems/rspec-core-2.12.2/features/configuration/read_options_from_file.feature +87 -0
  376. data/vendor/bundle/gems/rspec-core-2.12.2/features/example_groups/basic_structure.feature +55 -0
  377. data/vendor/bundle/gems/rspec-core-2.12.2/features/example_groups/shared_context.feature +74 -0
  378. data/vendor/bundle/gems/rspec-core-2.12.2/features/example_groups/shared_examples.feature +222 -0
  379. data/vendor/bundle/gems/rspec-core-2.12.2/features/expectation_framework_integration/configure_expectation_framework.feature +102 -0
  380. data/vendor/bundle/gems/rspec-core-2.12.2/features/filtering/exclusion_filters.feature +139 -0
  381. data/vendor/bundle/gems/rspec-core-2.12.2/features/filtering/if_and_unless.feature +168 -0
  382. data/vendor/bundle/gems/rspec-core-2.12.2/features/filtering/inclusion_filters.feature +105 -0
  383. data/vendor/bundle/gems/rspec-core-2.12.2/features/filtering/run_all_when_everything_filtered.feature +46 -0
  384. data/vendor/bundle/gems/rspec-core-2.12.2/features/formatters/custom_formatter.feature +36 -0
  385. data/vendor/bundle/gems/rspec-core-2.12.2/features/formatters/json_formatter.feature +30 -0
  386. data/vendor/bundle/gems/rspec-core-2.12.2/features/formatters/text_formatter.feature +46 -0
  387. data/vendor/bundle/gems/rspec-core-2.12.2/features/helper_methods/arbitrary_methods.feature +40 -0
  388. data/vendor/bundle/gems/rspec-core-2.12.2/features/helper_methods/let.feature +50 -0
  389. data/vendor/bundle/gems/rspec-core-2.12.2/features/helper_methods/modules.feature +149 -0
  390. data/vendor/bundle/gems/rspec-core-2.12.2/features/hooks/around_hooks.feature +343 -0
  391. data/vendor/bundle/gems/rspec-core-2.12.2/features/hooks/before_and_after_hooks.feature +427 -0
  392. data/vendor/bundle/gems/rspec-core-2.12.2/features/hooks/filtering.feature +234 -0
  393. data/vendor/bundle/gems/rspec-core-2.12.2/features/metadata/current_example.feature +17 -0
  394. data/vendor/bundle/gems/rspec-core-2.12.2/features/metadata/described_class.feature +17 -0
  395. data/vendor/bundle/gems/rspec-core-2.12.2/features/metadata/user_defined.feature +113 -0
  396. data/vendor/bundle/gems/rspec-core-2.12.2/features/mock_framework_integration/use_any_framework.feature +106 -0
  397. data/vendor/bundle/gems/rspec-core-2.12.2/features/mock_framework_integration/use_flexmock.feature +96 -0
  398. data/vendor/bundle/gems/rspec-core-2.12.2/features/mock_framework_integration/use_mocha.feature +97 -0
  399. data/vendor/bundle/gems/rspec-core-2.12.2/features/mock_framework_integration/use_rr.feature +98 -0
  400. data/vendor/bundle/gems/rspec-core-2.12.2/features/mock_framework_integration/use_rspec.feature +97 -0
  401. data/vendor/bundle/gems/rspec-core-2.12.2/features/pending/pending_examples.feature +229 -0
  402. data/vendor/bundle/gems/rspec-core-2.12.2/features/spec_files/arbitrary_file_suffix.feature +13 -0
  403. data/vendor/bundle/gems/rspec-core-2.12.2/features/step_definitions/additional_cli_steps.rb +32 -0
  404. data/vendor/bundle/gems/rspec-core-2.12.2/features/subject/attribute_of_subject.feature +124 -0
  405. data/vendor/bundle/gems/rspec-core-2.12.2/features/subject/explicit_subject.feature +82 -0
  406. data/vendor/bundle/gems/rspec-core-2.12.2/features/subject/implicit_receiver.feature +29 -0
  407. data/vendor/bundle/gems/rspec-core-2.12.2/features/subject/implicit_subject.feature +63 -0
  408. data/vendor/bundle/gems/rspec-core-2.12.2/features/support/env.rb +12 -0
  409. data/vendor/bundle/gems/rspec-core-2.12.2/lib/autotest/discover.rb +1 -0
  410. data/vendor/bundle/gems/rspec-core-2.12.2/lib/autotest/rspec2.rb +73 -0
  411. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/autorun.rb +2 -0
  412. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/backward_compatibility.rb +65 -0
  413. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/command_line.rb +36 -0
  414. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/configuration.rb +1057 -0
  415. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/configuration_options.rb +144 -0
  416. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/deprecation.rb +36 -0
  417. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/drb_command_line.rb +26 -0
  418. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/drb_options.rb +87 -0
  419. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/dsl.rb +26 -0
  420. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/example.rb +331 -0
  421. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/example_group.rb +476 -0
  422. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/extensions/instance_eval_with_args.rb +44 -0
  423. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/extensions/kernel.rb +9 -0
  424. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/extensions/module_eval_with_args.rb +38 -0
  425. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/extensions/ordered.rb +27 -0
  426. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/filter_manager.rb +203 -0
  427. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/base_formatter.rb +237 -0
  428. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/base_text_formatter.rb +225 -0
  429. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/documentation_formatter.rb +67 -0
  430. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/helpers.rb +103 -0
  431. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/html_formatter.rb +154 -0
  432. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/html_printer.rb +407 -0
  433. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/json_formatter.rb +73 -0
  434. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/progress_formatter.rb +32 -0
  435. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/snippet_extractor.rb +92 -0
  436. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters/text_mate_formatter.rb +34 -0
  437. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/formatters.rb +55 -0
  438. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/hooks.rb +495 -0
  439. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/let.rb +110 -0
  440. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/load_path.rb +3 -0
  441. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/metadata.rb +293 -0
  442. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/metadata_hash_builder.rb +97 -0
  443. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/mocking/with_absolutely_nothing.rb +11 -0
  444. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/mocking/with_flexmock.rb +27 -0
  445. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/mocking/with_mocha.rb +52 -0
  446. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/mocking/with_rr.rb +27 -0
  447. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/mocking/with_rspec.rb +27 -0
  448. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/option_parser.rb +202 -0
  449. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/pending.rb +101 -0
  450. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/project_initializer.rb +86 -0
  451. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/rake_task.rb +202 -0
  452. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/reporter.rb +102 -0
  453. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/ruby_project.rb +44 -0
  454. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/runner.rb +87 -0
  455. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/shared_context.rb +49 -0
  456. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/shared_example_group.rb +144 -0
  457. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/subject.rb +223 -0
  458. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/version.rb +7 -0
  459. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core/world.rb +128 -0
  460. data/vendor/bundle/gems/rspec-core-2.12.2/lib/rspec/core.rb +147 -0
  461. data/vendor/bundle/gems/rspec-core-2.12.2/spec/autotest/discover_spec.rb +19 -0
  462. data/vendor/bundle/gems/rspec-core-2.12.2/spec/autotest/failed_results_re_spec.rb +45 -0
  463. data/vendor/bundle/gems/rspec-core-2.12.2/spec/autotest/rspec_spec.rb +128 -0
  464. data/vendor/bundle/gems/rspec-core-2.12.2/spec/command_line/order_spec.rb +204 -0
  465. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/command_line_spec.rb +108 -0
  466. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/command_line_spec_output.txt +0 -0
  467. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/configuration_options_spec.rb +384 -0
  468. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/configuration_spec.rb +1371 -0
  469. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/deprecations_spec.rb +75 -0
  470. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/drb_command_line_spec.rb +102 -0
  471. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/drb_options_spec.rb +180 -0
  472. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/dsl_spec.rb +25 -0
  473. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/example_group_spec.rb +1144 -0
  474. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/example_spec.rb +402 -0
  475. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/filter_manager_spec.rb +246 -0
  476. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/base_formatter_spec.rb +108 -0
  477. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/base_text_formatter_spec.rb +367 -0
  478. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/documentation_formatter_spec.rb +88 -0
  479. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/helpers_spec.rb +78 -0
  480. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +410 -0
  481. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +462 -0
  482. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/html_formatted-1.8.7.html +409 -0
  483. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/html_formatted-1.9.2-jruby.html +410 -0
  484. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/html_formatted-1.9.2.html +416 -0
  485. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +410 -0
  486. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +462 -0
  487. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/html_formatted-1.9.3.html +416 -0
  488. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/html_formatter_spec.rb +90 -0
  489. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/json_formatter_spec.rb +110 -0
  490. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/progress_formatter_spec.rb +30 -0
  491. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/snippet_extractor_spec.rb +26 -0
  492. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +410 -0
  493. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html +462 -0
  494. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +409 -0
  495. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/text_mate_formatted-1.9.2-jruby.html +410 -0
  496. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +416 -0
  497. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html +410 -0
  498. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html +462 -0
  499. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html +416 -0
  500. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/formatters/text_mate_formatter_spec.rb +91 -0
  501. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/hooks_filtering_spec.rb +227 -0
  502. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/hooks_spec.rb +250 -0
  503. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/kernel_extensions_spec.rb +9 -0
  504. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/let_spec.rb +55 -0
  505. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/metadata_spec.rb +486 -0
  506. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/option_parser_spec.rb +208 -0
  507. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/pending_example_spec.rb +220 -0
  508. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/project_initializer_spec.rb +130 -0
  509. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/rake_task_spec.rb +181 -0
  510. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/reporter_spec.rb +120 -0
  511. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/resources/a_bar.rb +0 -0
  512. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/resources/a_foo.rb +0 -0
  513. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/resources/a_spec.rb +1 -0
  514. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/resources/custom_example_group_runner.rb +14 -0
  515. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/resources/formatter_specs.rb +60 -0
  516. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/resources/utf8_encoded.rb +8 -0
  517. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/rspec_matchers_spec.rb +45 -0
  518. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/ruby_project_spec.rb +24 -0
  519. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/runner_spec.rb +82 -0
  520. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/shared_context_spec.rb +67 -0
  521. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/shared_example_group_spec.rb +96 -0
  522. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/subject_spec.rb +255 -0
  523. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core/world_spec.rb +144 -0
  524. data/vendor/bundle/gems/rspec-core-2.12.2/spec/rspec/core_spec.rb +35 -0
  525. data/vendor/bundle/gems/rspec-core-2.12.2/spec/spec_helper.rb +128 -0
  526. data/vendor/bundle/gems/rspec-core-2.12.2/spec/support/config_options_helper.rb +15 -0
  527. data/vendor/bundle/gems/rspec-core-2.12.2/spec/support/helper_methods.rb +18 -0
  528. data/vendor/bundle/gems/rspec-core-2.12.2/spec/support/isolated_directory.rb +10 -0
  529. data/vendor/bundle/gems/rspec-core-2.12.2/spec/support/isolated_home_directory.rb +16 -0
  530. data/vendor/bundle/gems/rspec-core-2.12.2/spec/support/matchers.rb +65 -0
  531. data/vendor/bundle/gems/rspec-core-2.12.2/spec/support/shared_example_groups.rb +41 -0
  532. data/vendor/bundle/gems/rspec-core-2.12.2/spec/support/spec_files.rb +44 -0
  533. data/vendor/bundle/gems/rspec-expectations-2.12.1/Changelog.md +297 -0
  534. data/vendor/bundle/gems/rspec-expectations-2.12.1/License.txt +23 -0
  535. data/vendor/bundle/gems/rspec-expectations-2.12.1/README.md +228 -0
  536. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/README.md +49 -0
  537. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/Upgrade.md +53 -0
  538. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/README.md +90 -0
  539. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/be.feature +173 -0
  540. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/be_within.feature +46 -0
  541. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/cover.feature +45 -0
  542. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/end_with.feature +46 -0
  543. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/equality.feature +145 -0
  544. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/exist.feature +43 -0
  545. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/expect_change.feature +59 -0
  546. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/expect_error.feature +138 -0
  547. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/have.feature +103 -0
  548. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/include.feature +121 -0
  549. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/match.feature +50 -0
  550. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/operators.feature +221 -0
  551. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/predicates.feature +129 -0
  552. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/respond_to.feature +78 -0
  553. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/satisfy.feature +31 -0
  554. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/start_with.feature +46 -0
  555. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/throw_symbol.feature +85 -0
  556. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/types.feature +114 -0
  557. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/built_in_matchers/yield.feature +146 -0
  558. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/custom_matchers/access_running_example.feature +53 -0
  559. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/custom_matchers/define_diffable_matcher.feature +27 -0
  560. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher.feature +368 -0
  561. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_outside_rspec.feature +38 -0
  562. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/custom_matchers/define_matcher_with_fluent_interface.feature +24 -0
  563. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/customized_message.feature +22 -0
  564. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/diffing.feature +85 -0
  565. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/implicit_docstrings.feature +52 -0
  566. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/step_definitions/additional_cli_steps.rb +22 -0
  567. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/support/env.rb +5 -0
  568. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/syntax_configuration.feature +68 -0
  569. data/vendor/bundle/gems/rspec-expectations-2.12.1/features/test_frameworks/test_unit.feature +46 -0
  570. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/deprecation.rb +38 -0
  571. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/differ.rb +115 -0
  572. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/errors.rb +9 -0
  573. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/expectation_target.rb +88 -0
  574. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/extensions/array.rb +9 -0
  575. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/extensions/object.rb +39 -0
  576. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/extensions.rb +2 -0
  577. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/fail_with.rb +55 -0
  578. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/handler.rb +63 -0
  579. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/syntax.rb +118 -0
  580. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations/version.rb +8 -0
  581. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/expectations.rb +47 -0
  582. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/be_close.rb +9 -0
  583. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/base_matcher.rb +68 -0
  584. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/be.rb +185 -0
  585. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/be_instance_of.rb +15 -0
  586. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/be_kind_of.rb +11 -0
  587. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/be_within.rb +46 -0
  588. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/change.rb +133 -0
  589. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/cover.rb +21 -0
  590. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/eq.rb +22 -0
  591. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/eql.rb +23 -0
  592. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/equal.rb +44 -0
  593. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/exist.rb +26 -0
  594. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/has.rb +48 -0
  595. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/have.rb +108 -0
  596. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/include.rb +53 -0
  597. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/match.rb +12 -0
  598. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/match_array.rb +51 -0
  599. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/raise_error.rb +107 -0
  600. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/respond_to.rb +74 -0
  601. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/satisfy.rb +30 -0
  602. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/start_and_end_with.rb +48 -0
  603. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/throw_symbol.rb +94 -0
  604. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in/yield.rb +221 -0
  605. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/built_in.rb +39 -0
  606. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/compatibility.rb +14 -0
  607. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/configuration.rb +108 -0
  608. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/dsl.rb +24 -0
  609. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/extensions/instance_eval_with_args.rb +39 -0
  610. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/generated_descriptions.rb +35 -0
  611. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/matcher.rb +299 -0
  612. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/method_missing.rb +12 -0
  613. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/operator_matcher.rb +109 -0
  614. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers/pretty.rb +60 -0
  615. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec/matchers.rb +699 -0
  616. data/vendor/bundle/gems/rspec-expectations-2.12.1/lib/rspec-expectations.rb +1 -0
  617. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/expectations/differ_spec.rb +177 -0
  618. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/expectations/expectation_target_spec.rb +65 -0
  619. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/expectations/extensions/kernel_spec.rb +67 -0
  620. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/expectations/fail_with_spec.rb +70 -0
  621. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/expectations/handler_spec.rb +206 -0
  622. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/expectations/syntax_spec.rb +35 -0
  623. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/base_matcher_spec.rb +60 -0
  624. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/be_close_spec.rb +22 -0
  625. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/be_instance_of_spec.rb +57 -0
  626. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/be_kind_of_spec.rb +37 -0
  627. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/be_spec.rb +452 -0
  628. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/be_within_spec.rb +80 -0
  629. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/change_spec.rb +528 -0
  630. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/configuration_spec.rb +234 -0
  631. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/cover_spec.rb +69 -0
  632. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/description_generation_spec.rb +176 -0
  633. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/dsl_spec.rb +57 -0
  634. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/eq_spec.rb +54 -0
  635. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/eql_spec.rb +41 -0
  636. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/equal_spec.rb +60 -0
  637. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/exist_spec.rb +110 -0
  638. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/has_spec.rb +118 -0
  639. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/have_spec.rb +431 -0
  640. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/include_spec.rb +373 -0
  641. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/match_array_spec.rb +153 -0
  642. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/match_spec.rb +61 -0
  643. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/matcher_spec.rb +434 -0
  644. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/matchers_spec.rb +31 -0
  645. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/method_missing_spec.rb +24 -0
  646. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/operator_matcher_spec.rb +244 -0
  647. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/raise_error_spec.rb +395 -0
  648. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/respond_to_spec.rb +295 -0
  649. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/satisfy_spec.rb +44 -0
  650. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/start_with_end_with_spec.rb +182 -0
  651. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/throw_symbol_spec.rb +116 -0
  652. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/rspec/matchers/yield_spec.rb +437 -0
  653. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/spec_helper.rb +27 -0
  654. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/support/classes.rb +56 -0
  655. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/support/in_sub_process.rb +31 -0
  656. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/support/matchers.rb +22 -0
  657. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/support/ruby_version.rb +10 -0
  658. data/vendor/bundle/gems/rspec-expectations-2.12.1/spec/support/shared_examples.rb +13 -0
  659. data/vendor/bundle/gems/rspec-mocks-2.12.2/Changelog.md +268 -0
  660. data/vendor/bundle/gems/rspec-mocks-2.12.2/License.txt +23 -0
  661. data/vendor/bundle/gems/rspec-mocks-2.12.2/README.md +301 -0
  662. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/README.md +67 -0
  663. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/Scope.md +17 -0
  664. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/Upgrade.md +22 -0
  665. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/argument_matchers/README.md +27 -0
  666. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/argument_matchers/explicit.feature +60 -0
  667. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/argument_matchers/general_matchers.feature +85 -0
  668. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/argument_matchers/type_matchers.feature +27 -0
  669. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/message_expectations/README.md +73 -0
  670. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/message_expectations/any_instance.feature +21 -0
  671. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/message_expectations/block_local_expectations.feature.pending +55 -0
  672. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/message_expectations/call_original.feature +24 -0
  673. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/message_expectations/expect_message.feature +94 -0
  674. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/message_expectations/receive_counts.feature +209 -0
  675. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/message_expectations/warn_when_expectation_is_set_on_nil.feature +50 -0
  676. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/method_stubs/README.md +47 -0
  677. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/method_stubs/any_instance.feature +132 -0
  678. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/method_stubs/as_null_object.feature +35 -0
  679. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/method_stubs/simple_return_value.feature +64 -0
  680. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/method_stubs/stub_chain.feature +51 -0
  681. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/method_stubs/stub_implementation.feature +26 -0
  682. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/method_stubs/to_ary.feature +47 -0
  683. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/mutating_constants/README.md +82 -0
  684. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/mutating_constants/hiding_defined_constant.feature +64 -0
  685. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/mutating_constants/stub_defined_constant.feature +79 -0
  686. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/mutating_constants/stub_undefined_constant.feature +50 -0
  687. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/outside_rspec/configuration.feature +82 -0
  688. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/outside_rspec/standalone.feature +33 -0
  689. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/step_definitions/additional_cli_steps.rb +4 -0
  690. data/vendor/bundle/gems/rspec-mocks-2.12.2/features/support/env.rb +6 -0
  691. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/any_instance/chain.rb +78 -0
  692. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/any_instance/expectation_chain.rb +57 -0
  693. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/any_instance/message_chains.rb +60 -0
  694. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/any_instance/recorder.rb +199 -0
  695. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/any_instance/stub_chain.rb +37 -0
  696. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/any_instance/stub_chain_chain.rb +25 -0
  697. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/any_instance.rb +81 -0
  698. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/argument_list_matcher.rb +93 -0
  699. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/argument_matchers.rb +238 -0
  700. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/configuration.rb +28 -0
  701. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/error_generator.rb +120 -0
  702. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/errors.rb +12 -0
  703. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/example_methods.rb +120 -0
  704. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/extensions/instance_exec.rb +34 -0
  705. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/extensions/marshal.rb +23 -0
  706. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/extensions/psych.rb +23 -0
  707. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/framework.rb +22 -0
  708. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/instance_method_stasher.rb +85 -0
  709. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/message_expectation.rb +503 -0
  710. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/method_double.rb +280 -0
  711. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/methods.rb +155 -0
  712. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/mock.rb +7 -0
  713. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/mutate_const.rb +415 -0
  714. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/order_group.rb +40 -0
  715. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/proxy.rb +205 -0
  716. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/serialization.rb +34 -0
  717. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/space.rb +34 -0
  718. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/standalone.rb +3 -0
  719. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/test_double.rb +103 -0
  720. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/version.rb +7 -0
  721. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks.rb +63 -0
  722. data/vendor/bundle/gems/rspec-mocks-2.12.2/lib/spec/mocks.rb +6 -0
  723. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/and_call_original_spec.rb +225 -0
  724. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/and_yield_spec.rb +114 -0
  725. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/any_instance/message_chains_spec.rb +40 -0
  726. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/any_instance_spec.rb +888 -0
  727. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/any_number_of_times_spec.rb +30 -0
  728. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/argument_expectation_spec.rb +34 -0
  729. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/at_least_spec.rb +142 -0
  730. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/at_most_spec.rb +90 -0
  731. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/block_return_value_spec.rb +53 -0
  732. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/bug_report_10260_spec.rb +8 -0
  733. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/bug_report_10263_spec.rb +27 -0
  734. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/bug_report_11545_spec.rb +32 -0
  735. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/bug_report_496_spec.rb +17 -0
  736. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/bug_report_600_spec.rb +22 -0
  737. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/bug_report_7611_spec.rb +16 -0
  738. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/bug_report_8165_spec.rb +31 -0
  739. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/bug_report_830_spec.rb +21 -0
  740. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/bug_report_957_spec.rb +22 -0
  741. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/configuration_spec.rb +26 -0
  742. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/double_spec.rb +12 -0
  743. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/failing_argument_matchers_spec.rb +94 -0
  744. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/hash_excluding_matcher_spec.rb +67 -0
  745. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/hash_including_matcher_spec.rb +90 -0
  746. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/instance_method_stasher_spec.rb +58 -0
  747. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/mock_ordering_spec.rb +103 -0
  748. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/mock_space_spec.rb +58 -0
  749. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/mock_spec.rb +734 -0
  750. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/multiple_return_value_spec.rb +119 -0
  751. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/mutate_const_spec.rb +481 -0
  752. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/nil_expectation_warning_spec.rb +56 -0
  753. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/null_object_mock_spec.rb +107 -0
  754. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/once_counts_spec.rb +52 -0
  755. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/options_hash_spec.rb +35 -0
  756. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/partial_mock_spec.rb +196 -0
  757. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb +95 -0
  758. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/passing_argument_matchers_spec.rb +142 -0
  759. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/precise_counts_spec.rb +68 -0
  760. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/record_messages_spec.rb +26 -0
  761. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/serialization_spec.rb +110 -0
  762. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/stash_spec.rb +54 -0
  763. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/stub_chain_spec.rb +154 -0
  764. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/stub_implementation_spec.rb +81 -0
  765. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/stub_spec.rb +266 -0
  766. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/stubbed_message_expectations_spec.rb +47 -0
  767. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/test_double_spec.rb +57 -0
  768. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/to_ary_spec.rb +40 -0
  769. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks/twice_counts_spec.rb +66 -0
  770. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/rspec/mocks_spec.rb +67 -0
  771. data/vendor/bundle/gems/rspec-mocks-2.12.2/spec/spec_helper.rb +36 -0
  772. data/vendor/bundle/specifications/diff-lcs-1.1.3.gemspec +35 -0
  773. data/vendor/bundle/specifications/hiredis-0.4.5.gemspec +30 -0
  774. data/vendor/bundle/specifications/multi_json-1.6.1.gemspec +30 -0
  775. data/vendor/bundle/specifications/rake-10.0.3.gemspec +34 -0
  776. data/vendor/bundle/specifications/redis-3.0.2.gemspec +28 -0
  777. data/vendor/bundle/specifications/rspec-2.12.0.gemspec +39 -0
  778. data/vendor/bundle/specifications/rspec-core-2.12.2.gemspec +58 -0
  779. data/vendor/bundle/specifications/rspec-expectations-2.12.1.gemspec +40 -0
  780. data/vendor/bundle/specifications/rspec-mocks-2.12.2.gemspec +37 -0
  781. data/vendor/remq/Readme.md +30 -16
  782. data/vendor/remq/VERSION +1 -0
  783. data/vendor/remq/scripts/consume.lua +24 -38
  784. data/vendor/remq/scripts/flush.lua +33 -0
  785. data/vendor/remq/scripts/publish.lua +10 -7
  786. metadata +806 -29
  787. data/lib/remq/coder.rb +0 -30
  788. data/lib/remq/multi_json_coder.rb +0 -39
  789. data/vendor/remq/scripts/purge.lua +0 -18
@@ -0,0 +1,1283 @@
1
+ /*
2
+ * Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
3
+ * Copyright (c) 2010-2011, Pieter Noordhuis <pcnoordhuis at gmail dot com>
4
+ *
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ *
10
+ * * Redistributions of source code must retain the above copyright notice,
11
+ * this list of conditions and the following disclaimer.
12
+ * * Redistributions in binary form must reproduce the above copyright
13
+ * notice, this list of conditions and the following disclaimer in the
14
+ * documentation and/or other materials provided with the distribution.
15
+ * * Neither the name of Redis nor the names of its contributors may be used
16
+ * to endorse or promote products derived from this software without
17
+ * specific prior written permission.
18
+ *
19
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
+ * POSSIBILITY OF SUCH DAMAGE.
30
+ */
31
+
32
+ #include "fmacros.h"
33
+ #include <string.h>
34
+ #include <stdlib.h>
35
+ #include <unistd.h>
36
+ #include <assert.h>
37
+ #include <errno.h>
38
+ #include <ctype.h>
39
+
40
+ #include "hiredis.h"
41
+ #include "net.h"
42
+ #include "sds.h"
43
+
44
+ static redisReply *createReplyObject(int type);
45
+ static void *createStringObject(const redisReadTask *task, char *str, size_t len);
46
+ static void *createArrayObject(const redisReadTask *task, int elements);
47
+ static void *createIntegerObject(const redisReadTask *task, long long value);
48
+ static void *createNilObject(const redisReadTask *task);
49
+
50
+ /* Default set of functions to build the reply. Keep in mind that such a
51
+ * function returning NULL is interpreted as OOM. */
52
+ static redisReplyObjectFunctions defaultFunctions = {
53
+ createStringObject,
54
+ createArrayObject,
55
+ createIntegerObject,
56
+ createNilObject,
57
+ freeReplyObject
58
+ };
59
+
60
+ /* Create a reply object */
61
+ static redisReply *createReplyObject(int type) {
62
+ redisReply *r = calloc(1,sizeof(*r));
63
+
64
+ if (r == NULL)
65
+ return NULL;
66
+
67
+ r->type = type;
68
+ return r;
69
+ }
70
+
71
+ /* Free a reply object */
72
+ void freeReplyObject(void *reply) {
73
+ redisReply *r = reply;
74
+ size_t j;
75
+
76
+ switch(r->type) {
77
+ case REDIS_REPLY_INTEGER:
78
+ break; /* Nothing to free */
79
+ case REDIS_REPLY_ARRAY:
80
+ if (r->element != NULL) {
81
+ for (j = 0; j < r->elements; j++)
82
+ if (r->element[j] != NULL)
83
+ freeReplyObject(r->element[j]);
84
+ free(r->element);
85
+ }
86
+ break;
87
+ case REDIS_REPLY_ERROR:
88
+ case REDIS_REPLY_STATUS:
89
+ case REDIS_REPLY_STRING:
90
+ if (r->str != NULL)
91
+ free(r->str);
92
+ break;
93
+ }
94
+ free(r);
95
+ }
96
+
97
+ static void *createStringObject(const redisReadTask *task, char *str, size_t len) {
98
+ redisReply *r, *parent;
99
+ char *buf;
100
+
101
+ r = createReplyObject(task->type);
102
+ if (r == NULL)
103
+ return NULL;
104
+
105
+ buf = malloc(len+1);
106
+ if (buf == NULL) {
107
+ freeReplyObject(r);
108
+ return NULL;
109
+ }
110
+
111
+ assert(task->type == REDIS_REPLY_ERROR ||
112
+ task->type == REDIS_REPLY_STATUS ||
113
+ task->type == REDIS_REPLY_STRING);
114
+
115
+ /* Copy string value */
116
+ memcpy(buf,str,len);
117
+ buf[len] = '\0';
118
+ r->str = buf;
119
+ r->len = len;
120
+
121
+ if (task->parent) {
122
+ parent = task->parent->obj;
123
+ assert(parent->type == REDIS_REPLY_ARRAY);
124
+ parent->element[task->idx] = r;
125
+ }
126
+ return r;
127
+ }
128
+
129
+ static void *createArrayObject(const redisReadTask *task, int elements) {
130
+ redisReply *r, *parent;
131
+
132
+ r = createReplyObject(REDIS_REPLY_ARRAY);
133
+ if (r == NULL)
134
+ return NULL;
135
+
136
+ if (elements > 0) {
137
+ r->element = calloc(elements,sizeof(redisReply*));
138
+ if (r->element == NULL) {
139
+ freeReplyObject(r);
140
+ return NULL;
141
+ }
142
+ }
143
+
144
+ r->elements = elements;
145
+
146
+ if (task->parent) {
147
+ parent = task->parent->obj;
148
+ assert(parent->type == REDIS_REPLY_ARRAY);
149
+ parent->element[task->idx] = r;
150
+ }
151
+ return r;
152
+ }
153
+
154
+ static void *createIntegerObject(const redisReadTask *task, long long value) {
155
+ redisReply *r, *parent;
156
+
157
+ r = createReplyObject(REDIS_REPLY_INTEGER);
158
+ if (r == NULL)
159
+ return NULL;
160
+
161
+ r->integer = value;
162
+
163
+ if (task->parent) {
164
+ parent = task->parent->obj;
165
+ assert(parent->type == REDIS_REPLY_ARRAY);
166
+ parent->element[task->idx] = r;
167
+ }
168
+ return r;
169
+ }
170
+
171
+ static void *createNilObject(const redisReadTask *task) {
172
+ redisReply *r, *parent;
173
+
174
+ r = createReplyObject(REDIS_REPLY_NIL);
175
+ if (r == NULL)
176
+ return NULL;
177
+
178
+ if (task->parent) {
179
+ parent = task->parent->obj;
180
+ assert(parent->type == REDIS_REPLY_ARRAY);
181
+ parent->element[task->idx] = r;
182
+ }
183
+ return r;
184
+ }
185
+
186
+ static void __redisReaderSetError(redisReader *r, int type, const char *str) {
187
+ size_t len;
188
+
189
+ if (r->reply != NULL && r->fn && r->fn->freeObject) {
190
+ r->fn->freeObject(r->reply);
191
+ r->reply = NULL;
192
+ }
193
+
194
+ /* Clear input buffer on errors. */
195
+ if (r->buf != NULL) {
196
+ sdsfree(r->buf);
197
+ r->buf = NULL;
198
+ r->pos = r->len = 0;
199
+ }
200
+
201
+ /* Reset task stack. */
202
+ r->ridx = -1;
203
+
204
+ /* Set error. */
205
+ r->err = type;
206
+ len = strlen(str);
207
+ len = len < (sizeof(r->errstr)-1) ? len : (sizeof(r->errstr)-1);
208
+ memcpy(r->errstr,str,len);
209
+ r->errstr[len] = '\0';
210
+ }
211
+
212
+ static size_t chrtos(char *buf, size_t size, char byte) {
213
+ size_t len = 0;
214
+
215
+ switch(byte) {
216
+ case '\\':
217
+ case '"':
218
+ len = snprintf(buf,size,"\"\\%c\"",byte);
219
+ break;
220
+ case '\n': len = snprintf(buf,size,"\"\\n\""); break;
221
+ case '\r': len = snprintf(buf,size,"\"\\r\""); break;
222
+ case '\t': len = snprintf(buf,size,"\"\\t\""); break;
223
+ case '\a': len = snprintf(buf,size,"\"\\a\""); break;
224
+ case '\b': len = snprintf(buf,size,"\"\\b\""); break;
225
+ default:
226
+ if (isprint(byte))
227
+ len = snprintf(buf,size,"\"%c\"",byte);
228
+ else
229
+ len = snprintf(buf,size,"\"\\x%02x\"",(unsigned char)byte);
230
+ break;
231
+ }
232
+
233
+ return len;
234
+ }
235
+
236
+ static void __redisReaderSetErrorProtocolByte(redisReader *r, char byte) {
237
+ char cbuf[8], sbuf[128];
238
+
239
+ chrtos(cbuf,sizeof(cbuf),byte);
240
+ snprintf(sbuf,sizeof(sbuf),
241
+ "Protocol error, got %s as reply type byte", cbuf);
242
+ __redisReaderSetError(r,REDIS_ERR_PROTOCOL,sbuf);
243
+ }
244
+
245
+ static void __redisReaderSetErrorOOM(redisReader *r) {
246
+ __redisReaderSetError(r,REDIS_ERR_OOM,"Out of memory");
247
+ }
248
+
249
+ static char *readBytes(redisReader *r, unsigned int bytes) {
250
+ char *p;
251
+ if (r->len-r->pos >= bytes) {
252
+ p = r->buf+r->pos;
253
+ r->pos += bytes;
254
+ return p;
255
+ }
256
+ return NULL;
257
+ }
258
+
259
+ /* Find pointer to \r\n. */
260
+ static char *seekNewline(char *s, size_t len) {
261
+ int pos = 0;
262
+ int _len = len-1;
263
+
264
+ /* Position should be < len-1 because the character at "pos" should be
265
+ * followed by a \n. Note that strchr cannot be used because it doesn't
266
+ * allow to search a limited length and the buffer that is being searched
267
+ * might not have a trailing NULL character. */
268
+ while (pos < _len) {
269
+ while(pos < _len && s[pos] != '\r') pos++;
270
+ if (s[pos] != '\r') {
271
+ /* Not found. */
272
+ return NULL;
273
+ } else {
274
+ if (s[pos+1] == '\n') {
275
+ /* Found. */
276
+ return s+pos;
277
+ } else {
278
+ /* Continue searching. */
279
+ pos++;
280
+ }
281
+ }
282
+ }
283
+ return NULL;
284
+ }
285
+
286
+ /* Read a long long value starting at *s, under the assumption that it will be
287
+ * terminated by \r\n. Ambiguously returns -1 for unexpected input. */
288
+ static long long readLongLong(char *s) {
289
+ long long v = 0;
290
+ int dec, mult = 1;
291
+ char c;
292
+
293
+ if (*s == '-') {
294
+ mult = -1;
295
+ s++;
296
+ } else if (*s == '+') {
297
+ mult = 1;
298
+ s++;
299
+ }
300
+
301
+ while ((c = *(s++)) != '\r') {
302
+ dec = c - '0';
303
+ if (dec >= 0 && dec < 10) {
304
+ v *= 10;
305
+ v += dec;
306
+ } else {
307
+ /* Should not happen... */
308
+ return -1;
309
+ }
310
+ }
311
+
312
+ return mult*v;
313
+ }
314
+
315
+ static char *readLine(redisReader *r, int *_len) {
316
+ char *p, *s;
317
+ int len;
318
+
319
+ p = r->buf+r->pos;
320
+ s = seekNewline(p,(r->len-r->pos));
321
+ if (s != NULL) {
322
+ len = s-(r->buf+r->pos);
323
+ r->pos += len+2; /* skip \r\n */
324
+ if (_len) *_len = len;
325
+ return p;
326
+ }
327
+ return NULL;
328
+ }
329
+
330
+ static void moveToNextTask(redisReader *r) {
331
+ redisReadTask *cur, *prv;
332
+ while (r->ridx >= 0) {
333
+ /* Return a.s.a.p. when the stack is now empty. */
334
+ if (r->ridx == 0) {
335
+ r->ridx--;
336
+ return;
337
+ }
338
+
339
+ cur = &(r->rstack[r->ridx]);
340
+ prv = &(r->rstack[r->ridx-1]);
341
+ assert(prv->type == REDIS_REPLY_ARRAY);
342
+ if (cur->idx == prv->elements-1) {
343
+ r->ridx--;
344
+ } else {
345
+ /* Reset the type because the next item can be anything */
346
+ assert(cur->idx < prv->elements);
347
+ cur->type = -1;
348
+ cur->elements = -1;
349
+ cur->idx++;
350
+ return;
351
+ }
352
+ }
353
+ }
354
+
355
+ static int processLineItem(redisReader *r) {
356
+ redisReadTask *cur = &(r->rstack[r->ridx]);
357
+ void *obj;
358
+ char *p;
359
+ int len;
360
+
361
+ if ((p = readLine(r,&len)) != NULL) {
362
+ if (cur->type == REDIS_REPLY_INTEGER) {
363
+ if (r->fn && r->fn->createInteger)
364
+ obj = r->fn->createInteger(cur,readLongLong(p));
365
+ else
366
+ obj = (void*)REDIS_REPLY_INTEGER;
367
+ } else {
368
+ /* Type will be error or status. */
369
+ if (r->fn && r->fn->createString)
370
+ obj = r->fn->createString(cur,p,len);
371
+ else
372
+ obj = (void*)(size_t)(cur->type);
373
+ }
374
+
375
+ if (obj == NULL) {
376
+ __redisReaderSetErrorOOM(r);
377
+ return REDIS_ERR;
378
+ }
379
+
380
+ /* Set reply if this is the root object. */
381
+ if (r->ridx == 0) r->reply = obj;
382
+ moveToNextTask(r);
383
+ return REDIS_OK;
384
+ }
385
+
386
+ return REDIS_ERR;
387
+ }
388
+
389
+ static int processBulkItem(redisReader *r) {
390
+ redisReadTask *cur = &(r->rstack[r->ridx]);
391
+ void *obj = NULL;
392
+ char *p, *s;
393
+ long len;
394
+ unsigned long bytelen;
395
+ int success = 0;
396
+
397
+ p = r->buf+r->pos;
398
+ s = seekNewline(p,r->len-r->pos);
399
+ if (s != NULL) {
400
+ p = r->buf+r->pos;
401
+ bytelen = s-(r->buf+r->pos)+2; /* include \r\n */
402
+ len = readLongLong(p);
403
+
404
+ if (len < 0) {
405
+ /* The nil object can always be created. */
406
+ if (r->fn && r->fn->createNil)
407
+ obj = r->fn->createNil(cur);
408
+ else
409
+ obj = (void*)REDIS_REPLY_NIL;
410
+ success = 1;
411
+ } else {
412
+ /* Only continue when the buffer contains the entire bulk item. */
413
+ bytelen += len+2; /* include \r\n */
414
+ if (r->pos+bytelen <= r->len) {
415
+ if (r->fn && r->fn->createString)
416
+ obj = r->fn->createString(cur,s+2,len);
417
+ else
418
+ obj = (void*)REDIS_REPLY_STRING;
419
+ success = 1;
420
+ }
421
+ }
422
+
423
+ /* Proceed when obj was created. */
424
+ if (success) {
425
+ if (obj == NULL) {
426
+ __redisReaderSetErrorOOM(r);
427
+ return REDIS_ERR;
428
+ }
429
+
430
+ r->pos += bytelen;
431
+
432
+ /* Set reply if this is the root object. */
433
+ if (r->ridx == 0) r->reply = obj;
434
+ moveToNextTask(r);
435
+ return REDIS_OK;
436
+ }
437
+ }
438
+
439
+ return REDIS_ERR;
440
+ }
441
+
442
+ static int processMultiBulkItem(redisReader *r) {
443
+ redisReadTask *cur = &(r->rstack[r->ridx]);
444
+ void *obj;
445
+ char *p;
446
+ long elements;
447
+ int root = 0;
448
+
449
+ /* Set error for nested multi bulks with depth > 2 */
450
+ if (r->ridx == 3) {
451
+ __redisReaderSetError(r,REDIS_ERR_PROTOCOL,
452
+ "No support for nested multi bulk replies with depth > 2");
453
+ return REDIS_ERR;
454
+ }
455
+
456
+ if ((p = readLine(r,NULL)) != NULL) {
457
+ elements = readLongLong(p);
458
+ root = (r->ridx == 0);
459
+
460
+ if (elements == -1) {
461
+ if (r->fn && r->fn->createNil)
462
+ obj = r->fn->createNil(cur);
463
+ else
464
+ obj = (void*)REDIS_REPLY_NIL;
465
+
466
+ if (obj == NULL) {
467
+ __redisReaderSetErrorOOM(r);
468
+ return REDIS_ERR;
469
+ }
470
+
471
+ moveToNextTask(r);
472
+ } else {
473
+ if (r->fn && r->fn->createArray)
474
+ obj = r->fn->createArray(cur,elements);
475
+ else
476
+ obj = (void*)REDIS_REPLY_ARRAY;
477
+
478
+ if (obj == NULL) {
479
+ __redisReaderSetErrorOOM(r);
480
+ return REDIS_ERR;
481
+ }
482
+
483
+ /* Modify task stack when there are more than 0 elements. */
484
+ if (elements > 0) {
485
+ cur->elements = elements;
486
+ cur->obj = obj;
487
+ r->ridx++;
488
+ r->rstack[r->ridx].type = -1;
489
+ r->rstack[r->ridx].elements = -1;
490
+ r->rstack[r->ridx].idx = 0;
491
+ r->rstack[r->ridx].obj = NULL;
492
+ r->rstack[r->ridx].parent = cur;
493
+ r->rstack[r->ridx].privdata = r->privdata;
494
+ } else {
495
+ moveToNextTask(r);
496
+ }
497
+ }
498
+
499
+ /* Set reply if this is the root object. */
500
+ if (root) r->reply = obj;
501
+ return REDIS_OK;
502
+ }
503
+
504
+ return REDIS_ERR;
505
+ }
506
+
507
+ static int processItem(redisReader *r) {
508
+ redisReadTask *cur = &(r->rstack[r->ridx]);
509
+ char *p;
510
+
511
+ /* check if we need to read type */
512
+ if (cur->type < 0) {
513
+ if ((p = readBytes(r,1)) != NULL) {
514
+ switch (p[0]) {
515
+ case '-':
516
+ cur->type = REDIS_REPLY_ERROR;
517
+ break;
518
+ case '+':
519
+ cur->type = REDIS_REPLY_STATUS;
520
+ break;
521
+ case ':':
522
+ cur->type = REDIS_REPLY_INTEGER;
523
+ break;
524
+ case '$':
525
+ cur->type = REDIS_REPLY_STRING;
526
+ break;
527
+ case '*':
528
+ cur->type = REDIS_REPLY_ARRAY;
529
+ break;
530
+ default:
531
+ __redisReaderSetErrorProtocolByte(r,*p);
532
+ return REDIS_ERR;
533
+ }
534
+ } else {
535
+ /* could not consume 1 byte */
536
+ return REDIS_ERR;
537
+ }
538
+ }
539
+
540
+ /* process typed item */
541
+ switch(cur->type) {
542
+ case REDIS_REPLY_ERROR:
543
+ case REDIS_REPLY_STATUS:
544
+ case REDIS_REPLY_INTEGER:
545
+ return processLineItem(r);
546
+ case REDIS_REPLY_STRING:
547
+ return processBulkItem(r);
548
+ case REDIS_REPLY_ARRAY:
549
+ return processMultiBulkItem(r);
550
+ default:
551
+ assert(NULL);
552
+ return REDIS_ERR; /* Avoid warning. */
553
+ }
554
+ }
555
+
556
+ redisReader *redisReaderCreate(void) {
557
+ redisReader *r;
558
+
559
+ r = calloc(sizeof(redisReader),1);
560
+ if (r == NULL)
561
+ return NULL;
562
+
563
+ r->err = 0;
564
+ r->errstr[0] = '\0';
565
+ r->fn = &defaultFunctions;
566
+ r->buf = sdsempty();
567
+ if (r->buf == NULL) {
568
+ free(r);
569
+ return NULL;
570
+ }
571
+
572
+ r->ridx = -1;
573
+ return r;
574
+ }
575
+
576
+ void redisReaderFree(redisReader *r) {
577
+ if (r->reply != NULL && r->fn && r->fn->freeObject)
578
+ r->fn->freeObject(r->reply);
579
+ if (r->buf != NULL)
580
+ sdsfree(r->buf);
581
+ free(r);
582
+ }
583
+
584
+ int redisReaderFeed(redisReader *r, const char *buf, size_t len) {
585
+ sds newbuf;
586
+
587
+ /* Return early when this reader is in an erroneous state. */
588
+ if (r->err)
589
+ return REDIS_ERR;
590
+
591
+ /* Copy the provided buffer. */
592
+ if (buf != NULL && len >= 1) {
593
+ /* Destroy internal buffer when it is empty and is quite large. */
594
+ if (r->len == 0 && sdsavail(r->buf) > 16*1024) {
595
+ sdsfree(r->buf);
596
+ r->buf = sdsempty();
597
+ r->pos = 0;
598
+
599
+ /* r->buf should not be NULL since we just free'd a larger one. */
600
+ assert(r->buf != NULL);
601
+ }
602
+
603
+ newbuf = sdscatlen(r->buf,buf,len);
604
+ if (newbuf == NULL) {
605
+ __redisReaderSetErrorOOM(r);
606
+ return REDIS_ERR;
607
+ }
608
+
609
+ r->buf = newbuf;
610
+ r->len = sdslen(r->buf);
611
+ }
612
+
613
+ return REDIS_OK;
614
+ }
615
+
616
+ int redisReaderGetReply(redisReader *r, void **reply) {
617
+ /* Default target pointer to NULL. */
618
+ if (reply != NULL)
619
+ *reply = NULL;
620
+
621
+ /* Return early when this reader is in an erroneous state. */
622
+ if (r->err)
623
+ return REDIS_ERR;
624
+
625
+ /* When the buffer is empty, there will never be a reply. */
626
+ if (r->len == 0)
627
+ return REDIS_OK;
628
+
629
+ /* Set first item to process when the stack is empty. */
630
+ if (r->ridx == -1) {
631
+ r->rstack[0].type = -1;
632
+ r->rstack[0].elements = -1;
633
+ r->rstack[0].idx = -1;
634
+ r->rstack[0].obj = NULL;
635
+ r->rstack[0].parent = NULL;
636
+ r->rstack[0].privdata = r->privdata;
637
+ r->ridx = 0;
638
+ }
639
+
640
+ /* Process items in reply. */
641
+ while (r->ridx >= 0)
642
+ if (processItem(r) != REDIS_OK)
643
+ break;
644
+
645
+ /* Return ASAP when an error occurred. */
646
+ if (r->err)
647
+ return REDIS_ERR;
648
+
649
+ /* Discard part of the buffer when we've consumed at least 1k, to avoid
650
+ * doing unnecessary calls to memmove() in sds.c. */
651
+ if (r->pos >= 1024) {
652
+ r->buf = sdsrange(r->buf,r->pos,-1);
653
+ r->pos = 0;
654
+ r->len = sdslen(r->buf);
655
+ }
656
+
657
+ /* Emit a reply when there is one. */
658
+ if (r->ridx == -1) {
659
+ if (reply != NULL)
660
+ *reply = r->reply;
661
+ r->reply = NULL;
662
+ }
663
+ return REDIS_OK;
664
+ }
665
+
666
+ /* Calculate the number of bytes needed to represent an integer as string. */
667
+ static int intlen(int i) {
668
+ int len = 0;
669
+ if (i < 0) {
670
+ len++;
671
+ i = -i;
672
+ }
673
+ do {
674
+ len++;
675
+ i /= 10;
676
+ } while(i);
677
+ return len;
678
+ }
679
+
680
+ /* Helper that calculates the bulk length given a certain string length. */
681
+ static size_t bulklen(size_t len) {
682
+ return 1+intlen(len)+2+len+2;
683
+ }
684
+
685
+ int redisvFormatCommand(char **target, const char *format, va_list ap) {
686
+ const char *c = format;
687
+ char *cmd = NULL; /* final command */
688
+ int pos; /* position in final command */
689
+ sds curarg, newarg; /* current argument */
690
+ int touched = 0; /* was the current argument touched? */
691
+ char **curargv = NULL, **newargv = NULL;
692
+ int argc = 0;
693
+ int totlen = 0;
694
+ int j;
695
+
696
+ /* Abort if there is not target to set */
697
+ if (target == NULL)
698
+ return -1;
699
+
700
+ /* Build the command string accordingly to protocol */
701
+ curarg = sdsempty();
702
+ if (curarg == NULL)
703
+ return -1;
704
+
705
+ while(*c != '\0') {
706
+ if (*c != '%' || c[1] == '\0') {
707
+ if (*c == ' ') {
708
+ if (touched) {
709
+ newargv = realloc(curargv,sizeof(char*)*(argc+1));
710
+ if (newargv == NULL) goto err;
711
+ curargv = newargv;
712
+ curargv[argc++] = curarg;
713
+ totlen += bulklen(sdslen(curarg));
714
+
715
+ /* curarg is put in argv so it can be overwritten. */
716
+ curarg = sdsempty();
717
+ if (curarg == NULL) goto err;
718
+ touched = 0;
719
+ }
720
+ } else {
721
+ newarg = sdscatlen(curarg,c,1);
722
+ if (newarg == NULL) goto err;
723
+ curarg = newarg;
724
+ touched = 1;
725
+ }
726
+ } else {
727
+ char *arg;
728
+ size_t size;
729
+
730
+ /* Set newarg so it can be checked even if it is not touched. */
731
+ newarg = curarg;
732
+
733
+ switch(c[1]) {
734
+ case 's':
735
+ arg = va_arg(ap,char*);
736
+ size = strlen(arg);
737
+ if (size > 0)
738
+ newarg = sdscatlen(curarg,arg,size);
739
+ break;
740
+ case 'b':
741
+ arg = va_arg(ap,char*);
742
+ size = va_arg(ap,size_t);
743
+ if (size > 0)
744
+ newarg = sdscatlen(curarg,arg,size);
745
+ break;
746
+ case '%':
747
+ newarg = sdscat(curarg,"%");
748
+ break;
749
+ default:
750
+ /* Try to detect printf format */
751
+ {
752
+ char _format[16];
753
+ const char *_p = c+1;
754
+ size_t _l = 0;
755
+ va_list _cpy;
756
+
757
+ /* Flags */
758
+ if (*_p != '\0' && *_p == '#') _p++;
759
+ if (*_p != '\0' && *_p == '0') _p++;
760
+ if (*_p != '\0' && *_p == '-') _p++;
761
+ if (*_p != '\0' && *_p == ' ') _p++;
762
+ if (*_p != '\0' && *_p == '+') _p++;
763
+
764
+ /* Field width */
765
+ while (*_p != '\0' && isdigit(*_p)) _p++;
766
+
767
+ /* Precision */
768
+ if (*_p == '.') {
769
+ _p++;
770
+ while (*_p != '\0' && isdigit(*_p)) _p++;
771
+ }
772
+
773
+ /* Copy va_list before consuming with va_arg */
774
+ va_copy(_cpy,ap);
775
+
776
+ /* Integer conversion (without modifiers) */
777
+ if (strchr("diouxX",*_p) != NULL) {
778
+ va_arg(ap,int);
779
+ goto fmt_valid;
780
+ }
781
+
782
+ /* Double conversion (without modifiers) */
783
+ if (strchr("eEfFgGaA",*_p) != NULL) {
784
+ va_arg(ap,double);
785
+ goto fmt_valid;
786
+ }
787
+
788
+ /* Size: char */
789
+ if (_p[0] == 'h' && _p[1] == 'h') {
790
+ _p += 2;
791
+ if (*_p != '\0' && strchr("diouxX",*_p) != NULL) {
792
+ va_arg(ap,int); /* char gets promoted to int */
793
+ goto fmt_valid;
794
+ }
795
+ goto fmt_invalid;
796
+ }
797
+
798
+ /* Size: short */
799
+ if (_p[0] == 'h') {
800
+ _p += 1;
801
+ if (*_p != '\0' && strchr("diouxX",*_p) != NULL) {
802
+ va_arg(ap,int); /* short gets promoted to int */
803
+ goto fmt_valid;
804
+ }
805
+ goto fmt_invalid;
806
+ }
807
+
808
+ /* Size: long long */
809
+ if (_p[0] == 'l' && _p[1] == 'l') {
810
+ _p += 2;
811
+ if (*_p != '\0' && strchr("diouxX",*_p) != NULL) {
812
+ va_arg(ap,long long);
813
+ goto fmt_valid;
814
+ }
815
+ goto fmt_invalid;
816
+ }
817
+
818
+ /* Size: long */
819
+ if (_p[0] == 'l') {
820
+ _p += 1;
821
+ if (*_p != '\0' && strchr("diouxX",*_p) != NULL) {
822
+ va_arg(ap,long);
823
+ goto fmt_valid;
824
+ }
825
+ goto fmt_invalid;
826
+ }
827
+
828
+ fmt_invalid:
829
+ va_end(_cpy);
830
+ goto err;
831
+
832
+ fmt_valid:
833
+ _l = (_p+1)-c;
834
+ if (_l < sizeof(_format)-2) {
835
+ memcpy(_format,c,_l);
836
+ _format[_l] = '\0';
837
+ newarg = sdscatvprintf(curarg,_format,_cpy);
838
+
839
+ /* Update current position (note: outer blocks
840
+ * increment c twice so compensate here) */
841
+ c = _p-1;
842
+ }
843
+
844
+ va_end(_cpy);
845
+ break;
846
+ }
847
+ }
848
+
849
+ if (newarg == NULL) goto err;
850
+ curarg = newarg;
851
+
852
+ touched = 1;
853
+ c++;
854
+ }
855
+ c++;
856
+ }
857
+
858
+ /* Add the last argument if needed */
859
+ if (touched) {
860
+ newargv = realloc(curargv,sizeof(char*)*(argc+1));
861
+ if (newargv == NULL) goto err;
862
+ curargv = newargv;
863
+ curargv[argc++] = curarg;
864
+ totlen += bulklen(sdslen(curarg));
865
+ } else {
866
+ sdsfree(curarg);
867
+ }
868
+
869
+ /* Clear curarg because it was put in curargv or was free'd. */
870
+ curarg = NULL;
871
+
872
+ /* Add bytes needed to hold multi bulk count */
873
+ totlen += 1+intlen(argc)+2;
874
+
875
+ /* Build the command at protocol level */
876
+ cmd = malloc(totlen+1);
877
+ if (cmd == NULL) goto err;
878
+
879
+ pos = sprintf(cmd,"*%d\r\n",argc);
880
+ for (j = 0; j < argc; j++) {
881
+ pos += sprintf(cmd+pos,"$%zu\r\n",sdslen(curargv[j]));
882
+ memcpy(cmd+pos,curargv[j],sdslen(curargv[j]));
883
+ pos += sdslen(curargv[j]);
884
+ sdsfree(curargv[j]);
885
+ cmd[pos++] = '\r';
886
+ cmd[pos++] = '\n';
887
+ }
888
+ assert(pos == totlen);
889
+ cmd[pos] = '\0';
890
+
891
+ free(curargv);
892
+ *target = cmd;
893
+ return totlen;
894
+
895
+ err:
896
+ while(argc--)
897
+ sdsfree(curargv[argc]);
898
+ free(curargv);
899
+
900
+ if (curarg != NULL)
901
+ sdsfree(curarg);
902
+
903
+ /* No need to check cmd since it is the last statement that can fail,
904
+ * but do it anyway to be as defensive as possible. */
905
+ if (cmd != NULL)
906
+ free(cmd);
907
+
908
+ return -1;
909
+ }
910
+
911
+ /* Format a command according to the Redis protocol. This function
912
+ * takes a format similar to printf:
913
+ *
914
+ * %s represents a C null terminated string you want to interpolate
915
+ * %b represents a binary safe string
916
+ *
917
+ * When using %b you need to provide both the pointer to the string
918
+ * and the length in bytes. Examples:
919
+ *
920
+ * len = redisFormatCommand(target, "GET %s", mykey);
921
+ * len = redisFormatCommand(target, "SET %s %b", mykey, myval, myvallen);
922
+ */
923
+ int redisFormatCommand(char **target, const char *format, ...) {
924
+ va_list ap;
925
+ int len;
926
+ va_start(ap,format);
927
+ len = redisvFormatCommand(target,format,ap);
928
+ va_end(ap);
929
+ return len;
930
+ }
931
+
932
+ /* Format a command according to the Redis protocol. This function takes the
933
+ * number of arguments, an array with arguments and an array with their
934
+ * lengths. If the latter is set to NULL, strlen will be used to compute the
935
+ * argument lengths.
936
+ */
937
+ int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen) {
938
+ char *cmd = NULL; /* final command */
939
+ int pos; /* position in final command */
940
+ size_t len;
941
+ int totlen, j;
942
+
943
+ /* Calculate number of bytes needed for the command */
944
+ totlen = 1+intlen(argc)+2;
945
+ for (j = 0; j < argc; j++) {
946
+ len = argvlen ? argvlen[j] : strlen(argv[j]);
947
+ totlen += bulklen(len);
948
+ }
949
+
950
+ /* Build the command at protocol level */
951
+ cmd = malloc(totlen+1);
952
+ if (cmd == NULL)
953
+ return -1;
954
+
955
+ pos = sprintf(cmd,"*%d\r\n",argc);
956
+ for (j = 0; j < argc; j++) {
957
+ len = argvlen ? argvlen[j] : strlen(argv[j]);
958
+ pos += sprintf(cmd+pos,"$%zu\r\n",len);
959
+ memcpy(cmd+pos,argv[j],len);
960
+ pos += len;
961
+ cmd[pos++] = '\r';
962
+ cmd[pos++] = '\n';
963
+ }
964
+ assert(pos == totlen);
965
+ cmd[pos] = '\0';
966
+
967
+ *target = cmd;
968
+ return totlen;
969
+ }
970
+
971
+ void __redisSetError(redisContext *c, int type, const char *str) {
972
+ size_t len;
973
+
974
+ c->err = type;
975
+ if (str != NULL) {
976
+ len = strlen(str);
977
+ len = len < (sizeof(c->errstr)-1) ? len : (sizeof(c->errstr)-1);
978
+ memcpy(c->errstr,str,len);
979
+ c->errstr[len] = '\0';
980
+ } else {
981
+ /* Only REDIS_ERR_IO may lack a description! */
982
+ assert(type == REDIS_ERR_IO);
983
+ strerror_r(errno,c->errstr,sizeof(c->errstr));
984
+ }
985
+ }
986
+
987
+ static redisContext *redisContextInit(void) {
988
+ redisContext *c;
989
+
990
+ c = calloc(1,sizeof(redisContext));
991
+ if (c == NULL)
992
+ return NULL;
993
+
994
+ c->err = 0;
995
+ c->errstr[0] = '\0';
996
+ c->obuf = sdsempty();
997
+ c->reader = redisReaderCreate();
998
+ return c;
999
+ }
1000
+
1001
+ void redisFree(redisContext *c) {
1002
+ if (c->fd > 0)
1003
+ close(c->fd);
1004
+ if (c->obuf != NULL)
1005
+ sdsfree(c->obuf);
1006
+ if (c->reader != NULL)
1007
+ redisReaderFree(c->reader);
1008
+ free(c);
1009
+ }
1010
+
1011
+ /* Connect to a Redis instance. On error the field error in the returned
1012
+ * context will be set to the return value of the error function.
1013
+ * When no set of reply functions is given, the default set will be used. */
1014
+ redisContext *redisConnect(const char *ip, int port) {
1015
+ redisContext *c = redisContextInit();
1016
+ c->flags |= REDIS_BLOCK;
1017
+ redisContextConnectTcp(c,ip,port,NULL);
1018
+ return c;
1019
+ }
1020
+
1021
+ redisContext *redisConnectWithTimeout(const char *ip, int port, struct timeval tv) {
1022
+ redisContext *c = redisContextInit();
1023
+ c->flags |= REDIS_BLOCK;
1024
+ redisContextConnectTcp(c,ip,port,&tv);
1025
+ return c;
1026
+ }
1027
+
1028
+ redisContext *redisConnectNonBlock(const char *ip, int port) {
1029
+ redisContext *c = redisContextInit();
1030
+ c->flags &= ~REDIS_BLOCK;
1031
+ redisContextConnectTcp(c,ip,port,NULL);
1032
+ return c;
1033
+ }
1034
+
1035
+ redisContext *redisConnectUnix(const char *path) {
1036
+ redisContext *c = redisContextInit();
1037
+ c->flags |= REDIS_BLOCK;
1038
+ redisContextConnectUnix(c,path,NULL);
1039
+ return c;
1040
+ }
1041
+
1042
+ redisContext *redisConnectUnixWithTimeout(const char *path, struct timeval tv) {
1043
+ redisContext *c = redisContextInit();
1044
+ c->flags |= REDIS_BLOCK;
1045
+ redisContextConnectUnix(c,path,&tv);
1046
+ return c;
1047
+ }
1048
+
1049
+ redisContext *redisConnectUnixNonBlock(const char *path) {
1050
+ redisContext *c = redisContextInit();
1051
+ c->flags &= ~REDIS_BLOCK;
1052
+ redisContextConnectUnix(c,path,NULL);
1053
+ return c;
1054
+ }
1055
+
1056
+ /* Set read/write timeout on a blocking socket. */
1057
+ int redisSetTimeout(redisContext *c, struct timeval tv) {
1058
+ if (c->flags & REDIS_BLOCK)
1059
+ return redisContextSetTimeout(c,tv);
1060
+ return REDIS_ERR;
1061
+ }
1062
+
1063
+ /* Use this function to handle a read event on the descriptor. It will try
1064
+ * and read some bytes from the socket and feed them to the reply parser.
1065
+ *
1066
+ * After this function is called, you may use redisContextReadReply to
1067
+ * see if there is a reply available. */
1068
+ int redisBufferRead(redisContext *c) {
1069
+ char buf[2048];
1070
+ int nread;
1071
+
1072
+ /* Return early when the context has seen an error. */
1073
+ if (c->err)
1074
+ return REDIS_ERR;
1075
+
1076
+ nread = read(c->fd,buf,sizeof(buf));
1077
+ if (nread == -1) {
1078
+ if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
1079
+ /* Try again later */
1080
+ } else {
1081
+ __redisSetError(c,REDIS_ERR_IO,NULL);
1082
+ return REDIS_ERR;
1083
+ }
1084
+ } else if (nread == 0) {
1085
+ __redisSetError(c,REDIS_ERR_EOF,"Server closed the connection");
1086
+ return REDIS_ERR;
1087
+ } else {
1088
+ if (redisReaderFeed(c->reader,buf,nread) != REDIS_OK) {
1089
+ __redisSetError(c,c->reader->err,c->reader->errstr);
1090
+ return REDIS_ERR;
1091
+ }
1092
+ }
1093
+ return REDIS_OK;
1094
+ }
1095
+
1096
+ /* Write the output buffer to the socket.
1097
+ *
1098
+ * Returns REDIS_OK when the buffer is empty, or (a part of) the buffer was
1099
+ * succesfully written to the socket. When the buffer is empty after the
1100
+ * write operation, "done" is set to 1 (if given).
1101
+ *
1102
+ * Returns REDIS_ERR if an error occured trying to write and sets
1103
+ * c->errstr to hold the appropriate error string.
1104
+ */
1105
+ int redisBufferWrite(redisContext *c, int *done) {
1106
+ int nwritten;
1107
+
1108
+ /* Return early when the context has seen an error. */
1109
+ if (c->err)
1110
+ return REDIS_ERR;
1111
+
1112
+ if (sdslen(c->obuf) > 0) {
1113
+ nwritten = write(c->fd,c->obuf,sdslen(c->obuf));
1114
+ if (nwritten == -1) {
1115
+ if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
1116
+ /* Try again later */
1117
+ } else {
1118
+ __redisSetError(c,REDIS_ERR_IO,NULL);
1119
+ return REDIS_ERR;
1120
+ }
1121
+ } else if (nwritten > 0) {
1122
+ if (nwritten == (signed)sdslen(c->obuf)) {
1123
+ sdsfree(c->obuf);
1124
+ c->obuf = sdsempty();
1125
+ } else {
1126
+ c->obuf = sdsrange(c->obuf,nwritten,-1);
1127
+ }
1128
+ }
1129
+ }
1130
+ if (done != NULL) *done = (sdslen(c->obuf) == 0);
1131
+ return REDIS_OK;
1132
+ }
1133
+
1134
+ /* Internal helper function to try and get a reply from the reader,
1135
+ * or set an error in the context otherwise. */
1136
+ int redisGetReplyFromReader(redisContext *c, void **reply) {
1137
+ if (redisReaderGetReply(c->reader,reply) == REDIS_ERR) {
1138
+ __redisSetError(c,c->reader->err,c->reader->errstr);
1139
+ return REDIS_ERR;
1140
+ }
1141
+ return REDIS_OK;
1142
+ }
1143
+
1144
+ int redisGetReply(redisContext *c, void **reply) {
1145
+ int wdone = 0;
1146
+ void *aux = NULL;
1147
+
1148
+ /* Try to read pending replies */
1149
+ if (redisGetReplyFromReader(c,&aux) == REDIS_ERR)
1150
+ return REDIS_ERR;
1151
+
1152
+ /* For the blocking context, flush output buffer and read reply */
1153
+ if (aux == NULL && c->flags & REDIS_BLOCK) {
1154
+ /* Write until done */
1155
+ do {
1156
+ if (redisBufferWrite(c,&wdone) == REDIS_ERR)
1157
+ return REDIS_ERR;
1158
+ } while (!wdone);
1159
+
1160
+ /* Read until there is a reply */
1161
+ do {
1162
+ if (redisBufferRead(c) == REDIS_ERR)
1163
+ return REDIS_ERR;
1164
+ if (redisGetReplyFromReader(c,&aux) == REDIS_ERR)
1165
+ return REDIS_ERR;
1166
+ } while (aux == NULL);
1167
+ }
1168
+
1169
+ /* Set reply object */
1170
+ if (reply != NULL) *reply = aux;
1171
+ return REDIS_OK;
1172
+ }
1173
+
1174
+
1175
+ /* Helper function for the redisAppendCommand* family of functions.
1176
+ *
1177
+ * Write a formatted command to the output buffer. When this family
1178
+ * is used, you need to call redisGetReply yourself to retrieve
1179
+ * the reply (or replies in pub/sub).
1180
+ */
1181
+ int __redisAppendCommand(redisContext *c, char *cmd, size_t len) {
1182
+ sds newbuf;
1183
+
1184
+ newbuf = sdscatlen(c->obuf,cmd,len);
1185
+ if (newbuf == NULL) {
1186
+ __redisSetError(c,REDIS_ERR_OOM,"Out of memory");
1187
+ return REDIS_ERR;
1188
+ }
1189
+
1190
+ c->obuf = newbuf;
1191
+ return REDIS_OK;
1192
+ }
1193
+
1194
+ int redisvAppendCommand(redisContext *c, const char *format, va_list ap) {
1195
+ char *cmd;
1196
+ int len;
1197
+
1198
+ len = redisvFormatCommand(&cmd,format,ap);
1199
+ if (len == -1) {
1200
+ __redisSetError(c,REDIS_ERR_OOM,"Out of memory");
1201
+ return REDIS_ERR;
1202
+ }
1203
+
1204
+ if (__redisAppendCommand(c,cmd,len) != REDIS_OK) {
1205
+ free(cmd);
1206
+ return REDIS_ERR;
1207
+ }
1208
+
1209
+ free(cmd);
1210
+ return REDIS_OK;
1211
+ }
1212
+
1213
+ int redisAppendCommand(redisContext *c, const char *format, ...) {
1214
+ va_list ap;
1215
+ int ret;
1216
+
1217
+ va_start(ap,format);
1218
+ ret = redisvAppendCommand(c,format,ap);
1219
+ va_end(ap);
1220
+ return ret;
1221
+ }
1222
+
1223
+ int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen) {
1224
+ char *cmd;
1225
+ int len;
1226
+
1227
+ len = redisFormatCommandArgv(&cmd,argc,argv,argvlen);
1228
+ if (len == -1) {
1229
+ __redisSetError(c,REDIS_ERR_OOM,"Out of memory");
1230
+ return REDIS_ERR;
1231
+ }
1232
+
1233
+ if (__redisAppendCommand(c,cmd,len) != REDIS_OK) {
1234
+ free(cmd);
1235
+ return REDIS_ERR;
1236
+ }
1237
+
1238
+ free(cmd);
1239
+ return REDIS_OK;
1240
+ }
1241
+
1242
+ /* Helper function for the redisCommand* family of functions.
1243
+ *
1244
+ * Write a formatted command to the output buffer. If the given context is
1245
+ * blocking, immediately read the reply into the "reply" pointer. When the
1246
+ * context is non-blocking, the "reply" pointer will not be used and the
1247
+ * command is simply appended to the write buffer.
1248
+ *
1249
+ * Returns the reply when a reply was succesfully retrieved. Returns NULL
1250
+ * otherwise. When NULL is returned in a blocking context, the error field
1251
+ * in the context will be set.
1252
+ */
1253
+ static void *__redisBlockForReply(redisContext *c) {
1254
+ void *reply;
1255
+
1256
+ if (c->flags & REDIS_BLOCK) {
1257
+ if (redisGetReply(c,&reply) != REDIS_OK)
1258
+ return NULL;
1259
+ return reply;
1260
+ }
1261
+ return NULL;
1262
+ }
1263
+
1264
+ void *redisvCommand(redisContext *c, const char *format, va_list ap) {
1265
+ if (redisvAppendCommand(c,format,ap) != REDIS_OK)
1266
+ return NULL;
1267
+ return __redisBlockForReply(c);
1268
+ }
1269
+
1270
+ void *redisCommand(redisContext *c, const char *format, ...) {
1271
+ va_list ap;
1272
+ void *reply = NULL;
1273
+ va_start(ap,format);
1274
+ reply = redisvCommand(c,format,ap);
1275
+ va_end(ap);
1276
+ return reply;
1277
+ }
1278
+
1279
+ void *redisCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen) {
1280
+ if (redisAppendCommandArgv(c,argc,argv,argvlen) != REDIS_OK)
1281
+ return NULL;
1282
+ return __redisBlockForReply(c);
1283
+ }