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,13 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc 'Run tests'
8
+ task :default do
9
+ ENV['TEST'] = 'test/test_colorize.rb'
10
+ Rake::Task[:test].execute
11
+ ENV['TEST'] = 'test/test_colorized_string.rb'
12
+ Rake::Task[:test].execute
13
+ end
@@ -0,0 +1,36 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'colorize'
3
+ s.version = '0.8.1'
4
+
5
+ s.authors = ['Michał Kalbarczyk']
6
+ s.email = 'fazibear@gmail.com'
7
+
8
+ s.date = Time.now.strftime('%Y-%m-%d')
9
+
10
+ s.homepage = 'http://github.com/fazibear/colorize'
11
+ s.description = 'Extends String class or add a ColorizedString with methods to set text color, background color and text effects.'
12
+ s.summary = 'Ruby gem for colorizing text using ANSI escape sequences.'
13
+ s.license = 'GPL-2.0'
14
+
15
+ s.require_paths = ['lib']
16
+
17
+ s.add_development_dependency 'rake', '~> 10.0'
18
+ s.add_development_dependency 'minitest', '~> 5.0'
19
+ s.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
20
+
21
+ s.files = [
22
+ 'LICENSE',
23
+ 'CHANGELOG',
24
+ 'README.md',
25
+ 'Rakefile',
26
+ 'colorize.gemspec',
27
+ 'lib/colorize.rb',
28
+ 'lib/colorized_string.rb',
29
+ 'lib/colorize/class_methods.rb',
30
+ 'lib/colorize/instance_methods.rb',
31
+ 'test/test_colorize.rb',
32
+ ]
33
+ s.test_files = [
34
+ 'test/test_colorize.rb'
35
+ ]
36
+ end
@@ -0,0 +1,120 @@
1
+ module Colorize
2
+ module ClassMethods
3
+ #
4
+ # Property to disable colorization
5
+ #
6
+ def disable_colorization(value = nil)
7
+ if value.nil?
8
+ if defined?(@disable_colorization)
9
+ @disable_colorization || false
10
+ else
11
+ false
12
+ end
13
+ else
14
+ @disable_colorization = (value || false)
15
+ end
16
+ end
17
+
18
+ #
19
+ # Setter for disable colorization
20
+ #
21
+ def disable_colorization=(value)
22
+ @disable_colorization = (value || false)
23
+ end
24
+
25
+ #
26
+ # Return array of available colors used by colorize
27
+ #
28
+ def colors
29
+ color_codes.keys
30
+ end
31
+
32
+ #
33
+ # Return array of available modes used by colorize
34
+ #
35
+ def modes
36
+ mode_codes.keys
37
+ end
38
+
39
+ #
40
+ # Display color samples
41
+ #
42
+ def color_samples
43
+ colors.permutation(2).each do |background, color|
44
+ sample_text = "#{color.inspect.rjust(15)} on #{background.inspect.ljust(15)}"
45
+ puts "#{new(sample_text).colorize(:color => color, :background => background)} #{sample_text}"
46
+ end
47
+ end
48
+
49
+ #
50
+ # Method removed, raise NoMethodError
51
+ #
52
+ def color_matrix(_ = '')
53
+ fail NoMethodError, '#color_matrix method was removed, try #color_samples instead'
54
+ end
55
+
56
+ # private
57
+
58
+ #
59
+ # Color codes hash
60
+ #
61
+ def color_codes
62
+ {
63
+ :black => 0, :light_black => 60,
64
+ :red => 1, :light_red => 61,
65
+ :green => 2, :light_green => 62,
66
+ :yellow => 3, :light_yellow => 63,
67
+ :blue => 4, :light_blue => 64,
68
+ :magenta => 5, :light_magenta => 65,
69
+ :cyan => 6, :light_cyan => 66,
70
+ :white => 7, :light_white => 67,
71
+ :default => 9
72
+ }
73
+ end
74
+
75
+ #
76
+ # Mode codes hash
77
+ #
78
+ def mode_codes
79
+ {
80
+ :default => 0, # Turn off all attributes
81
+ :bold => 1, # Set bold mode
82
+ :italic => 3, # Set italic mode
83
+ :underline => 4, # Set underline mode
84
+ :blink => 5, # Set blink mode
85
+ :swap => 7, # Exchange foreground and background colors
86
+ :hide => 8 # Hide text (foreground color would be the same as background)
87
+ }
88
+ end
89
+
90
+ #
91
+ # Generate color and on_color methods
92
+ #
93
+ def color_methods
94
+ colors.each do |key|
95
+ next if key == :default
96
+
97
+ define_method key do
98
+ colorize(:color => key)
99
+ end
100
+
101
+ define_method "on_#{key}" do
102
+ colorize(:background => key)
103
+ end
104
+ end
105
+ end
106
+
107
+ #
108
+ # Generate modes methods
109
+ #
110
+ def modes_methods
111
+ modes.each do |key|
112
+ next if key == :default
113
+
114
+ define_method key do
115
+ colorize(:mode => key)
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,132 @@
1
+ module Colorize
2
+ module InstanceMethods
3
+ #
4
+ # Change color of string
5
+ #
6
+ # Examples:
7
+ #
8
+ # puts "This is blue".colorize(:blue)
9
+ # puts "This is light blue".colorize(:light_blue)
10
+ # puts "This is also blue".colorize(:color => :blue)
11
+ # puts "This is light blue with red background".colorize(:color => :light_blue, :background => :red)
12
+ # puts "This is light blue with red background".colorize(:light_blue ).colorize( :background => :red)
13
+ # puts "This is blue text on red".blue.on_red
14
+ # puts "This is red on blue".colorize(:red).on_blue
15
+ # puts "This is red on blue and underline".colorize(:red).on_blue.underline
16
+ # puts "This is blue text on red".blue.on_red.blink
17
+ # puts "This is uncolorized".blue.on_red.uncolorize
18
+ #
19
+ def colorize(params)
20
+ return self if self.class.disable_colorization
21
+ require_windows_libs
22
+ scan_for_colors.inject(self.class.new) do |str, match|
23
+ colors_from_params(match, params)
24
+ defaults_colors(match)
25
+ str << "\033[#{match[0]};#{match[1]};#{match[2]}m#{match[3]}\033[0m"
26
+ end
27
+ end
28
+
29
+ #
30
+ # Return uncolorized string
31
+ #
32
+ def uncolorize
33
+ scan_for_colors.inject(self.class.new) do |str, match|
34
+ str << match[3]
35
+ end
36
+ end
37
+
38
+ #
39
+ # Return true if string is colorized
40
+ #
41
+ def colorized?
42
+ scan_for_colors.inject([]) do |colors, match|
43
+ colors << match.tap(&:pop)
44
+ end.flatten.compact.any?
45
+ end
46
+
47
+ private
48
+
49
+ #
50
+ # Set default colors
51
+ #
52
+ def defaults_colors(match)
53
+ match[0] ||= mode(:default)
54
+ match[1] ||= color(:default)
55
+ match[2] ||= background_color(:default)
56
+ end
57
+
58
+ #
59
+ # Set color from params
60
+ #
61
+ def colors_from_params(match, params)
62
+ case params
63
+ when Hash then colors_from_hash(match, params)
64
+ when Symbol then color_from_symbol(match, params)
65
+ end
66
+ end
67
+
68
+ #
69
+ # Set colors from params hash
70
+ #
71
+ def colors_from_hash(match, hash)
72
+ match[0] = mode(hash[:mode]) if mode(hash[:mode])
73
+ match[1] = color(hash[:color]) if color(hash[:color])
74
+ match[2] = background_color(hash[:background]) if background_color(hash[:background])
75
+ end
76
+
77
+ #
78
+ # Set color from params symbol
79
+ #
80
+ def color_from_symbol(match, symbol)
81
+ match[1] = color(symbol) if color(symbol)
82
+ end
83
+
84
+ #
85
+ # Color for foreground (offset 30)
86
+ #
87
+ def color(color)
88
+ self.class.color_codes[color] + 30 if self.class.color_codes[color]
89
+ end
90
+
91
+ #
92
+ # Color for background (offset 40)
93
+ #
94
+ def background_color(color)
95
+ self.class.color_codes[color] + 40 if self.class.color_codes[color]
96
+ end
97
+
98
+ #
99
+ # Mode
100
+ #
101
+ def mode(mode)
102
+ self.class.mode_codes[mode]
103
+ end
104
+
105
+ #
106
+ # Scan for colorized string
107
+ #
108
+ def scan_for_colors
109
+ scan(/\033\[([0-9;]+)m(.+?)\033\[0m|([^\033]+)/m).map do |match|
110
+ split_colors(match)
111
+ end
112
+ end
113
+
114
+ def split_colors(match)
115
+ colors = (match[0] || '').split(';')
116
+ array = Array.new(3)
117
+ array[0], array[1], array[2] = colors if colors.length == 3
118
+ array[1] = colors if colors.length == 1
119
+ array[3] = match[1] || match[2]
120
+ array
121
+ end
122
+
123
+ #
124
+ # Require windows libs
125
+ #
126
+ def require_windows_libs
127
+ require 'Win32/Console/ANSI' if RUBY_VERSION < '2.0.0' && RUBY_PLATFORM =~ /win32/
128
+ rescue LoadError
129
+ raise 'You must gem install win32console to use colorize on Windows'
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,12 @@
1
+ require File.expand_path('colorize/class_methods', File.dirname(__FILE__))
2
+ require File.expand_path('colorize/instance_methods', File.dirname(__FILE__))
3
+ #
4
+ # String class extension.
5
+ #
6
+ class String
7
+ extend Colorize::ClassMethods
8
+ include Colorize::InstanceMethods
9
+
10
+ color_methods
11
+ modes_methods
12
+ end
@@ -0,0 +1,19 @@
1
+ require File.expand_path('colorize/class_methods', File.dirname(__FILE__))
2
+ require File.expand_path('colorize/instance_methods', File.dirname(__FILE__))
3
+ #
4
+ # ColorizedString class extension.
5
+ #
6
+ class ColorizedString < String
7
+ extend Colorize::ClassMethods
8
+ include Colorize::InstanceMethods
9
+
10
+ color_methods
11
+ modes_methods
12
+
13
+ #
14
+ # Sortcut to create ColorizedString with ColorizedString['test'].
15
+ #
16
+ def self.[](string)
17
+ ColorizedString.new(string)
18
+ end
19
+ end
@@ -0,0 +1,164 @@
1
+ require 'codeclimate-test-reporter'
2
+ CodeClimate::TestReporter.start
3
+
4
+ require 'minitest/autorun'
5
+ require File.dirname(__FILE__) + '/../lib/colorize'
6
+
7
+ class TestColorize < Minitest::Test
8
+ def test_blue_symbol
9
+ assert_equal 'This is blue'.colorize(:blue),
10
+ "\e[0;34;49mThis is blue\e[0m"
11
+ end
12
+
13
+ def test_incorrect_symbol
14
+ assert_equal 'This is incorrect color'.colorize(:bold),
15
+ "\e[0;39;49mThis is incorrect color\e[0m"
16
+ end
17
+
18
+ def test_incorrect_hash
19
+ assert_equal 'This is incorrect color'.colorize(:color => :bold),
20
+ "\e[0;39;49mThis is incorrect color\e[0m"
21
+
22
+ assert_equal 'This is incorrect color'.colorize(:mode => :green),
23
+ "\e[0;39;49mThis is incorrect color\e[0m"
24
+
25
+ assert_equal 'This is incorrect color'.colorize(:background => :bold),
26
+ "\e[0;39;49mThis is incorrect color\e[0m"
27
+ end
28
+
29
+ def test_blue_hash
30
+ assert_equal 'This is also blue'.colorize(:color => :blue),
31
+ "\e[0;34;49mThis is also blue\e[0m"
32
+ end
33
+
34
+ def test_light_blue_symbol
35
+ assert_equal 'This is light blue'.colorize(:light_blue),
36
+ "\e[0;94;49mThis is light blue\e[0m"
37
+ end
38
+
39
+ def test_light_blue_with_red_background_hash
40
+ assert_equal 'This is light blue with red background'.colorize(:color => :light_blue, :background => :red),
41
+ "\e[0;94;41mThis is light blue with red background\e[0m"
42
+ end
43
+
44
+ def test_light_blue_with_red_background_symbol_and_hash
45
+ assert_equal 'This is light blue with red background'.colorize(:light_blue).colorize(:background => :red),
46
+ "\e[0;94;41mThis is light blue with red background\e[0m"
47
+ end
48
+
49
+ def test_blue_with_red_background_method
50
+ assert_equal 'This is blue text on red'.blue.on_red,
51
+ "\e[0;34;41mThis is blue text on red\e[0m"
52
+ end
53
+
54
+ def test_red_with_blue_background_symbol_and_method
55
+ assert_equal 'This is red on blue'.colorize(:red).on_blue,
56
+ "\e[0;31;44mThis is red on blue\e[0m"
57
+ end
58
+
59
+ def test_red_with_blue_background_and_underline_sumbol_and_methods
60
+ assert_equal 'This is red on blue and underline'.colorize(:red).on_blue.underline,
61
+ "\e[4;31;44mThis is red on blue and underline\e[0m"
62
+ end
63
+
64
+ def test_blue_with_red_background_and_blink_methods
65
+ assert_equal 'This is blue text on red'.blue.on_red.blink,
66
+ "\e[5;34;41mThis is blue text on red\e[0m"
67
+ end
68
+
69
+ def test_uncolorize
70
+ assert_equal 'This is uncolorized'.blue.on_red.uncolorize,
71
+ 'This is uncolorized'
72
+ end
73
+
74
+ def test_colorized?
75
+ assert_equal 'Red'.red.colorized?, true
76
+ assert_equal 'Blue'.colorized?, false
77
+ assert_equal 'Green'.blue.green.uncolorize.colorized?, false
78
+ end
79
+
80
+ def test_concatenated__colorize?
81
+ assert_equal "none #{'red'.red} none #{'blue'.blue} none".colorized?, true
82
+ assert_equal "none #{'red'.red} none #{'blue'.blue} none".uncolorize.colorized?, false
83
+ end
84
+
85
+ def test_concatenated_strings_on_green
86
+ assert_equal "none #{'red'.red} none #{'blue'.blue} none".on_green,
87
+ "\e[0;39;42mnone \e[0m\e[0;31;42mred\e[0m\e[0;39;42m none \e[0m\e[0;34;42mblue\e[0m\e[0;39;42m none\e[0m"
88
+ end
89
+
90
+ def test_concatenated_strings_uncolorize
91
+ assert_equal "none #{'red'.red} none #{'blue'.blue} none".uncolorize,
92
+ 'none red none blue none'
93
+ end
94
+
95
+ def test_frozen_strings
96
+ assert_equal 'This is blue text on red'.freeze.blue.on_red.blink,
97
+ "\e[5;34;41mThis is blue text on red\e[0m"
98
+ end
99
+
100
+ def test_new_line
101
+ assert_equal "This is blue\ntext on red".freeze.blue.on_red.blink,
102
+ "\e[5;34;41mThis is blue\ntext on red\e[0m"
103
+ end
104
+
105
+ def test_disable_colorization_with_=
106
+ String.disable_colorization = true
107
+ assert_equal String.disable_colorization, true
108
+ String.disable_colorization = false
109
+ end
110
+
111
+ def test_disable_colorization_with_method
112
+ String.disable_colorization true
113
+ assert_equal String.disable_colorization, true
114
+ String.disable_colorization false
115
+ end
116
+
117
+ def test_string_disable_colorization_with_=
118
+ String.disable_colorization = true
119
+
120
+ assert_equal String.disable_colorization, true
121
+
122
+ assert_equal 'This is blue after disabling'.blue,
123
+ 'This is blue after disabling'
124
+
125
+ String.disable_colorization = false
126
+
127
+ assert_equal 'This is blue after enabling'.colorize(:blue),
128
+ "\e[0;34;49mThis is blue after enabling\e[0m"
129
+ end
130
+
131
+ def test_string_disable_colorization_with_method
132
+ assert_equal 'This is blue before disabling'.colorize(:blue),
133
+ "\e[0;34;49mThis is blue before disabling\e[0m"
134
+
135
+ String.disable_colorization true
136
+
137
+ assert_equal String.disable_colorization, true
138
+
139
+ assert_equal 'This is blue after disabling'.blue,
140
+ 'This is blue after disabling'
141
+
142
+ String.disable_colorization false
143
+
144
+ assert_equal 'This is blue after enabling'.colorize(:blue),
145
+ "\e[0;34;49mThis is blue after enabling\e[0m"
146
+ end
147
+
148
+ def test_already_colored_string_with_one_value
149
+ assert_equal "\e[31mThis is red\e[0m".red,
150
+ 'This is red'.red
151
+ end
152
+
153
+ def test_color_matrix_method
154
+ assert_raises NoMethodError do
155
+ String.color_matrix
156
+ end
157
+ end
158
+
159
+ def test_color_samples_method
160
+ assert_output do
161
+ String.color_samples
162
+ end
163
+ end
164
+ end