sprokovuln 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (578) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/Gemfile +6 -0
  4. data/Gemfile.lock +26 -0
  5. data/README.md +35 -0
  6. data/Rakefile +2 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +8 -0
  9. data/lib/sprokovuln/version.rb +3 -0
  10. data/lib/sprokovuln.rb +5 -0
  11. data/sprokovuln.gemspec +26 -0
  12. data/vendor/ruby/bin/rackup +27 -0
  13. data/vendor/ruby/bin/rake +27 -0
  14. data/vendor/ruby/bin/sprockets +27 -0
  15. data/vendor/ruby/cache/concurrent-ruby-1.0.5.gem +0 -0
  16. data/vendor/ruby/cache/rack-2.0.5.gem +0 -0
  17. data/vendor/ruby/cache/rake-10.5.0.gem +0 -0
  18. data/vendor/ruby/cache/sprockets-3.7.1.gem +0 -0
  19. data/vendor/ruby/gems/concurrent-ruby-1.0.5/CHANGELOG.md +387 -0
  20. data/vendor/ruby/gems/concurrent-ruby-1.0.5/LICENSE.txt +21 -0
  21. data/vendor/ruby/gems/concurrent-ruby-1.0.5/README.md +247 -0
  22. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/agent.rb +587 -0
  23. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/array.rb +39 -0
  24. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/async.rb +445 -0
  25. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atom.rb +222 -0
  26. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/abstract_thread_local_var.rb +66 -0
  27. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/atomic_boolean.rb +122 -0
  28. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/atomic_fixnum.rb +139 -0
  29. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/atomic_reference.rb +51 -0
  30. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/count_down_latch.rb +100 -0
  31. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/cyclic_barrier.rb +128 -0
  32. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/event.rb +109 -0
  33. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/java_count_down_latch.rb +39 -0
  34. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/java_thread_local_var.rb +37 -0
  35. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_boolean.rb +60 -0
  36. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_atomic_fixnum.rb +75 -0
  37. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_count_down_latch.rb +43 -0
  38. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/mutex_semaphore.rb +115 -0
  39. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/read_write_lock.rb +253 -0
  40. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/reentrant_read_write_lock.rb +377 -0
  41. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/ruby_thread_local_var.rb +161 -0
  42. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/semaphore.rb +145 -0
  43. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic/thread_local_var.rb +104 -0
  44. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic_reference/concurrent_update_error.rb +8 -0
  45. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic_reference/direct_update.rb +81 -0
  46. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic_reference/jruby+truffle.rb +2 -0
  47. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic_reference/jruby.rb +16 -0
  48. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic_reference/mutex_atomic.rb +61 -0
  49. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic_reference/numeric_cas_wrapper.rb +28 -0
  50. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic_reference/rbx.rb +22 -0
  51. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomic_reference/ruby.rb +32 -0
  52. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/atomics.rb +53 -0
  53. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/copy_on_notify_observer_set.rb +107 -0
  54. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/copy_on_write_observer_set.rb +111 -0
  55. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/java_non_concurrent_priority_queue.rb +84 -0
  56. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/map/atomic_reference_map_backend.rb +927 -0
  57. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/map/mri_map_backend.rb +66 -0
  58. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/map/non_concurrent_map_backend.rb +141 -0
  59. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/map/synchronized_map_backend.rb +82 -0
  60. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/non_concurrent_priority_queue.rb +143 -0
  61. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/collection/ruby_non_concurrent_priority_queue.rb +150 -0
  62. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/concern/deprecation.rb +34 -0
  63. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/concern/dereferenceable.rb +73 -0
  64. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/concern/logging.rb +27 -0
  65. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/concern/obligation.rb +220 -0
  66. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/concern/observable.rb +110 -0
  67. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/configuration.rb +188 -0
  68. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/constants.rb +8 -0
  69. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/dataflow.rb +80 -0
  70. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/delay.rb +197 -0
  71. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/edge.rb +26 -0
  72. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/errors.rb +69 -0
  73. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/exchanger.rb +356 -0
  74. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/abstract_executor_service.rb +134 -0
  75. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/cached_thread_pool.rb +62 -0
  76. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/executor_service.rb +185 -0
  77. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/fixed_thread_pool.rb +206 -0
  78. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/immediate_executor.rb +66 -0
  79. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/indirect_immediate_executor.rb +44 -0
  80. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/java_executor_service.rb +100 -0
  81. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/java_single_thread_executor.rb +29 -0
  82. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/java_thread_pool_executor.rb +120 -0
  83. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_executor_service.rb +78 -0
  84. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_single_thread_executor.rb +22 -0
  85. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/ruby_thread_pool_executor.rb +362 -0
  86. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/safe_task_executor.rb +35 -0
  87. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/serial_executor_service.rb +34 -0
  88. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/serialized_execution.rb +107 -0
  89. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/serialized_execution_delegator.rb +28 -0
  90. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/simple_executor_service.rb +100 -0
  91. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/single_thread_executor.rb +56 -0
  92. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/thread_pool_executor.rb +87 -0
  93. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executor/timer_set.rb +175 -0
  94. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/executors.rb +20 -0
  95. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/future.rb +138 -0
  96. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/hash.rb +36 -0
  97. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/immutable_struct.rb +93 -0
  98. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/ivar.rb +208 -0
  99. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/lazy_register.rb +81 -0
  100. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/map.rb +240 -0
  101. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/maybe.rb +229 -0
  102. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/mutable_struct.rb +228 -0
  103. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/mvar.rb +242 -0
  104. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/options.rb +42 -0
  105. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/promise.rb +547 -0
  106. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/scheduled_task.rb +318 -0
  107. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/settable_struct.rb +128 -0
  108. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/abstract_lockable_object.rb +98 -0
  109. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/abstract_object.rb +24 -0
  110. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/abstract_struct.rb +157 -0
  111. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/condition.rb +58 -0
  112. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/jruby_lockable_object.rb +13 -0
  113. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/jruby_object.rb +44 -0
  114. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/lock.rb +34 -0
  115. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/lockable_object.rb +74 -0
  116. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_lockable_object.rb +71 -0
  117. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/mri_object.rb +43 -0
  118. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/object.rb +153 -0
  119. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/rbx_lockable_object.rb +65 -0
  120. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/rbx_object.rb +48 -0
  121. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/truffle_lockable_object.rb +9 -0
  122. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/truffle_object.rb +31 -0
  123. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization/volatile.rb +34 -0
  124. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/synchronization.rb +31 -0
  125. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/thread_safe/synchronized_delegator.rb +50 -0
  126. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/thread_safe/util/adder.rb +74 -0
  127. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/thread_safe/util/array_hash_rbx.rb +30 -0
  128. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/thread_safe/util/cheap_lockable.rb +118 -0
  129. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/thread_safe/util/power_of_two_tuple.rb +38 -0
  130. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/thread_safe/util/striped64.rb +241 -0
  131. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/thread_safe/util/volatile.rb +75 -0
  132. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/thread_safe/util/xor_shift_random.rb +50 -0
  133. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/thread_safe/util.rb +16 -0
  134. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/timer_task.rb +331 -0
  135. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/tuple.rb +86 -0
  136. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/tvar.rb +258 -0
  137. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/utility/at_exit.rb +97 -0
  138. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/utility/engine.rb +56 -0
  139. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/utility/monotonic_time.rb +58 -0
  140. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/utility/native_extension_loader.rb +73 -0
  141. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/utility/native_integer.rb +53 -0
  142. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/utility/processor_counter.rb +160 -0
  143. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent/version.rb +4 -0
  144. data/vendor/ruby/gems/concurrent-ruby-1.0.5/lib/concurrent.rb +130 -0
  145. data/vendor/ruby/gems/rack-2.0.5/COPYING +18 -0
  146. data/vendor/ruby/gems/rack-2.0.5/HISTORY.md +505 -0
  147. data/vendor/ruby/gems/rack-2.0.5/README.rdoc +302 -0
  148. data/vendor/ruby/gems/rack-2.0.5/Rakefile +116 -0
  149. data/vendor/ruby/gems/rack-2.0.5/SPEC +263 -0
  150. data/vendor/ruby/gems/rack-2.0.5/bin/rackup +4 -0
  151. data/vendor/ruby/gems/rack-2.0.5/contrib/rack.png +0 -0
  152. data/vendor/ruby/gems/rack-2.0.5/contrib/rack.svg +150 -0
  153. data/vendor/ruby/gems/rack-2.0.5/contrib/rack_logo.svg +164 -0
  154. data/vendor/ruby/gems/rack-2.0.5/contrib/rdoc.css +412 -0
  155. data/vendor/ruby/gems/rack-2.0.5/example/lobster.ru +4 -0
  156. data/vendor/ruby/gems/rack-2.0.5/example/protectedlobster.rb +14 -0
  157. data/vendor/ruby/gems/rack-2.0.5/example/protectedlobster.ru +8 -0
  158. data/vendor/ruby/gems/rack-2.0.5/lib/rack/auth/abstract/handler.rb +37 -0
  159. data/vendor/ruby/gems/rack-2.0.5/lib/rack/auth/abstract/request.rb +47 -0
  160. data/vendor/ruby/gems/rack-2.0.5/lib/rack/auth/basic.rb +58 -0
  161. data/vendor/ruby/gems/rack-2.0.5/lib/rack/auth/digest/md5.rb +129 -0
  162. data/vendor/ruby/gems/rack-2.0.5/lib/rack/auth/digest/nonce.rb +51 -0
  163. data/vendor/ruby/gems/rack-2.0.5/lib/rack/auth/digest/params.rb +52 -0
  164. data/vendor/ruby/gems/rack-2.0.5/lib/rack/auth/digest/request.rb +41 -0
  165. data/vendor/ruby/gems/rack-2.0.5/lib/rack/body_proxy.rb +44 -0
  166. data/vendor/ruby/gems/rack-2.0.5/lib/rack/builder.rb +164 -0
  167. data/vendor/ruby/gems/rack-2.0.5/lib/rack/cascade.rb +52 -0
  168. data/vendor/ruby/gems/rack-2.0.5/lib/rack/chunked.rb +69 -0
  169. data/vendor/ruby/gems/rack-2.0.5/lib/rack/common_logger.rb +72 -0
  170. data/vendor/ruby/gems/rack-2.0.5/lib/rack/conditional_get.rb +79 -0
  171. data/vendor/ruby/gems/rack-2.0.5/lib/rack/config.rb +20 -0
  172. data/vendor/ruby/gems/rack-2.0.5/lib/rack/content_length.rb +37 -0
  173. data/vendor/ruby/gems/rack-2.0.5/lib/rack/content_type.rb +29 -0
  174. data/vendor/ruby/gems/rack-2.0.5/lib/rack/deflater.rb +119 -0
  175. data/vendor/ruby/gems/rack-2.0.5/lib/rack/directory.rb +179 -0
  176. data/vendor/ruby/gems/rack-2.0.5/lib/rack/etag.rb +74 -0
  177. data/vendor/ruby/gems/rack-2.0.5/lib/rack/events.rb +154 -0
  178. data/vendor/ruby/gems/rack-2.0.5/lib/rack/file.rb +176 -0
  179. data/vendor/ruby/gems/rack-2.0.5/lib/rack/handler/cgi.rb +60 -0
  180. data/vendor/ruby/gems/rack-2.0.5/lib/rack/handler/fastcgi.rb +100 -0
  181. data/vendor/ruby/gems/rack-2.0.5/lib/rack/handler/lsws.rb +61 -0
  182. data/vendor/ruby/gems/rack-2.0.5/lib/rack/handler/scgi.rb +70 -0
  183. data/vendor/ruby/gems/rack-2.0.5/lib/rack/handler/thin.rb +36 -0
  184. data/vendor/ruby/gems/rack-2.0.5/lib/rack/handler/webrick.rb +120 -0
  185. data/vendor/ruby/gems/rack-2.0.5/lib/rack/handler.rb +99 -0
  186. data/vendor/ruby/gems/rack-2.0.5/lib/rack/head.rb +25 -0
  187. data/vendor/ruby/gems/rack-2.0.5/lib/rack/lint.rb +760 -0
  188. data/vendor/ruby/gems/rack-2.0.5/lib/rack/lobster.rb +70 -0
  189. data/vendor/ruby/gems/rack-2.0.5/lib/rack/lock.rb +31 -0
  190. data/vendor/ruby/gems/rack-2.0.5/lib/rack/logger.rb +18 -0
  191. data/vendor/ruby/gems/rack-2.0.5/lib/rack/media_type.rb +38 -0
  192. data/vendor/ruby/gems/rack-2.0.5/lib/rack/method_override.rb +50 -0
  193. data/vendor/ruby/gems/rack-2.0.5/lib/rack/mime.rb +677 -0
  194. data/vendor/ruby/gems/rack-2.0.5/lib/rack/mock.rb +196 -0
  195. data/vendor/ruby/gems/rack-2.0.5/lib/rack/multipart/generator.rb +93 -0
  196. data/vendor/ruby/gems/rack-2.0.5/lib/rack/multipart/parser.rb +369 -0
  197. data/vendor/ruby/gems/rack-2.0.5/lib/rack/multipart/uploaded_file.rb +33 -0
  198. data/vendor/ruby/gems/rack-2.0.5/lib/rack/multipart.rb +63 -0
  199. data/vendor/ruby/gems/rack-2.0.5/lib/rack/null_logger.rb +37 -0
  200. data/vendor/ruby/gems/rack-2.0.5/lib/rack/query_parser.rb +192 -0
  201. data/vendor/ruby/gems/rack-2.0.5/lib/rack/recursive.rb +62 -0
  202. data/vendor/ruby/gems/rack-2.0.5/lib/rack/reloader.rb +110 -0
  203. data/vendor/ruby/gems/rack-2.0.5/lib/rack/request.rb +487 -0
  204. data/vendor/ruby/gems/rack-2.0.5/lib/rack/response.rb +235 -0
  205. data/vendor/ruby/gems/rack-2.0.5/lib/rack/rewindable_input.rb +93 -0
  206. data/vendor/ruby/gems/rack-2.0.5/lib/rack/runtime.rb +32 -0
  207. data/vendor/ruby/gems/rack-2.0.5/lib/rack/sendfile.rb +158 -0
  208. data/vendor/ruby/gems/rack-2.0.5/lib/rack/server.rb +395 -0
  209. data/vendor/ruby/gems/rack-2.0.5/lib/rack/session/abstract/id.rb +445 -0
  210. data/vendor/ruby/gems/rack-2.0.5/lib/rack/session/cookie.rb +195 -0
  211. data/vendor/ruby/gems/rack-2.0.5/lib/rack/session/memcache.rb +93 -0
  212. data/vendor/ruby/gems/rack-2.0.5/lib/rack/session/pool.rb +76 -0
  213. data/vendor/ruby/gems/rack-2.0.5/lib/rack/show_exceptions.rb +386 -0
  214. data/vendor/ruby/gems/rack-2.0.5/lib/rack/show_status.rb +113 -0
  215. data/vendor/ruby/gems/rack-2.0.5/lib/rack/static.rb +175 -0
  216. data/vendor/ruby/gems/rack-2.0.5/lib/rack/tempfile_reaper.rb +22 -0
  217. data/vendor/ruby/gems/rack-2.0.5/lib/rack/urlmap.rb +91 -0
  218. data/vendor/ruby/gems/rack-2.0.5/lib/rack/utils.rb +620 -0
  219. data/vendor/ruby/gems/rack-2.0.5/lib/rack.rb +147 -0
  220. data/vendor/ruby/gems/rack-2.0.5/rack.gemspec +34 -0
  221. data/vendor/ruby/gems/rack-2.0.5/test/builder/an_underscore_app.rb +5 -0
  222. data/vendor/ruby/gems/rack-2.0.5/test/builder/anything.rb +5 -0
  223. data/vendor/ruby/gems/rack-2.0.5/test/builder/comment.ru +4 -0
  224. data/vendor/ruby/gems/rack-2.0.5/test/builder/end.ru +5 -0
  225. data/vendor/ruby/gems/rack-2.0.5/test/builder/line.ru +1 -0
  226. data/vendor/ruby/gems/rack-2.0.5/test/builder/options.ru +2 -0
  227. data/vendor/ruby/gems/rack-2.0.5/test/cgi/assets/folder/test.js +1 -0
  228. data/vendor/ruby/gems/rack-2.0.5/test/cgi/assets/fonts/font.eot +1 -0
  229. data/vendor/ruby/gems/rack-2.0.5/test/cgi/assets/images/image.png +1 -0
  230. data/vendor/ruby/gems/rack-2.0.5/test/cgi/assets/index.html +1 -0
  231. data/vendor/ruby/gems/rack-2.0.5/test/cgi/assets/javascripts/app.js +1 -0
  232. data/vendor/ruby/gems/rack-2.0.5/test/cgi/assets/stylesheets/app.css +1 -0
  233. data/vendor/ruby/gems/rack-2.0.5/test/cgi/lighttpd.conf +26 -0
  234. data/vendor/ruby/gems/rack-2.0.5/test/cgi/rackup_stub.rb +6 -0
  235. data/vendor/ruby/gems/rack-2.0.5/test/cgi/sample_rackup.ru +5 -0
  236. data/vendor/ruby/gems/rack-2.0.5/test/cgi/test +9 -0
  237. data/vendor/ruby/gems/rack-2.0.5/test/cgi/test+directory/test+file +1 -0
  238. data/vendor/ruby/gems/rack-2.0.5/test/cgi/test.fcgi +9 -0
  239. data/vendor/ruby/gems/rack-2.0.5/test/cgi/test.gz +0 -0
  240. data/vendor/ruby/gems/rack-2.0.5/test/cgi/test.ru +5 -0
  241. data/vendor/ruby/gems/rack-2.0.5/test/gemloader.rb +10 -0
  242. data/vendor/ruby/gems/rack-2.0.5/test/helper.rb +34 -0
  243. data/vendor/ruby/gems/rack-2.0.5/test/multipart/bad_robots +259 -0
  244. data/vendor/ruby/gems/rack-2.0.5/test/multipart/binary +0 -0
  245. data/vendor/ruby/gems/rack-2.0.5/test/multipart/content_type_and_no_filename +6 -0
  246. data/vendor/ruby/gems/rack-2.0.5/test/multipart/empty +10 -0
  247. data/vendor/ruby/gems/rack-2.0.5/test/multipart/fail_16384_nofile +814 -0
  248. data/vendor/ruby/gems/rack-2.0.5/test/multipart/file1.txt +1 -0
  249. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_and_modification_param +7 -0
  250. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_and_no_name +6 -0
  251. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_encoded_words +7 -0
  252. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_escaped_quotes +6 -0
  253. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_escaped_quotes_and_modification_param +7 -0
  254. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_null_byte +7 -0
  255. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_percent_escaped_quotes +6 -0
  256. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_single_quote +7 -0
  257. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_unescaped_percentages +6 -0
  258. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_unescaped_percentages2 +6 -0
  259. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_unescaped_percentages3 +6 -0
  260. data/vendor/ruby/gems/rack-2.0.5/test/multipart/filename_with_unescaped_quotes +6 -0
  261. data/vendor/ruby/gems/rack-2.0.5/test/multipart/ie +6 -0
  262. data/vendor/ruby/gems/rack-2.0.5/test/multipart/invalid_character +6 -0
  263. data/vendor/ruby/gems/rack-2.0.5/test/multipart/mixed_files +21 -0
  264. data/vendor/ruby/gems/rack-2.0.5/test/multipart/nested +10 -0
  265. data/vendor/ruby/gems/rack-2.0.5/test/multipart/none +9 -0
  266. data/vendor/ruby/gems/rack-2.0.5/test/multipart/quoted +15 -0
  267. data/vendor/ruby/gems/rack-2.0.5/test/multipart/rack-logo.png +0 -0
  268. data/vendor/ruby/gems/rack-2.0.5/test/multipart/semicolon +6 -0
  269. data/vendor/ruby/gems/rack-2.0.5/test/multipart/text +15 -0
  270. data/vendor/ruby/gems/rack-2.0.5/test/multipart/three_files_three_fields +31 -0
  271. data/vendor/ruby/gems/rack-2.0.5/test/multipart/unity3d_wwwform +11 -0
  272. data/vendor/ruby/gems/rack-2.0.5/test/multipart/webkit +32 -0
  273. data/vendor/ruby/gems/rack-2.0.5/test/rackup/config.ru +31 -0
  274. data/vendor/ruby/gems/rack-2.0.5/test/registering_handler/rack/handler/registering_myself.rb +8 -0
  275. data/vendor/ruby/gems/rack-2.0.5/test/spec_auth_basic.rb +89 -0
  276. data/vendor/ruby/gems/rack-2.0.5/test/spec_auth_digest.rb +260 -0
  277. data/vendor/ruby/gems/rack-2.0.5/test/spec_body_proxy.rb +85 -0
  278. data/vendor/ruby/gems/rack-2.0.5/test/spec_builder.rb +233 -0
  279. data/vendor/ruby/gems/rack-2.0.5/test/spec_cascade.rb +63 -0
  280. data/vendor/ruby/gems/rack-2.0.5/test/spec_cgi.rb +84 -0
  281. data/vendor/ruby/gems/rack-2.0.5/test/spec_chunked.rb +103 -0
  282. data/vendor/ruby/gems/rack-2.0.5/test/spec_common_logger.rb +95 -0
  283. data/vendor/ruby/gems/rack-2.0.5/test/spec_conditional_get.rb +103 -0
  284. data/vendor/ruby/gems/rack-2.0.5/test/spec_config.rb +23 -0
  285. data/vendor/ruby/gems/rack-2.0.5/test/spec_content_length.rb +86 -0
  286. data/vendor/ruby/gems/rack-2.0.5/test/spec_content_type.rb +46 -0
  287. data/vendor/ruby/gems/rack-2.0.5/test/spec_deflater.rb +375 -0
  288. data/vendor/ruby/gems/rack-2.0.5/test/spec_directory.rb +148 -0
  289. data/vendor/ruby/gems/rack-2.0.5/test/spec_etag.rb +108 -0
  290. data/vendor/ruby/gems/rack-2.0.5/test/spec_events.rb +133 -0
  291. data/vendor/ruby/gems/rack-2.0.5/test/spec_fastcgi.rb +85 -0
  292. data/vendor/ruby/gems/rack-2.0.5/test/spec_file.rb +264 -0
  293. data/vendor/ruby/gems/rack-2.0.5/test/spec_handler.rb +57 -0
  294. data/vendor/ruby/gems/rack-2.0.5/test/spec_head.rb +46 -0
  295. data/vendor/ruby/gems/rack-2.0.5/test/spec_lint.rb +515 -0
  296. data/vendor/ruby/gems/rack-2.0.5/test/spec_lobster.rb +59 -0
  297. data/vendor/ruby/gems/rack-2.0.5/test/spec_lock.rb +204 -0
  298. data/vendor/ruby/gems/rack-2.0.5/test/spec_logger.rb +24 -0
  299. data/vendor/ruby/gems/rack-2.0.5/test/spec_media_type.rb +42 -0
  300. data/vendor/ruby/gems/rack-2.0.5/test/spec_method_override.rb +110 -0
  301. data/vendor/ruby/gems/rack-2.0.5/test/spec_mime.rb +51 -0
  302. data/vendor/ruby/gems/rack-2.0.5/test/spec_mock.rb +359 -0
  303. data/vendor/ruby/gems/rack-2.0.5/test/spec_multipart.rb +722 -0
  304. data/vendor/ruby/gems/rack-2.0.5/test/spec_null_logger.rb +21 -0
  305. data/vendor/ruby/gems/rack-2.0.5/test/spec_recursive.rb +75 -0
  306. data/vendor/ruby/gems/rack-2.0.5/test/spec_request.rb +1393 -0
  307. data/vendor/ruby/gems/rack-2.0.5/test/spec_response.rb +510 -0
  308. data/vendor/ruby/gems/rack-2.0.5/test/spec_rewindable_input.rb +128 -0
  309. data/vendor/ruby/gems/rack-2.0.5/test/spec_runtime.rb +50 -0
  310. data/vendor/ruby/gems/rack-2.0.5/test/spec_sendfile.rb +125 -0
  311. data/vendor/ruby/gems/rack-2.0.5/test/spec_server.rb +193 -0
  312. data/vendor/ruby/gems/rack-2.0.5/test/spec_session_abstract_id.rb +31 -0
  313. data/vendor/ruby/gems/rack-2.0.5/test/spec_session_abstract_session_hash.rb +45 -0
  314. data/vendor/ruby/gems/rack-2.0.5/test/spec_session_cookie.rb +442 -0
  315. data/vendor/ruby/gems/rack-2.0.5/test/spec_session_memcache.rb +320 -0
  316. data/vendor/ruby/gems/rack-2.0.5/test/spec_session_pool.rb +210 -0
  317. data/vendor/ruby/gems/rack-2.0.5/test/spec_show_exceptions.rb +80 -0
  318. data/vendor/ruby/gems/rack-2.0.5/test/spec_show_status.rb +104 -0
  319. data/vendor/ruby/gems/rack-2.0.5/test/spec_static.rb +184 -0
  320. data/vendor/ruby/gems/rack-2.0.5/test/spec_tempfile_reaper.rb +64 -0
  321. data/vendor/ruby/gems/rack-2.0.5/test/spec_thin.rb +96 -0
  322. data/vendor/ruby/gems/rack-2.0.5/test/spec_urlmap.rb +237 -0
  323. data/vendor/ruby/gems/rack-2.0.5/test/spec_utils.rb +742 -0
  324. data/vendor/ruby/gems/rack-2.0.5/test/spec_version.rb +11 -0
  325. data/vendor/ruby/gems/rack-2.0.5/test/spec_webrick.rb +206 -0
  326. data/vendor/ruby/gems/rack-2.0.5/test/static/another/index.html +1 -0
  327. data/vendor/ruby/gems/rack-2.0.5/test/static/foo.html +1 -0
  328. data/vendor/ruby/gems/rack-2.0.5/test/static/index.html +1 -0
  329. data/vendor/ruby/gems/rack-2.0.5/test/testrequest.rb +78 -0
  330. data/vendor/ruby/gems/rack-2.0.5/test/unregistered_handler/rack/handler/unregistered.rb +7 -0
  331. data/vendor/ruby/gems/rack-2.0.5/test/unregistered_handler/rack/handler/unregistered_long_one.rb +7 -0
  332. data/vendor/ruby/gems/rake-10.5.0/.autotest +7 -0
  333. data/vendor/ruby/gems/rake-10.5.0/.rubocop.yml +27 -0
  334. data/vendor/ruby/gems/rake-10.5.0/.togglerc +7 -0
  335. data/vendor/ruby/gems/rake-10.5.0/CONTRIBUTING.rdoc +38 -0
  336. data/vendor/ruby/gems/rake-10.5.0/History.rdoc +659 -0
  337. data/vendor/ruby/gems/rake-10.5.0/MIT-LICENSE +21 -0
  338. data/vendor/ruby/gems/rake-10.5.0/Manifest.txt +166 -0
  339. data/vendor/ruby/gems/rake-10.5.0/README.rdoc +139 -0
  340. data/vendor/ruby/gems/rake-10.5.0/Rakefile +81 -0
  341. data/vendor/ruby/gems/rake-10.5.0/bin/rake +33 -0
  342. data/vendor/ruby/gems/rake-10.5.0/doc/command_line_usage.rdoc +158 -0
  343. data/vendor/ruby/gems/rake-10.5.0/doc/example/Rakefile1 +38 -0
  344. data/vendor/ruby/gems/rake-10.5.0/doc/example/Rakefile2 +35 -0
  345. data/vendor/ruby/gems/rake-10.5.0/doc/example/a.c +6 -0
  346. data/vendor/ruby/gems/rake-10.5.0/doc/example/b.c +6 -0
  347. data/vendor/ruby/gems/rake-10.5.0/doc/example/main.c +11 -0
  348. data/vendor/ruby/gems/rake-10.5.0/doc/glossary.rdoc +42 -0
  349. data/vendor/ruby/gems/rake-10.5.0/doc/jamis.rb +591 -0
  350. data/vendor/ruby/gems/rake-10.5.0/doc/proto_rake.rdoc +127 -0
  351. data/vendor/ruby/gems/rake-10.5.0/doc/rake.1 +141 -0
  352. data/vendor/ruby/gems/rake-10.5.0/doc/rakefile.rdoc +624 -0
  353. data/vendor/ruby/gems/rake-10.5.0/doc/rational.rdoc +151 -0
  354. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.4.14.rdoc +23 -0
  355. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.4.15.rdoc +35 -0
  356. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.5.0.rdoc +53 -0
  357. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.5.3.rdoc +78 -0
  358. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.5.4.rdoc +46 -0
  359. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.6.0.rdoc +141 -0
  360. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.7.0.rdoc +119 -0
  361. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.7.1.rdoc +59 -0
  362. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.7.2.rdoc +121 -0
  363. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.7.3.rdoc +47 -0
  364. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.8.0.rdoc +114 -0
  365. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.8.2.rdoc +165 -0
  366. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.8.3.rdoc +112 -0
  367. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.8.4.rdoc +147 -0
  368. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.8.5.rdoc +53 -0
  369. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.8.6.rdoc +37 -0
  370. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.8.7.rdoc +55 -0
  371. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.9.0.rdoc +112 -0
  372. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.9.1.rdoc +52 -0
  373. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
  374. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.9.2.rdoc +49 -0
  375. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.9.3.rdoc +102 -0
  376. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.9.4.rdoc +60 -0
  377. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.9.5.rdoc +55 -0
  378. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-0.9.6.rdoc +64 -0
  379. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-10.0.0.rdoc +178 -0
  380. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-10.0.1.rdoc +58 -0
  381. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-10.0.2.rdoc +53 -0
  382. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-10.0.3.rdoc +191 -0
  383. data/vendor/ruby/gems/rake-10.5.0/doc/release_notes/rake-10.1.0.rdoc +61 -0
  384. data/vendor/ruby/gems/rake-10.5.0/lib/rake/alt_system.rb +110 -0
  385. data/vendor/ruby/gems/rake-10.5.0/lib/rake/application.rb +790 -0
  386. data/vendor/ruby/gems/rake-10.5.0/lib/rake/backtrace.rb +23 -0
  387. data/vendor/ruby/gems/rake-10.5.0/lib/rake/clean.rb +76 -0
  388. data/vendor/ruby/gems/rake-10.5.0/lib/rake/cloneable.rb +16 -0
  389. data/vendor/ruby/gems/rake-10.5.0/lib/rake/contrib/.document +1 -0
  390. data/vendor/ruby/gems/rake-10.5.0/lib/rake/contrib/compositepublisher.rb +21 -0
  391. data/vendor/ruby/gems/rake-10.5.0/lib/rake/contrib/ftptools.rb +137 -0
  392. data/vendor/ruby/gems/rake-10.5.0/lib/rake/contrib/publisher.rb +81 -0
  393. data/vendor/ruby/gems/rake-10.5.0/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  394. data/vendor/ruby/gems/rake-10.5.0/lib/rake/contrib/sshpublisher.rb +61 -0
  395. data/vendor/ruby/gems/rake-10.5.0/lib/rake/contrib/sys.rb +4 -0
  396. data/vendor/ruby/gems/rake-10.5.0/lib/rake/cpu_counter.rb +125 -0
  397. data/vendor/ruby/gems/rake-10.5.0/lib/rake/default_loader.rb +14 -0
  398. data/vendor/ruby/gems/rake-10.5.0/lib/rake/dsl_definition.rb +201 -0
  399. data/vendor/ruby/gems/rake-10.5.0/lib/rake/early_time.rb +21 -0
  400. data/vendor/ruby/gems/rake-10.5.0/lib/rake/ext/core.rb +25 -0
  401. data/vendor/ruby/gems/rake-10.5.0/lib/rake/ext/module.rb +2 -0
  402. data/vendor/ruby/gems/rake-10.5.0/lib/rake/ext/pathname.rb +25 -0
  403. data/vendor/ruby/gems/rake-10.5.0/lib/rake/ext/string.rb +175 -0
  404. data/vendor/ruby/gems/rake-10.5.0/lib/rake/ext/time.rb +18 -0
  405. data/vendor/ruby/gems/rake-10.5.0/lib/rake/file_creation_task.rb +24 -0
  406. data/vendor/ruby/gems/rake-10.5.0/lib/rake/file_list.rb +428 -0
  407. data/vendor/ruby/gems/rake-10.5.0/lib/rake/file_task.rb +46 -0
  408. data/vendor/ruby/gems/rake-10.5.0/lib/rake/file_utils.rb +128 -0
  409. data/vendor/ruby/gems/rake-10.5.0/lib/rake/file_utils_ext.rb +144 -0
  410. data/vendor/ruby/gems/rake-10.5.0/lib/rake/gempackagetask.rb +4 -0
  411. data/vendor/ruby/gems/rake-10.5.0/lib/rake/invocation_chain.rb +56 -0
  412. data/vendor/ruby/gems/rake-10.5.0/lib/rake/invocation_exception_mixin.rb +16 -0
  413. data/vendor/ruby/gems/rake-10.5.0/lib/rake/late_time.rb +17 -0
  414. data/vendor/ruby/gems/rake-10.5.0/lib/rake/linked_list.rb +103 -0
  415. data/vendor/ruby/gems/rake-10.5.0/lib/rake/loaders/makefile.rb +53 -0
  416. data/vendor/ruby/gems/rake-10.5.0/lib/rake/multi_task.rb +13 -0
  417. data/vendor/ruby/gems/rake-10.5.0/lib/rake/name_space.rb +38 -0
  418. data/vendor/ruby/gems/rake-10.5.0/lib/rake/packagetask.rb +199 -0
  419. data/vendor/ruby/gems/rake-10.5.0/lib/rake/pathmap.rb +3 -0
  420. data/vendor/ruby/gems/rake-10.5.0/lib/rake/phony.rb +15 -0
  421. data/vendor/ruby/gems/rake-10.5.0/lib/rake/private_reader.rb +20 -0
  422. data/vendor/ruby/gems/rake-10.5.0/lib/rake/promise.rb +99 -0
  423. data/vendor/ruby/gems/rake-10.5.0/lib/rake/pseudo_status.rb +29 -0
  424. data/vendor/ruby/gems/rake-10.5.0/lib/rake/rake_module.rb +38 -0
  425. data/vendor/ruby/gems/rake-10.5.0/lib/rake/rake_test_loader.rb +22 -0
  426. data/vendor/ruby/gems/rake-10.5.0/lib/rake/rdoctask.rb +4 -0
  427. data/vendor/ruby/gems/rake-10.5.0/lib/rake/ruby182_test_unit_fix.rb +29 -0
  428. data/vendor/ruby/gems/rake-10.5.0/lib/rake/rule_recursion_overflow_error.rb +20 -0
  429. data/vendor/ruby/gems/rake-10.5.0/lib/rake/runtest.rb +27 -0
  430. data/vendor/ruby/gems/rake-10.5.0/lib/rake/scope.rb +42 -0
  431. data/vendor/ruby/gems/rake-10.5.0/lib/rake/task.rb +383 -0
  432. data/vendor/ruby/gems/rake-10.5.0/lib/rake/task_argument_error.rb +7 -0
  433. data/vendor/ruby/gems/rake-10.5.0/lib/rake/task_arguments.rb +98 -0
  434. data/vendor/ruby/gems/rake-10.5.0/lib/rake/task_manager.rb +307 -0
  435. data/vendor/ruby/gems/rake-10.5.0/lib/rake/tasklib.rb +24 -0
  436. data/vendor/ruby/gems/rake-10.5.0/lib/rake/testtask.rb +213 -0
  437. data/vendor/ruby/gems/rake-10.5.0/lib/rake/thread_history_display.rb +48 -0
  438. data/vendor/ruby/gems/rake-10.5.0/lib/rake/thread_pool.rb +164 -0
  439. data/vendor/ruby/gems/rake-10.5.0/lib/rake/trace_output.rb +22 -0
  440. data/vendor/ruby/gems/rake-10.5.0/lib/rake/version.rb +7 -0
  441. data/vendor/ruby/gems/rake-10.5.0/lib/rake/win32.rb +56 -0
  442. data/vendor/ruby/gems/rake-10.5.0/lib/rake.rb +79 -0
  443. data/vendor/ruby/gems/rake-10.5.0/rakelib/publish.rake +20 -0
  444. data/vendor/ruby/gems/rake-10.5.0/rakelib/test_times.rake +25 -0
  445. data/vendor/ruby/gems/rake-10.5.0/test/file_creation.rb +34 -0
  446. data/vendor/ruby/gems/rake-10.5.0/test/helper.rb +129 -0
  447. data/vendor/ruby/gems/rake-10.5.0/test/support/rakefile_definitions.rb +478 -0
  448. data/vendor/ruby/gems/rake-10.5.0/test/support/ruby_runner.rb +34 -0
  449. data/vendor/ruby/gems/rake-10.5.0/test/test_private_reader.rb +42 -0
  450. data/vendor/ruby/gems/rake-10.5.0/test/test_rake.rb +40 -0
  451. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_application.rb +643 -0
  452. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_application_options.rb +468 -0
  453. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_backtrace.rb +119 -0
  454. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_clean.rb +61 -0
  455. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_cpu_counter.rb +68 -0
  456. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_definitions.rb +84 -0
  457. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_directory_task.rb +76 -0
  458. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_dsl.rb +40 -0
  459. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_early_time.rb +31 -0
  460. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_extension.rb +59 -0
  461. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_file_creation_task.rb +56 -0
  462. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_file_list.rb +670 -0
  463. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_file_list_path_map.rb +8 -0
  464. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_file_task.rb +197 -0
  465. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_file_utils.rb +314 -0
  466. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_ftp_file.rb +74 -0
  467. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_functional.rb +482 -0
  468. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_invocation_chain.rb +64 -0
  469. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_late_time.rb +18 -0
  470. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_linked_list.rb +84 -0
  471. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_makefile_loader.rb +46 -0
  472. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_multi_task.rb +64 -0
  473. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_name_space.rb +57 -0
  474. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_package_task.rb +79 -0
  475. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_path_map.rb +168 -0
  476. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_path_map_explode.rb +34 -0
  477. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_path_map_partial.rb +18 -0
  478. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_pathname_extensions.rb +15 -0
  479. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_pseudo_status.rb +21 -0
  480. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_rake_test_loader.rb +20 -0
  481. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_reduce_compat.rb +26 -0
  482. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_require.rb +40 -0
  483. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_rules.rb +388 -0
  484. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_scope.rb +44 -0
  485. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_task.rb +393 -0
  486. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_task_argument_parsing.rb +119 -0
  487. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_task_arguments.rb +127 -0
  488. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_task_lib.rb +9 -0
  489. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_task_manager.rb +178 -0
  490. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_task_manager_argument_resolution.rb +19 -0
  491. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_task_with_arguments.rb +172 -0
  492. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_test_task.rb +146 -0
  493. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_thread_pool.rb +145 -0
  494. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_top_level_functions.rb +71 -0
  495. data/vendor/ruby/gems/rake-10.5.0/test/test_rake_win32.rb +72 -0
  496. data/vendor/ruby/gems/rake-10.5.0/test/test_thread_history_display.rb +101 -0
  497. data/vendor/ruby/gems/rake-10.5.0/test/test_trace_output.rb +52 -0
  498. data/vendor/ruby/gems/sprockets-3.7.1/CHANGELOG.md +292 -0
  499. data/vendor/ruby/gems/sprockets-3.7.1/LICENSE +21 -0
  500. data/vendor/ruby/gems/sprockets-3.7.1/README.md +509 -0
  501. data/vendor/ruby/gems/sprockets-3.7.1/bin/sprockets +89 -0
  502. data/vendor/ruby/gems/sprockets-3.7.1/lib/rake/sprocketstask.rb +152 -0
  503. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/asset.rb +200 -0
  504. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/autoload/closure.rb +7 -0
  505. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/autoload/coffee_script.rb +7 -0
  506. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/autoload/eco.rb +7 -0
  507. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/autoload/ejs.rb +7 -0
  508. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/autoload/sass.rb +7 -0
  509. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/autoload/uglifier.rb +7 -0
  510. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/autoload/yui.rb +7 -0
  511. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/autoload.rb +11 -0
  512. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/base.rb +110 -0
  513. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/bower.rb +58 -0
  514. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/bundle.rb +69 -0
  515. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/cache/file_store.rb +186 -0
  516. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/cache/memory_store.rb +66 -0
  517. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/cache/null_store.rb +46 -0
  518. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/cache.rb +236 -0
  519. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/cached_environment.rb +69 -0
  520. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/closure_compressor.rb +47 -0
  521. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/coffee_script_processor.rb +25 -0
  522. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/coffee_script_template.rb +17 -0
  523. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/compressing.rb +94 -0
  524. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/configuration.rb +83 -0
  525. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/context.rb +231 -0
  526. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/dependencies.rb +73 -0
  527. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/deprecation.rb +90 -0
  528. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/digest_utils.rb +180 -0
  529. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/directive_processor.rb +404 -0
  530. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/eco_processor.rb +32 -0
  531. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/eco_template.rb +17 -0
  532. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/ejs_processor.rb +31 -0
  533. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/ejs_template.rb +17 -0
  534. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/encoding_utils.rb +261 -0
  535. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/engines.rb +92 -0
  536. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/environment.rb +41 -0
  537. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/erb_processor.rb +30 -0
  538. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/erb_template.rb +11 -0
  539. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/errors.rb +11 -0
  540. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/file_reader.rb +15 -0
  541. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/http_utils.rb +117 -0
  542. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/jst_processor.rb +49 -0
  543. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/legacy.rb +330 -0
  544. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/legacy_proc_processor.rb +35 -0
  545. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/legacy_tilt_processor.rb +29 -0
  546. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/loader.rb +325 -0
  547. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/manifest.rb +335 -0
  548. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/manifest_utils.rb +45 -0
  549. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/mime.rb +130 -0
  550. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/path_dependency_utils.rb +85 -0
  551. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/path_digest_utils.rb +47 -0
  552. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/path_utils.rb +287 -0
  553. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/paths.rb +81 -0
  554. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/processing.rb +258 -0
  555. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/processor_utils.rb +180 -0
  556. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/resolve.rb +211 -0
  557. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/sass_cache_store.rb +34 -0
  558. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/sass_compressor.rb +51 -0
  559. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/sass_functions.rb +2 -0
  560. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/sass_importer.rb +2 -0
  561. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/sass_processor.rb +292 -0
  562. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/sass_template.rb +19 -0
  563. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/server.rb +292 -0
  564. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/transformers.rb +145 -0
  565. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/uglifier_compressor.rb +56 -0
  566. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/unloaded_asset.rb +137 -0
  567. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/uri_tar.rb +98 -0
  568. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/uri_utils.rb +188 -0
  569. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/utils/gzip.rb +67 -0
  570. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/utils.rb +235 -0
  571. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/version.rb +3 -0
  572. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets/yui_compressor.rb +55 -0
  573. data/vendor/ruby/gems/sprockets-3.7.1/lib/sprockets.rb +169 -0
  574. data/vendor/ruby/specifications/concurrent-ruby-1.0.5.gemspec +23 -0
  575. data/vendor/ruby/specifications/rack-2.0.5.gemspec +42 -0
  576. data/vendor/ruby/specifications/rake-10.5.0.gemspec +43 -0
  577. data/vendor/ruby/specifications/sprockets-3.7.1.gemspec +78 -0
  578. metadata +660 -0
