chess_engine 0.0.1

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 (292) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +5 -0
  3. data/Gemfile.lock +21 -0
  4. data/README.md +26 -0
  5. data/chess_engine.gemspec +14 -0
  6. data/lib/chess_engine/board.rb +95 -0
  7. data/lib/chess_engine/cli.rb +105 -0
  8. data/lib/chess_engine/game.rb +148 -0
  9. data/lib/chess_engine/input.rb +19 -0
  10. data/lib/chess_engine/move.rb +35 -0
  11. data/lib/chess_engine/piece.rb +97 -0
  12. data/lib/chess_engine/validator.rb +87 -0
  13. data/lib/chess_engine.rb +1 -0
  14. data/spec/board_spec.rb +70 -0
  15. data/spec/game_helper.rb +5 -0
  16. data/spec/game_spec.rb +79 -0
  17. data/spec/spec_helper.rb +100 -0
  18. data/spec/validator_spec.rb +26 -0
  19. data/vendor/bundle/bin/coderay +27 -0
  20. data/vendor/bundle/bin/pry +27 -0
  21. data/vendor/bundle/cache/coderay-1.1.2.gem +0 -0
  22. data/vendor/bundle/cache/colorize-0.8.1.gem +0 -0
  23. data/vendor/bundle/cache/method_source-0.9.2.gem +0 -0
  24. data/vendor/bundle/cache/pry-0.12.2.gem +0 -0
  25. data/vendor/bundle/cache/rb-readline-0.5.5.gem +0 -0
  26. data/vendor/bundle/gems/coderay-1.1.2/MIT-LICENSE +22 -0
  27. data/vendor/bundle/gems/coderay-1.1.2/README_INDEX.rdoc +123 -0
  28. data/vendor/bundle/gems/coderay-1.1.2/bin/coderay +215 -0
  29. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/duo.rb +81 -0
  30. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/_map.rb +17 -0
  31. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/comment_filter.rb +25 -0
  32. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/count.rb +39 -0
  33. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/debug.rb +49 -0
  34. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/debug_lint.rb +63 -0
  35. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/div.rb +23 -0
  36. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/encoder.rb +190 -0
  37. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/filter.rb +58 -0
  38. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/css.rb +65 -0
  39. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/numbering.rb +108 -0
  40. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/output.rb +166 -0
  41. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html.rb +333 -0
  42. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/json.rb +83 -0
  43. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/lines_of_code.rb +45 -0
  44. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/lint.rb +59 -0
  45. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/null.rb +18 -0
  46. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/page.rb +24 -0
  47. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/span.rb +23 -0
  48. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/statistic.rb +95 -0
  49. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/terminal.rb +195 -0
  50. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/text.rb +46 -0
  51. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/token_kind_filter.rb +111 -0
  52. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/xml.rb +72 -0
  53. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/yaml.rb +50 -0
  54. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders.rb +18 -0
  55. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/for_redcloth.rb +95 -0
  56. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/file_type.rb +151 -0
  57. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/plugin.rb +55 -0
  58. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/plugin_host.rb +221 -0
  59. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/word_list.rb +72 -0
  60. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/_map.rb +24 -0
  61. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/c.rb +189 -0
  62. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/clojure.rb +217 -0
  63. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/cpp.rb +217 -0
  64. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/css.rb +196 -0
  65. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/debug.rb +75 -0
  66. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/delphi.rb +144 -0
  67. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/diff.rb +221 -0
  68. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/erb.rb +81 -0
  69. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/go.rb +208 -0
  70. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/groovy.rb +268 -0
  71. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/haml.rb +168 -0
  72. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/html.rb +275 -0
  73. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java/builtin_types.rb +421 -0
  74. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java.rb +174 -0
  75. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java_script.rb +237 -0
  76. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/json.rb +98 -0
  77. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/lua.rb +280 -0
  78. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/php.rb +527 -0
  79. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/python.rb +287 -0
  80. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/raydebug.rb +75 -0
  81. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby/patterns.rb +178 -0
  82. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby/string_state.rb +79 -0
  83. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby.rb +477 -0
  84. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/sass.rb +232 -0
  85. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/scanner.rb +337 -0
  86. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/sql.rb +169 -0
  87. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/taskpaper.rb +36 -0
  88. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/text.rb +26 -0
  89. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/xml.rb +17 -0
  90. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/yaml.rb +140 -0
  91. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners.rb +27 -0
  92. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/_map.rb +7 -0
  93. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/alpha.rb +153 -0
  94. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/style.rb +18 -0
  95. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles.rb +15 -0
  96. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/token_kinds.rb +85 -0
  97. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/tokens.rb +161 -0
  98. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/tokens_proxy.rb +55 -0
  99. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/version.rb +3 -0
  100. data/vendor/bundle/gems/coderay-1.1.2/lib/coderay.rb +284 -0
  101. data/vendor/bundle/gems/colorize-0.8.1/CHANGELOG +65 -0
  102. data/vendor/bundle/gems/colorize-0.8.1/LICENSE +339 -0
  103. data/vendor/bundle/gems/colorize-0.8.1/README.md +105 -0
  104. data/vendor/bundle/gems/colorize-0.8.1/Rakefile +13 -0
  105. data/vendor/bundle/gems/colorize-0.8.1/colorize.gemspec +36 -0
  106. data/vendor/bundle/gems/colorize-0.8.1/lib/colorize/class_methods.rb +120 -0
  107. data/vendor/bundle/gems/colorize-0.8.1/lib/colorize/instance_methods.rb +132 -0
  108. data/vendor/bundle/gems/colorize-0.8.1/lib/colorize.rb +12 -0
  109. data/vendor/bundle/gems/colorize-0.8.1/lib/colorized_string.rb +19 -0
  110. data/vendor/bundle/gems/colorize-0.8.1/test/test_colorize.rb +164 -0
  111. data/vendor/bundle/gems/method_source-0.9.2/Gemfile +2 -0
  112. data/vendor/bundle/gems/method_source-0.9.2/LICENSE +25 -0
  113. data/vendor/bundle/gems/method_source-0.9.2/README.markdown +91 -0
  114. data/vendor/bundle/gems/method_source-0.9.2/Rakefile +81 -0
  115. data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/code_helpers.rb +154 -0
  116. data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/source_location.rb +138 -0
  117. data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/version.rb +3 -0
  118. data/vendor/bundle/gems/method_source-0.9.2/lib/method_source.rb +141 -0
  119. data/vendor/bundle/gems/method_source-0.9.2/method_source.gemspec +35 -0
  120. data/vendor/bundle/gems/method_source-0.9.2/spec/method_source/code_helpers_spec.rb +43 -0
  121. data/vendor/bundle/gems/method_source-0.9.2/spec/method_source_spec.rb +143 -0
  122. data/vendor/bundle/gems/method_source-0.9.2/spec/spec_helper.rb +101 -0
  123. data/vendor/bundle/gems/pry-0.12.2/CHANGELOG.md +953 -0
  124. data/vendor/bundle/gems/pry-0.12.2/LICENSE +25 -0
  125. data/vendor/bundle/gems/pry-0.12.2/README.md +390 -0
  126. data/vendor/bundle/gems/pry-0.12.2/bin/pry +8 -0
  127. data/vendor/bundle/gems/pry-0.12.2/lib/pry/basic_object.rb +6 -0
  128. data/vendor/bundle/gems/pry-0.12.2/lib/pry/cli.rb +218 -0
  129. data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/code_file.rb +110 -0
  130. data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/code_range.rb +71 -0
  131. data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/loc.rb +98 -0
  132. data/vendor/bundle/gems/pry-0.12.2/lib/pry/code.rb +353 -0
  133. data/vendor/bundle/gems/pry-0.12.2/lib/pry/code_object.rb +195 -0
  134. data/vendor/bundle/gems/pry-0.12.2/lib/pry/color_printer.rb +65 -0
  135. data/vendor/bundle/gems/pry-0.12.2/lib/pry/command.rb +723 -0
  136. data/vendor/bundle/gems/pry-0.12.2/lib/pry/command_set.rb +415 -0
  137. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/amend_line.rb +98 -0
  138. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/bang.rb +20 -0
  139. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/bang_pry.rb +17 -0
  140. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/abstract_formatter.rb +27 -0
  141. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/exception_formatter.rb +79 -0
  142. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/file_formatter.rb +71 -0
  143. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/input_expression_formatter.rb +43 -0
  144. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat.rb +63 -0
  145. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cd.rb +41 -0
  146. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/change_inspector.rb +27 -0
  147. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/change_prompt.rb +46 -0
  148. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/clear_screen.rb +14 -0
  149. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/code_collector.rb +167 -0
  150. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/disable_pry.rb +27 -0
  151. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/disabled_commands.rb +2 -0
  152. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/easter_eggs.rb +112 -0
  153. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit/exception_patcher.rb +25 -0
  154. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit/file_and_line_locator.rb +36 -0
  155. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit.rb +200 -0
  156. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit.rb +43 -0
  157. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit_all.rb +29 -0
  158. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit_program.rb +23 -0
  159. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/find_method.rb +191 -0
  160. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/fix_indent.rb +19 -0
  161. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_cd.rb +26 -0
  162. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_install.rb +32 -0
  163. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_list.rb +33 -0
  164. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_open.rb +29 -0
  165. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_readme.rb +25 -0
  166. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_search.rb +40 -0
  167. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_stats.rb +83 -0
  168. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gist.rb +102 -0
  169. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/help.rb +164 -0
  170. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/hist.rb +181 -0
  171. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/import_set.rb +23 -0
  172. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/install_command.rb +54 -0
  173. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/jump_to.rb +29 -0
  174. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/list_inspectors.rb +35 -0
  175. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/constants.rb +58 -0
  176. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/formatter.rb +51 -0
  177. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/globals.rb +46 -0
  178. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/grep.rb +19 -0
  179. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/instance_vars.rb +38 -0
  180. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/interrogatable.rb +18 -0
  181. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/jruby_hacks.rb +49 -0
  182. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/local_names.rb +33 -0
  183. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/local_vars.rb +37 -0
  184. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb +69 -0
  185. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods.rb +54 -0
  186. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb +46 -0
  187. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/self_methods.rb +33 -0
  188. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls.rb +113 -0
  189. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/nesting.rb +25 -0
  190. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/play.rb +102 -0
  191. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/pry_backtrace.rb +25 -0
  192. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/pry_version.rb +17 -0
  193. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/raise_up.rb +33 -0
  194. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/reload_code.rb +62 -0
  195. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/reset.rb +18 -0
  196. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ri.rb +65 -0
  197. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/save_file.rb +61 -0
  198. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/shell_command.rb +75 -0
  199. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/shell_mode.rb +25 -0
  200. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_doc.rb +81 -0
  201. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_info.rb +216 -0
  202. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_input.rb +17 -0
  203. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_source.rb +53 -0
  204. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/stat.rb +40 -0
  205. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/switch_to.rb +23 -0
  206. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/toggle_color.rb +24 -0
  207. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/watch_expression/expression.rb +38 -0
  208. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/watch_expression.rb +107 -0
  209. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/whereami.rb +197 -0
  210. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/wtf.rb +70 -0
  211. data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands.rb +6 -0
  212. data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/behavior.rb +255 -0
  213. data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/convenience.rb +28 -0
  214. data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/default.rb +159 -0
  215. data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/memoization.rb +48 -0
  216. data/vendor/bundle/gems/pry-0.12.2/lib/pry/config.rb +35 -0
  217. data/vendor/bundle/gems/pry-0.12.2/lib/pry/core_extensions.rb +142 -0
  218. data/vendor/bundle/gems/pry-0.12.2/lib/pry/editor.rb +128 -0
  219. data/vendor/bundle/gems/pry-0.12.2/lib/pry/exceptions.rb +76 -0
  220. data/vendor/bundle/gems/pry-0.12.2/lib/pry/forwardable.rb +23 -0
  221. data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/base_helpers.rb +200 -0
  222. data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/command_helpers.rb +157 -0
  223. data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/documentation_helpers.rb +76 -0
  224. data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb +27 -0
  225. data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/platform.rb +58 -0
  226. data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/table.rb +114 -0
  227. data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/text.rb +115 -0
  228. data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers.rb +6 -0
  229. data/vendor/bundle/gems/pry-0.12.2/lib/pry/history.rb +161 -0
  230. data/vendor/bundle/gems/pry-0.12.2/lib/pry/hooks.rb +171 -0
  231. data/vendor/bundle/gems/pry-0.12.2/lib/pry/indent.rb +408 -0
  232. data/vendor/bundle/gems/pry-0.12.2/lib/pry/input_completer.rb +265 -0
  233. data/vendor/bundle/gems/pry-0.12.2/lib/pry/input_lock.rb +130 -0
  234. data/vendor/bundle/gems/pry-0.12.2/lib/pry/inspector.rb +27 -0
  235. data/vendor/bundle/gems/pry-0.12.2/lib/pry/last_exception.rb +61 -0
  236. data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/disowned.rb +55 -0
  237. data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/patcher.rb +122 -0
  238. data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb +198 -0
  239. data/vendor/bundle/gems/pry-0.12.2/lib/pry/method.rb +552 -0
  240. data/vendor/bundle/gems/pry-0.12.2/lib/pry/object_path.rb +83 -0
  241. data/vendor/bundle/gems/pry-0.12.2/lib/pry/output.rb +50 -0
  242. data/vendor/bundle/gems/pry-0.12.2/lib/pry/pager.rb +250 -0
  243. data/vendor/bundle/gems/pry-0.12.2/lib/pry/platform.rb +91 -0
  244. data/vendor/bundle/gems/pry-0.12.2/lib/pry/plugins.rb +122 -0
  245. data/vendor/bundle/gems/pry-0.12.2/lib/pry/prompt.rb +145 -0
  246. data/vendor/bundle/gems/pry-0.12.2/lib/pry/pry_class.rb +425 -0
  247. data/vendor/bundle/gems/pry-0.12.2/lib/pry/pry_instance.rb +699 -0
  248. data/vendor/bundle/gems/pry-0.12.2/lib/pry/repl.rb +261 -0
  249. data/vendor/bundle/gems/pry-0.12.2/lib/pry/repl_file_loader.rb +73 -0
  250. data/vendor/bundle/gems/pry-0.12.2/lib/pry/ring.rb +84 -0
  251. data/vendor/bundle/gems/pry-0.12.2/lib/pry/rubygem.rb +84 -0
  252. data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/LICENSE +20 -0
  253. data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/commands.rb +195 -0
  254. data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/option.rb +206 -0
  255. data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop.rb +661 -0
  256. data/vendor/bundle/gems/pry-0.12.2/lib/pry/terminal.rb +91 -0
  257. data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/evalable.rb +15 -0
  258. data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/mockable.rb +14 -0
  259. data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/pry_tester.rb +73 -0
  260. data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/utility.rb +26 -0
  261. data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/variables.rb +46 -0
  262. data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable.rb +70 -0
  263. data/vendor/bundle/gems/pry-0.12.2/lib/pry/version.rb +3 -0
  264. data/vendor/bundle/gems/pry-0.12.2/lib/pry/wrapped_module/candidate.rb +131 -0
  265. data/vendor/bundle/gems/pry-0.12.2/lib/pry/wrapped_module.rb +378 -0
  266. data/vendor/bundle/gems/pry-0.12.2/lib/pry.rb +132 -0
  267. data/vendor/bundle/gems/rb-readline-0.5.5/CHANGES +94 -0
  268. data/vendor/bundle/gems/rb-readline-0.5.5/LICENSE +25 -0
  269. data/vendor/bundle/gems/rb-readline-0.5.5/README.md +81 -0
  270. data/vendor/bundle/gems/rb-readline-0.5.5/Rakefile +25 -0
  271. data/vendor/bundle/gems/rb-readline-0.5.5/bench/_rl_adjust_point.rb +26 -0
  272. data/vendor/bundle/gems/rb-readline-0.5.5/examples/example_readline.rb +8 -0
  273. data/vendor/bundle/gems/rb-readline-0.5.5/examples/example_readline_with_completion.rb +18 -0
  274. data/vendor/bundle/gems/rb-readline-0.5.5/examples/tinyirb.rb +11 -0
  275. data/vendor/bundle/gems/rb-readline-0.5.5/lib/rb-readline.rb +18 -0
  276. data/vendor/bundle/gems/rb-readline-0.5.5/lib/rbreadline/version.rb +3 -0
  277. data/vendor/bundle/gems/rb-readline-0.5.5/lib/rbreadline.rb +8920 -0
  278. data/vendor/bundle/gems/rb-readline-0.5.5/lib/readline.rb +539 -0
  279. data/vendor/bundle/gems/rb-readline-0.5.5/rb-readline.gemspec +51 -0
  280. data/vendor/bundle/gems/rb-readline-0.5.5/setup.rb +1585 -0
  281. data/vendor/bundle/gems/rb-readline-0.5.5/test/support/filesystem_completion_helper.rb +53 -0
  282. data/vendor/bundle/gems/rb-readline-0.5.5/test/test_completion.rb +100 -0
  283. data/vendor/bundle/gems/rb-readline-0.5.5/test/test_filename_completion_proc.rb +88 -0
  284. data/vendor/bundle/gems/rb-readline-0.5.5/test/test_history.rb +29 -0
  285. data/vendor/bundle/gems/rb-readline-0.5.5/test/test_rbreadline.rb +23 -0
  286. data/vendor/bundle/gems/rb-readline-0.5.5/test/test_readline.rb +221 -0
  287. data/vendor/bundle/specifications/coderay-1.1.2.gemspec +26 -0
  288. data/vendor/bundle/specifications/colorize-0.8.1.gemspec +38 -0
  289. data/vendor/bundle/specifications/method_source-0.9.2.gemspec +35 -0
  290. data/vendor/bundle/specifications/pry-0.12.2.gemspec +38 -0
  291. data/vendor/bundle/specifications/rb-readline-0.5.5.gemspec +39 -0
  292. metadata +363 -0