@@ -0,0 +1,547 @@
1
+ require 'thread'
2
+ require 'concurrent/constants'
3
+ require 'concurrent/errors'
4
+ require 'concurrent/ivar'
5
+ require 'concurrent/executor/safe_task_executor'
6
+
7
+ require 'concurrent/options'
8
+
9
+ module Concurrent
10
+
11
+ PromiseExecutionError = Class.new(StandardError)
12
+
13
+ # Promises are inspired by the JavaScript [Promises/A](http://wiki.commonjs.org/wiki/Promises/A)
14
+ # and [Promises/A+](http://promises-aplus.github.io/promises-spec/) specifications.
15
+ #
16
+ # > A promise represents the eventual value returned from the single
17
+ # > completion of an operation.
18
+ #
19
+ # Promises are similar to futures and share many of the same behaviours.
20
+ # Promises are far more robust, however. Promises can be chained in a tree
21
+ # structure where each promise may have zero or more children. Promises are
22
+ # chained using the `then` method. The result of a call to `then` is always
23
+ # another promise. Promises are resolved asynchronously (with respect to the
24
+ # main thread) but in a strict order: parents are guaranteed to be resolved
25
+ # before their children, children before their younger siblings. The `then`
26
+ # method takes two parameters: an optional block to be executed upon parent
27
+ # resolution and an optional callable to be executed upon parent failure. The
28
+ # result of each promise is passed to each of its children upon resolution.
29
+ # When a promise is rejected all its children will be summarily rejected and
30
+ # will receive the reason.
31
+ #
32
+ # Promises have several possible states: *:unscheduled*, *:pending*,
33
+ # *:processing*, *:rejected*, or *:fulfilled*. These are also aggregated as
34
+ # `#incomplete?` and `#complete?`. When a Promise is created it is set to
35
+ # *:unscheduled*. Once the `#execute` method is called the state becomes
36
+ # *:pending*. Once a job is pulled from the thread pool's queue and is given
37
+ # to a thread for processing (often immediately upon `#post`) the state
38
+ # becomes *:processing*. The future will remain in this state until processing
39
+ # is complete. A future that is in the *:unscheduled*, *:pending*, or
40
+ # *:processing* is considered `#incomplete?`. A `#complete?` Promise is either
41
+ # *:rejected*, indicating that an exception was thrown during processing, or
42
+ # *:fulfilled*, indicating success. If a Promise is *:fulfilled* its `#value`
43
+ # will be updated to reflect the result of the operation. If *:rejected* the
44
+ # `reason` will be updated with a reference to the thrown exception. The
45
+ # predicate methods `#unscheduled?`, `#pending?`, `#rejected?`, and
46
+ # `#fulfilled?` can be called at any time to obtain the state of the Promise,
47
+ # as can the `#state` method, which returns a symbol.
48
+ #
49
+ # Retrieving the value of a promise is done through the `value` (alias:
50
+ # `deref`) method. Obtaining the value of a promise is a potentially blocking
51
+ # operation. When a promise is *rejected* a call to `value` will return `nil`
52
+ # immediately. When a promise is *fulfilled* a call to `value` will
53
+ # immediately return the current value. When a promise is *pending* a call to
54
+ # `value` will block until the promise is either *rejected* or *fulfilled*. A
55
+ # *timeout* value can be passed to `value` to limit how long the call will
56
+ # block. If `nil` the call will block indefinitely. If `0` the call will not
57
+ # block. Any other integer or float value will indicate the maximum number of
58
+ # seconds to block.
59
+ #
60
+ # Promises run on the global thread pool.
61
+ #
62
+ # @!macro copy_options
63
+ #
64
+ # ### Examples
65
+ #
66
+ # Start by requiring promises
67
+ #
68
+ # ```ruby
69
+ # require 'concurrent'
70
+ # ```
71
+ #
72
+ # Then create one
73
+ #
74
+ # ```ruby
75
+ # p = Concurrent::Promise.execute do
76
+ # # do something
77
+ # 42
78
+ # end
79
+ # ```
80
+ #
81
+ # Promises can be chained using the `then` method. The `then` method accepts a
82
+ # block and an executor, to be executed on fulfillment, and a callable argument to be executed
83
+ # on rejection. The result of the each promise is passed as the block argument
84
+ # to chained promises.
85
+ #
86
+ # ```ruby
87
+ # p = Concurrent::Promise.new{10}.then{|x| x * 2}.then{|result| result - 10 }.execute
88
+ # ```
89
+ #
90
+ # And so on, and so on, and so on...
91
+ #
92
+ # ```ruby
93
+ # p = Concurrent::Promise.fulfill(20).
94
+ # then{|result| result - 10 }.
95
+ # then{|result| result * 3 }.
96
+ # then(executor: different_executor){|result| result % 5 }.execute
97
+ # ```
98
+ #
99
+ # The initial state of a newly created Promise depends on the state of its parent:
100
+ # - if parent is *unscheduled* the child will be *unscheduled*
101
+ # - if parent is *pending* the child will be *pending*
102
+ # - if parent is *fulfilled* the child will be *pending*
103
+ # - if parent is *rejected* the child will be *pending* (but will ultimately be *rejected*)
104
+ #
105
+ # Promises are executed asynchronously from the main thread. By the time a
106
+ # child Promise finishes intialization it may be in a different state than its
107
+ # parent (by the time a child is created its parent may have completed
108
+ # execution and changed state). Despite being asynchronous, however, the order
109
+ # of execution of Promise objects in a chain (or tree) is strictly defined.
110
+ #
111
+ # There are multiple ways to create and execute a new `Promise`. Both ways
112
+ # provide identical behavior:
113
+ #
114
+ # ```ruby
115
+ # # create, operate, then execute
116
+ # p1 = Concurrent::Promise.new{ "Hello World!" }
117
+ # p1.state #=> :unscheduled
118
+ # p1.execute
119
+ #
120
+ # # create and immediately execute
121
+ # p2 = Concurrent::Promise.new{ "Hello World!" }.execute
122
+ #
123
+ # # execute during creation
124
+ # p3 = Concurrent::Promise.execute{ "Hello World!" }
125
+ # ```
126
+ #
127
+ # Once the `execute` method is called a `Promise` becomes `pending`:
128
+ #
129
+ # ```ruby
130
+ # p = Concurrent::Promise.execute{ "Hello, world!" }
131
+ # p.state #=> :pending
132
+ # p.pending? #=> true
133
+ # ```
134
+ #
135
+ # Wait a little bit, and the promise will resolve and provide a value:
136
+ #
137
+ # ```ruby
138
+ # p = Concurrent::Promise.execute{ "Hello, world!" }
139
+ # sleep(0.1)
140
+ #
141
+ # p.state #=> :fulfilled
142
+ # p.fulfilled? #=> true
143
+ # p.value #=> "Hello, world!"
144
+ # ```
145
+ #
146
+ # If an exception occurs, the promise will be rejected and will provide
147
+ # a reason for the rejection:
148
+ #
149
+ # ```ruby
150
+ # p = Concurrent::Promise.execute{ raise StandardError.new("Here comes the Boom!") }
151
+ # sleep(0.1)
152
+ #
153
+ # p.state #=> :rejected
154
+ # p.rejected? #=> true
155
+ # p.reason #=> "#<StandardError: Here comes the Boom!>"
156
+ # ```
157
+ #
158
+ # #### Rejection
159
+ #
160
+ # When a promise is rejected all its children will be rejected and will
161
+ # receive the rejection `reason` as the rejection callable parameter:
162
+ #
163
+ # ```ruby
164
+ # p = [ Concurrent::Promise.execute{ Thread.pass; raise StandardError } ]
165
+ #
166
+ # c1 = p.then(Proc.new{ |reason| 42 })
167
+ # c2 = p.then(Proc.new{ |reason| raise 'Boom!' })
168
+ #
169
+ # sleep(0.1)
170
+ #
171
+ # c1.state #=> :rejected
172
+ # c2.state #=> :rejected
173
+ # ```
174
+ #
175
+ # Once a promise is rejected it will continue to accept children that will
176
+ # receive immediately rejection (they will be executed asynchronously).
177
+ #
178
+ # #### Aliases
179
+ #
180
+ # The `then` method is the most generic alias: it accepts a block to be
181
+ # executed upon parent fulfillment and a callable to be executed upon parent
182
+ # rejection. At least one of them should be passed. The default block is `{
183
+ # |result| result }` that fulfills the child with the parent value. The
184
+ # default callable is `{ |reason| raise reason }` that rejects the child with
185
+ # the parent reason.
186
+ #
187
+ # - `on_success { |result| ... }` is the same as `then {|result| ... }`
188
+ # - `rescue { |reason| ... }` is the same as `then(Proc.new { |reason| ... } )`
189
+ # - `rescue` is aliased by `catch` and `on_error`
190
+ class Promise < IVar
191
+
192
+ # Initialize a new Promise with the provided options.
193
+ #
194
+ # @!macro executor_and_deref_options
195
+ #
196
+ # @!macro [attach] promise_init_options
197
+ #
198
+ # @option opts [Promise] :parent the parent `Promise` when building a chain/tree
199
+ # @option opts [Proc] :on_fulfill fulfillment handler
200
+ # @option opts [Proc] :on_reject rejection handler
201
+ # @option opts [object, Array] :args zero or more arguments to be passed
202
+ # the task block on execution
203
+ #
204
+ # @yield The block operation to be performed asynchronously.
205
+ #
206
+ # @raise [ArgumentError] if no block is given
207
+ #
208
+ # @see http://wiki.commonjs.org/wiki/Promises/A
209
+ # @see http://promises-aplus.github.io/promises-spec/
210
+ def initialize(opts = {}, &block)
211
+ opts.delete_if { |k, v| v.nil? }
212
+ super(NULL, opts.merge(__promise_body_from_block__: block), &nil)
213
+ end
214
+
215
+ # Create a new `Promise` and fulfill it immediately.
216
+ #
217
+ # @!macro executor_and_deref_options
218
+ #
219
+ # @!macro promise_init_options
220
+ #
221
+ # @raise [ArgumentError] if no block is given
222
+ #
223
+ # @return [Promise] the newly created `Promise`
224
+ def self.fulfill(value, opts = {})
225
+ Promise.new(opts).tap { |p| p.send(:synchronized_set_state!, true, value, nil) }
226
+ end
227
+
228
+ # Create a new `Promise` and reject it immediately.
229
+ #
230
+ # @!macro executor_and_deref_options
231
+ #
232
+ # @!macro promise_init_options
233
+ #
234
+ # @raise [ArgumentError] if no block is given
235
+ #
236
+ # @return [Promise] the newly created `Promise`
237
+ def self.reject(reason, opts = {})
238
+ Promise.new(opts).tap { |p| p.send(:synchronized_set_state!, false, nil, reason) }
239
+ end
240
+
241
+ # Execute an `:unscheduled` `Promise`. Immediately sets the state to `:pending` and
242
+ # passes the block to a new thread/thread pool for eventual execution.
243
+ # Does nothing if the `Promise` is in any state other than `:unscheduled`.
244
+ #
245
+ # @return [Promise] a reference to `self`
246
+ def execute
247
+ if root?
248
+ if compare_and_set_state(:pending, :unscheduled)
249
+ set_pending
250
+ realize(@promise_body)
251
+ end
252
+ else
253
+ @parent.execute
254
+ end
255
+ self
256
+ end
257
+
258
+ # @!macro ivar_set_method
259
+ #
260
+ # @raise [Concurrent::PromiseExecutionError] if not the root promise
261
+ def set(value = NULL, &block)
262
+ raise PromiseExecutionError.new('supported only on root promise') unless root?
263
+ check_for_block_or_value!(block_given?, value)
264
+ synchronize do
265
+ if @state != :unscheduled
266
+ raise MultipleAssignmentError
267
+ else
268
+ @promise_body = block || Proc.new { |result| value }
269
+ end
270
+ end
271
+ execute
272
+ end
273
+
274
+ # @!macro ivar_fail_method
275
+ #
276
+ # @raise [Concurrent::PromiseExecutionError] if not the root promise
277
+ def fail(reason = StandardError.new)
278
+ set { raise reason }
279
+ end
280
+
281
+ # Create a new `Promise` object with the given block, execute it, and return the
282
+ # `:pending` object.
283
+ #
284
+ # @!macro executor_and_deref_options
285
+ #
286
+ # @!macro promise_init_options
287
+ #
288
+ # @return [Promise] the newly created `Promise` in the `:pending` state
289
+ #
290
+ # @raise [ArgumentError] if no block is given
291
+ #
292
+ # @example
293
+ # promise = Concurrent::Promise.execute{ sleep(1); 42 }
294
+ # promise.state #=> :pending
295
+ def self.execute(opts = {}, &block)
296
+ new(opts, &block).execute
297
+ end
298
+
299
+ # Chain a new promise off the current promise.
300
+ #
301
+ # @param [Proc] rescuer An optional rescue block to be executed if the
302
+ # promise is rejected.
303
+ #
304
+ # @param [ThreadPool] executor An optional thread pool executor to be used
305
+ # in the new Promise
306
+ #
307
+ # @yield The block operation to be performed asynchronously.
308
+ #
309
+ # @return [Promise] the new promise
310
+ def then(rescuer = nil, executor = @executor, &block)
311
+ raise ArgumentError.new('rescuers and block are both missing') if rescuer.nil? && !block_given?
312
+ block = Proc.new { |result| result } unless block_given?
313
+ child = Promise.new(
314
+ parent: self,
315
+ executor: executor,
316
+ on_fulfill: block,
317
+ on_reject: rescuer
318
+ )
319
+
320
+ synchronize do
321
+ child.state = :pending if @state == :pending
322
+ child.on_fulfill(apply_deref_options(@value)) if @state == :fulfilled
323
+ child.on_reject(@reason) if @state == :rejected
324
+ @children << child
325
+ end
326
+
327
+ child
328
+ end
329
+
330
+ # Chain onto this promise an action to be undertaken on success
331
+ # (fulfillment).
332
+ #
333
+ # @yield The block to execute
334
+ #
335
+ # @return [Promise] self
336
+ def on_success(&block)
337
+ raise ArgumentError.new('no block given') unless block_given?
338
+ self.then(&block)
339
+ end
340
+
341
+ # Chain onto this promise an action to be undertaken on failure
342
+ # (rejection).
343
+ #
344
+ # @yield The block to execute
345
+ #
346
+ # @return [Promise] self
347
+ def rescue(&block)
348
+ self.then(block)
349
+ end
350
+
351
+ alias_method :catch, :rescue
352
+ alias_method :on_error, :rescue
353
+
354
+ # Yield the successful result to the block that returns a promise. If that
355
+ # promise is also successful the result is the result of the yielded promise.
356
+ # If either part fails the whole also fails.
357
+ #
358
+ # @example
359
+ # Promise.execute { 1 }.flat_map { |v| Promise.execute { v + 2 } }.value! #=> 3
360
+ #
361
+ # @return [Promise]
362
+ def flat_map(&block)
363
+ child = Promise.new(
364
+ parent: self,
365
+ executor: ImmediateExecutor.new,
366
+ )
367
+
368
+ on_error { |e| child.on_reject(e) }
369
+ on_success do |result1|
370
+ begin
371
+ inner = block.call(result1)
372
+ inner.execute
373
+ inner.on_success { |result2| child.on_fulfill(result2) }
374
+ inner.on_error { |e| child.on_reject(e) }
375
+ rescue => e
376
+ child.on_reject(e)
377
+ end
378
+ end
379
+
380
+ child
381
+ end
382
+
383
+ # Builds a promise that produces the result of promises in an Array
384
+ # and fails if any of them fails.
385
+ #
386
+ # @param [Array<Promise>] promises
387
+ #
388
+ # @return [Promise<Array>]
389
+ def self.zip(*promises)
390
+ zero = fulfill([], executor: ImmediateExecutor.new)
391
+
392
+ promises.reduce(zero) do |p1, p2|
393
+ p1.flat_map do |results|
394
+ p2.then do |next_result|
395
+ results << next_result
396
+ end
397
+ end
398
+ end
399
+ end
400
+
401
+ # Builds a promise that produces the result of self and others in an Array
402
+ # and fails if any of them fails.
403
+ #
404
+ # @param [Array<Promise>] others
405
+ #
406
+ # @return [Promise<Array>]
407
+ def zip(*others)
408
+ self.class.zip(self, *others)
409
+ end
410
+
411
+ # Aggregates a collection of promises and executes the `then` condition
412
+ # if all aggregated promises succeed. Executes the `rescue` handler with
413
+ # a `Concurrent::PromiseExecutionError` if any of the aggregated promises
414
+ # fail. Upon execution will execute any of the aggregate promises that
415
+ # were not already executed.
416
+ #
417
+ # @!macro [attach] promise_self_aggregate
418
+ #
419
+ # The returned promise will not yet have been executed. Additional `#then`
420
+ # and `#rescue` handlers may still be provided. Once the returned promise
421
+ # is execute the aggregate promises will be also be executed (if they have
422
+ # not been executed already). The results of the aggregate promises will
423
+ # be checked upon completion. The necessary `#then` and `#rescue` blocks
424
+ # on the aggregating promise will then be executed as appropriate. If the
425
+ # `#rescue` handlers are executed the raises exception will be
426
+ # `Concurrent::PromiseExecutionError`.
427
+ #
428
+ # @param [Array] promises Zero or more promises to aggregate
429
+ # @return [Promise] an unscheduled (not executed) promise that aggregates
430
+ # the promises given as arguments
431
+ def self.all?(*promises)
432
+ aggregate(:all?, *promises)
433
+ end
434
+
435
+ # Aggregates a collection of promises and executes the `then` condition
436
+ # if any aggregated promises succeed. Executes the `rescue` handler with
437
+ # a `Concurrent::PromiseExecutionError` if any of the aggregated promises
438
+ # fail. Upon execution will execute any of the aggregate promises that
439
+ # were not already executed.
440
+ #
441
+ # @!macro promise_self_aggregate
442
+ def self.any?(*promises)
443
+ aggregate(:any?, *promises)
444
+ end
445
+
446
+ protected
447
+
448
+ def ns_initialize(value, opts)
449
+ super
450
+
451
+ @executor = Options.executor_from_options(opts) || Concurrent.global_io_executor
452
+ @args = get_arguments_from(opts)
453
+
454
+ @parent = opts.fetch(:parent) { nil }
455
+ @on_fulfill = opts.fetch(:on_fulfill) { Proc.new { |result| result } }
456
+ @on_reject = opts.fetch(:on_reject) { Proc.new { |reason| raise reason } }
457
+
458
+ @promise_body = opts[:__promise_body_from_block__] || Proc.new { |result| result }
459
+ @state = :unscheduled
460
+ @children = []
461
+ end
462
+
463
+ # Aggregate a collection of zero or more promises under a composite promise,
464
+ # execute the aggregated promises and collect them into a standard Ruby array,
465
+ # call the given Ruby `Ennnumerable` predicate (such as `any?`, `all?`, `none?`,
466
+ # or `one?`) on the collection checking for the success or failure of each,
467
+ # then executing the composite's `#then` handlers if the predicate returns
468
+ # `true` or executing the composite's `#rescue` handlers if the predicate
469
+ # returns false.
470
+ #
471
+ # @!macro promise_self_aggregate
472
+ def self.aggregate(method, *promises)
473
+ composite = Promise.new do
474
+ completed = promises.collect do |promise|
475
+ promise.execute if promise.unscheduled?
476
+ promise.wait
477
+ promise
478
+ end
479
+ unless completed.empty? || completed.send(method){|promise| promise.fulfilled? }
480
+ raise PromiseExecutionError
481
+ end
482
+ end
483
+ composite
484
+ end
485
+
486
+ # @!visibility private
487
+ def set_pending
488
+ synchronize do
489
+ @state = :pending
490
+ @children.each { |c| c.set_pending }
491
+ end
492
+ end
493
+
494
+ # @!visibility private
495
+ def root? # :nodoc:
496
+ @parent.nil?
497
+ end
498
+
499
+ # @!visibility private
500
+ def on_fulfill(result)
501
+ realize Proc.new { @on_fulfill.call(result) }
502
+ nil
503
+ end
504
+
505
+ # @!visibility private
506
+ def on_reject(reason)
507
+ realize Proc.new { @on_reject.call(reason) }
508
+ nil
509
+ end
510
+
511
+ # @!visibility private
512
+ def notify_child(child)
513
+ if_state(:fulfilled) { child.on_fulfill(apply_deref_options(@value)) }
514
+ if_state(:rejected) { child.on_reject(@reason) }
515
+ end
516
+
517
+ # @!visibility private
518
+ def complete(success, value, reason)
519
+ children_to_notify = synchronize do
520
+ set_state!(success, value, reason)
521
+ @children.dup
522
+ end
523
+
524
+ children_to_notify.each { |child| notify_child(child) }
525
+ observers.notify_and_delete_observers{ [Time.now, self.value, reason] }
526
+ end
527
+
528
+ # @!visibility private
529
+ def realize(task)
530
+ @executor.post do
531
+ success, value, reason = SafeTaskExecutor.new(task, rescue_exception: true).execute(*@args)
532
+ complete(success, value, reason)
533
+ end
534
+ end
535
+
536
+ # @!visibility private
537
+ def set_state!(success, value, reason)
538
+ set_state(success, value, reason)
539
+ event.set
540
+ end
541
+
542
+ # @!visibility private
543
+ def synchronized_set_state!(success, value, reason)
544
+ synchronize { set_state!(success, value, reason) }
545
+ end
546
+ end
547
+ end