@@ -0,0 +1,83 @@
1
+ class Pry
2
+ # `ObjectPath` implements the resolution of "object paths", which are strings
3
+ # that are similar to filesystem paths but meant for traversing Ruby objects.
4
+ # Examples of valid object paths include:
5
+ #
6
+ # x
7
+ # @foo/@bar
8
+ # "string"/upcase
9
+ # Pry/Method
10
+ #
11
+ # Object paths are mostly relevant in the context of the `cd` command.
12
+ # @see https://github.com/pry/pry/wiki/State-navigation
13
+ class ObjectPath
14
+ SPECIAL_TERMS = ["", "::", ".", ".."]
15
+
16
+ # @param [String] path_string The object path expressed as a string.
17
+ # @param [Array<Binding>] current_stack The current state of the binding
18
+ # stack.
19
+ def initialize(path_string, current_stack)
20
+ @path_string = path_string
21
+ @current_stack = current_stack
22
+ end
23
+
24
+ # @return [Array<Binding>] a new stack resulting from applying the given
25
+ # path to the current stack.
26
+ def resolve
27
+ scanner = StringScanner.new(@path_string.strip)
28
+ stack = @current_stack.dup
29
+
30
+ begin
31
+ next_segment = ""
32
+
33
+ loop do
34
+ # Scan for as long as we don't see a slash
35
+ next_segment << scanner.scan(/[^\/]*/)
36
+
37
+ if complete?(next_segment) || scanner.eos?
38
+ scanner.getch # consume the slash
39
+ break
40
+ else
41
+ next_segment << scanner.getch # append the slash
42
+ end
43
+ end
44
+
45
+ case next_segment.chomp
46
+ when ""
47
+ stack = [stack.first]
48
+ when "::"
49
+ stack.push(TOPLEVEL_BINDING)
50
+ when "."
51
+ next
52
+ when ".."
53
+ stack.pop unless stack.size == 1
54
+ else
55
+ stack.push(Pry.binding_for(stack.last.eval(next_segment)))
56
+ end
57
+ rescue RescuableException => e
58
+ return handle_failure(next_segment, e)
59
+ end until scanner.eos?
60
+
61
+ stack
62
+ end
63
+
64
+ private
65
+
66
+ def complete?(segment)
67
+ SPECIAL_TERMS.include?(segment) || Pry::Code.complete_expression?(segment)
68
+ end
69
+
70
+ def handle_failure(context, err)
71
+ msg = [
72
+ "Bad object path: #{@path_string.inspect}",
73
+ "Failed trying to resolve: #{context.inspect}",
74
+ "Exception: #{err.inspect}"
75
+ ].join("\n")
76
+
77
+ command_error = CommandError.new(msg)
78
+ command_error.set_backtrace(err.backtrace)
79
+
80
+ raise command_error
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,50 @@
1
+ class Pry::Output
2
+ attr_reader :_pry_
3
+
4
+ def initialize(_pry_)
5
+ @_pry_ = _pry_
6
+ @boxed_io = _pry_.config.output
7
+ end
8
+
9
+ def puts(*objs)
10
+ return print "\n" if objs.empty?
11
+
12
+ objs.each do |obj|
13
+ if (ary = Array.try_convert(obj))
14
+ puts(*ary)
15
+ else
16
+ print "#{obj.to_s.chomp}\n"
17
+ end
18
+ end
19
+ nil
20
+ end
21
+
22
+ def print(*objs)
23
+ objs.each do |obj|
24
+ @boxed_io.print decolorize_maybe(obj.to_s)
25
+ end
26
+ nil
27
+ end
28
+ alias << print
29
+ alias write print
30
+
31
+ def tty?
32
+ @boxed_io.respond_to?(:tty?) and @boxed_io.tty?
33
+ end
34
+
35
+ def method_missing(name, *args, &block)
36
+ @boxed_io.__send__(name, *args, &block)
37
+ end
38
+
39
+ def respond_to_missing?(m, include_all = false)
40
+ @boxed_io.respond_to?(m, include_all)
41
+ end
42
+
43
+ def decolorize_maybe(str)
44
+ if _pry_.config.color
45
+ str
46
+ else
47
+ Pry::Helpers::Text.strip_color str
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,250 @@
1
+ require 'pry/terminal'
2
+
3
+ # A pager is an `IO`-like object that accepts text and either prints it
4
+ # immediately, prints it one page at a time, or streams it to an external
5
+ # program to print one page at a time.
6
+ class Pry
7
+ class Pager
8
+ class StopPaging < StandardError
9
+ end
10
+
11
+ attr_reader :_pry_
12
+
13
+ def initialize(_pry_)
14
+ @_pry_ = _pry_
15
+ end
16
+
17
+ # Send the given text through the best available pager (if
18
+ # `Pry.config.pager` is enabled). If you want to send text through in
19
+ # chunks as you generate it, use `open` to get a writable object
20
+ # instead.
21
+ #
22
+ # @param [String] text
23
+ # Text to run through a pager.
24
+ #
25
+ def page(text)
26
+ open do |pager|
27
+ pager << text
28
+ end
29
+ end
30
+
31
+ # Yields a pager object (`NullPager`, `SimplePager`, or `SystemPager`).
32
+ # All pagers accept output with `#puts`, `#print`, `#write`, and `#<<`.
33
+ def open
34
+ pager = best_available
35
+ yield pager
36
+ rescue StopPaging
37
+ ensure
38
+ pager.close if pager
39
+ end
40
+
41
+ private
42
+
43
+ def enabled?; !!@enabled; end
44
+
45
+ def output; @output; end
46
+
47
+ # Return an instance of the "best" available pager class --
48
+ # `SystemPager` if possible, `SimplePager` if `SystemPager` isn't
49
+ # available, and `NullPager` if the user has disabled paging. All
50
+ # pagers accept output with `#puts`, `#print`, `#write`, and `#<<`. You
51
+ # must call `#close` when you're done writing output to a pager, and
52
+ # you must rescue `Pry::Pager::StopPaging`. These requirements can be
53
+ # avoided by using `.open` instead.
54
+ def best_available
55
+ if !_pry_.config.pager
56
+ NullPager.new(_pry_.output)
57
+ elsif !SystemPager.available? || Helpers::Platform.jruby?
58
+ SimplePager.new(_pry_.output)
59
+ else
60
+ SystemPager.new(_pry_.output)
61
+ end
62
+ end
63
+
64
+ # `NullPager` is a "pager" that actually just prints all output as it
65
+ # comes in. Used when `Pry.config.pager` is false.
66
+ class NullPager
67
+ def initialize(out)
68
+ @out = out
69
+ end
70
+
71
+ def puts(str)
72
+ print "#{str.chomp}\n"
73
+ end
74
+
75
+ def print(str)
76
+ write str
77
+ end
78
+ alias << print
79
+
80
+ def write(str)
81
+ @out.write str
82
+ end
83
+
84
+ def close
85
+ end
86
+
87
+ private
88
+
89
+ def height
90
+ @height ||= Pry::Terminal.height!
91
+ end
92
+
93
+ def width
94
+ @width ||= Pry::Terminal.width!
95
+ end
96
+ end
97
+
98
+ # `SimplePager` is a straightforward pure-Ruby pager. We use it on
99
+ # JRuby and when we can't find a usable external pager.
100
+ class SimplePager < NullPager
101
+ def initialize(*)
102
+ super
103
+ @tracker = PageTracker.new(height - 3, width)
104
+ end
105
+
106
+ def write(str)
107
+ str.lines.each do |line|
108
+ @out.print line
109
+ @tracker.record line
110
+
111
+ if @tracker.page?
112
+ @out.print "\n"
113
+ @out.print "\e[0m"
114
+ @out.print "<page break> --- Press enter to continue " \
115
+ "( q<enter> to break ) --- <page break>\n"
116
+ raise StopPaging if Readline.readline("").chomp == "q"
117
+
118
+ @tracker.reset
119
+ end
120
+ end
121
+ end
122
+ end
123
+
124
+ # `SystemPager` buffers output until we're pretty sure it's at least a
125
+ # page long, then invokes an external pager and starts streaming output
126
+ # to it. If `#close` is called before then, it just prints out the
127
+ # buffered content.
128
+ class SystemPager < NullPager
129
+ def self.default_pager
130
+ pager = ENV["PAGER"] || ""
131
+
132
+ # Default to less, and make sure less is being passed the correct
133
+ # options
134
+ if pager.strip.empty? or pager =~ /^less\b/
135
+ pager = "less -R -F -X"
136
+ end
137
+
138
+ pager
139
+ end
140
+
141
+ @system_pager = nil
142
+
143
+ def self.available?
144
+ if @system_pager.nil?
145
+ @system_pager = begin
146
+ pager_executable = default_pager.split(' ').first
147
+ if Helpers::Platform.windows? || Helpers::Platform.windows_ansi?
148
+ `where /Q #{pager_executable}`
149
+ else
150
+ `which #{pager_executable}`
151
+ end
152
+ $?.success?
153
+ rescue
154
+ false
155
+ end
156
+ else
157
+ @system_pager
158
+ end
159
+ end
160
+
161
+ def initialize(*)
162
+ super
163
+ @tracker = PageTracker.new(height, width)
164
+ @buffer = ""
165
+ @pager = nil
166
+ end
167
+
168
+ def write(str)
169
+ if invoked_pager?
170
+ write_to_pager str
171
+ else
172
+ @tracker.record str
173
+ @buffer << str
174
+
175
+ if @tracker.page?
176
+ write_to_pager @buffer
177
+ end
178
+ end
179
+ rescue Errno::EPIPE
180
+ raise StopPaging
181
+ end
182
+
183
+ def close
184
+ if invoked_pager?
185
+ pager.close
186
+ else
187
+ @out.puts @buffer
188
+ end
189
+ end
190
+
191
+ private
192
+
193
+ def write_to_pager(text)
194
+ pager.write @out.decolorize_maybe(text)
195
+ end
196
+
197
+ def invoked_pager?
198
+ @pager
199
+ end
200
+
201
+ def pager
202
+ @pager ||= IO.popen(self.class.default_pager, 'w')
203
+ end
204
+ end
205
+
206
+ # `PageTracker` tracks output to determine whether it's likely to take
207
+ # up a whole page. This doesn't need to be super precise, but we can
208
+ # use it for `SimplePager` and to avoid invoking the system pager
209
+ # unnecessarily.
210
+ #
211
+ # One simplifying assumption is that we don't need `#page?` to return
212
+ # `true` on the basis of an incomplete line. Long lines should be
213
+ # counted as multiple lines, but we don't have to transition from
214
+ # `false` to `true` until we see a newline.
215
+ class PageTracker
216
+ def initialize(rows, cols)
217
+ @rows, @cols = rows, cols
218
+ reset
219
+ end
220
+
221
+ def record(str)
222
+ str.lines.each do |line|
223
+ if line.end_with? "\n"
224
+ @row += ((@col + line_length(line) - 1) / @cols) + 1
225
+ @col = 0
226
+ else
227
+ @col += line_length(line)
228
+ end
229
+ end
230
+ end
231
+
232
+ def page?
233
+ @row >= @rows
234
+ end
235
+
236
+ def reset
237
+ @row = 0
238
+ @col = 0
239
+ end
240
+
241
+ private
242
+
243
+ # Approximation of the printable length of a given line, without the
244
+ # newline and without ANSI color codes.
245
+ def line_length(line)
246
+ line.chomp.gsub(/\e\[[\d;]*m/, '').length
247
+ end
248
+ end
249
+ end
250
+ end
@@ -0,0 +1,91 @@
1
+ class Pry
2
+ module Platform
3
+ extend self
4
+
5
+ #
6
+ # @return [Boolean]
7
+ # Returns true if Pry is running on Mac OSX.
8
+ #
9
+ # @note
10
+ # Queries RbConfig::CONFIG['host_os'] with a best guess.
11
+ #
12
+ def mac_osx?
13
+ !!(RbConfig::CONFIG['host_os'] =~ /\Adarwin/i)
14
+ end
15
+
16
+ #
17
+ # @return [Boolean]
18
+ # Returns true if Pry is running on Linux.
19
+ #
20
+ # @note
21
+ # Queries RbConfig::CONFIG['host_os'] with a best guess.
22
+ #
23
+ def linux?
24
+ !!(RbConfig::CONFIG['host_os'] =~ /linux/i)
25
+ end
26
+
27
+ #
28
+ # @return [Boolean]
29
+ # Returns true if Pry is running on Windows.
30
+ #
31
+ # @note
32
+ # Queries RbConfig::CONFIG['host_os'] with a best guess.
33
+ #
34
+ def windows?
35
+ !!(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/)
36
+ end
37
+
38
+ #
39
+ # @return [Boolean]
40
+ # Returns true when Pry is running on Windows with ANSI support.
41
+ #
42
+ def windows_ansi?
43
+ return false if not windows?
44
+
45
+ !!(defined?(Win32::Console) or ENV['ANSICON'] or mri_2?)
46
+ end
47
+
48
+ #
49
+ # @return [Boolean]
50
+ # Returns true when Pry is being run from JRuby.
51
+ #
52
+ def jruby?
53
+ RbConfig::CONFIG['ruby_install_name'] == 'jruby'
54
+ end
55
+
56
+ #
57
+ # @return [Boolean]
58
+ # Returns true when Pry is being run from JRuby in 1.9 mode.
59
+ #
60
+ def jruby_19?
61
+ jruby? and RbConfig::CONFIG['ruby_version'] == '1.9'
62
+ end
63
+
64
+ #
65
+ # @return [Boolean]
66
+ # Returns true when Pry is being run from MRI (CRuby).
67
+ #
68
+ def mri?
69
+ RbConfig::CONFIG['ruby_install_name'] == 'ruby'
70
+ end
71
+
72
+ #
73
+ # @return [Boolean]
74
+ # Returns true when Pry is being run from MRI v1.9+ (CRuby).
75
+ #
76
+ def mri_19?
77
+ !!(mri? and RUBY_VERSION =~ /\A1\.9/)
78
+ end
79
+
80
+ #
81
+ # @return [Boolean]
82
+ # Returns true when Pry is being run from MRI v2+ (CRuby).
83
+ #
84
+ def mri_2?
85
+ !!(mri? and RUBY_VERSION =~ /\A2/)
86
+ end
87
+ end
88
+
89
+ # Not supported on MRI 2.2 and lower.
90
+ deprecate_constant(:Platform) if respond_to?(:deprecate_constant)
91
+ end