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.
- checksums.yaml +7 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +21 -0
- data/README.md +26 -0
- data/chess_engine.gemspec +14 -0
- data/lib/chess_engine/board.rb +95 -0
- data/lib/chess_engine/cli.rb +105 -0
- data/lib/chess_engine/game.rb +148 -0
- data/lib/chess_engine/input.rb +19 -0
- data/lib/chess_engine/move.rb +35 -0
- data/lib/chess_engine/piece.rb +97 -0
- data/lib/chess_engine/validator.rb +87 -0
- data/lib/chess_engine.rb +1 -0
- data/spec/board_spec.rb +70 -0
- data/spec/game_helper.rb +5 -0
- data/spec/game_spec.rb +79 -0
- data/spec/spec_helper.rb +100 -0
- data/spec/validator_spec.rb +26 -0
- data/vendor/bundle/bin/coderay +27 -0
- data/vendor/bundle/bin/pry +27 -0
- data/vendor/bundle/cache/coderay-1.1.2.gem +0 -0
- data/vendor/bundle/cache/colorize-0.8.1.gem +0 -0
- data/vendor/bundle/cache/method_source-0.9.2.gem +0 -0
- data/vendor/bundle/cache/pry-0.12.2.gem +0 -0
- data/vendor/bundle/cache/rb-readline-0.5.5.gem +0 -0
- data/vendor/bundle/gems/coderay-1.1.2/MIT-LICENSE +22 -0
- data/vendor/bundle/gems/coderay-1.1.2/README_INDEX.rdoc +123 -0
- data/vendor/bundle/gems/coderay-1.1.2/bin/coderay +215 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/duo.rb +81 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/_map.rb +17 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/comment_filter.rb +25 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/count.rb +39 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/debug.rb +49 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/debug_lint.rb +63 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/div.rb +23 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/encoder.rb +190 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/filter.rb +58 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/css.rb +65 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/numbering.rb +108 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html/output.rb +166 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/html.rb +333 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/json.rb +83 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/lines_of_code.rb +45 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/lint.rb +59 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/null.rb +18 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/page.rb +24 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/span.rb +23 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/statistic.rb +95 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/terminal.rb +195 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/text.rb +46 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/token_kind_filter.rb +111 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/xml.rb +72 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders/yaml.rb +50 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/encoders.rb +18 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/for_redcloth.rb +95 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/file_type.rb +151 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/plugin.rb +55 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/plugin_host.rb +221 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/helpers/word_list.rb +72 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/_map.rb +24 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/c.rb +189 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/clojure.rb +217 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/cpp.rb +217 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/css.rb +196 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/debug.rb +75 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/delphi.rb +144 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/diff.rb +221 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/erb.rb +81 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/go.rb +208 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/groovy.rb +268 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/haml.rb +168 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/html.rb +275 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java/builtin_types.rb +421 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java.rb +174 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/java_script.rb +237 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/json.rb +98 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/lua.rb +280 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/php.rb +527 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/python.rb +287 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/raydebug.rb +75 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby/patterns.rb +178 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby/string_state.rb +79 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/ruby.rb +477 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/sass.rb +232 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/scanner.rb +337 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/sql.rb +169 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/taskpaper.rb +36 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/text.rb +26 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/xml.rb +17 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners/yaml.rb +140 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/scanners.rb +27 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/_map.rb +7 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/alpha.rb +153 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles/style.rb +18 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/styles.rb +15 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/token_kinds.rb +85 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/tokens.rb +161 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/tokens_proxy.rb +55 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay/version.rb +3 -0
- data/vendor/bundle/gems/coderay-1.1.2/lib/coderay.rb +284 -0
- data/vendor/bundle/gems/colorize-0.8.1/CHANGELOG +65 -0
- data/vendor/bundle/gems/colorize-0.8.1/LICENSE +339 -0
- data/vendor/bundle/gems/colorize-0.8.1/README.md +105 -0
- data/vendor/bundle/gems/colorize-0.8.1/Rakefile +13 -0
- data/vendor/bundle/gems/colorize-0.8.1/colorize.gemspec +36 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorize/class_methods.rb +120 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorize/instance_methods.rb +132 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorize.rb +12 -0
- data/vendor/bundle/gems/colorize-0.8.1/lib/colorized_string.rb +19 -0
- data/vendor/bundle/gems/colorize-0.8.1/test/test_colorize.rb +164 -0
- data/vendor/bundle/gems/method_source-0.9.2/Gemfile +2 -0
- data/vendor/bundle/gems/method_source-0.9.2/LICENSE +25 -0
- data/vendor/bundle/gems/method_source-0.9.2/README.markdown +91 -0
- data/vendor/bundle/gems/method_source-0.9.2/Rakefile +81 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/code_helpers.rb +154 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/source_location.rb +138 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source/version.rb +3 -0
- data/vendor/bundle/gems/method_source-0.9.2/lib/method_source.rb +141 -0
- data/vendor/bundle/gems/method_source-0.9.2/method_source.gemspec +35 -0
- data/vendor/bundle/gems/method_source-0.9.2/spec/method_source/code_helpers_spec.rb +43 -0
- data/vendor/bundle/gems/method_source-0.9.2/spec/method_source_spec.rb +143 -0
- data/vendor/bundle/gems/method_source-0.9.2/spec/spec_helper.rb +101 -0
- data/vendor/bundle/gems/pry-0.12.2/CHANGELOG.md +953 -0
- data/vendor/bundle/gems/pry-0.12.2/LICENSE +25 -0
- data/vendor/bundle/gems/pry-0.12.2/README.md +390 -0
- data/vendor/bundle/gems/pry-0.12.2/bin/pry +8 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/basic_object.rb +6 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/cli.rb +218 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/code_file.rb +110 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/code_range.rb +71 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code/loc.rb +98 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code.rb +353 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/code_object.rb +195 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/color_printer.rb +65 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/command.rb +723 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/command_set.rb +415 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/amend_line.rb +98 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/bang.rb +20 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/bang_pry.rb +17 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/abstract_formatter.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/exception_formatter.rb +79 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/file_formatter.rb +71 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat/input_expression_formatter.rb +43 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cat.rb +63 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/cd.rb +41 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/change_inspector.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/change_prompt.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/clear_screen.rb +14 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/code_collector.rb +167 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/disable_pry.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/disabled_commands.rb +2 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/easter_eggs.rb +112 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit/exception_patcher.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit/file_and_line_locator.rb +36 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/edit.rb +200 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit.rb +43 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit_all.rb +29 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/exit_program.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/find_method.rb +191 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/fix_indent.rb +19 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_cd.rb +26 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_install.rb +32 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_list.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_open.rb +29 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_readme.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_search.rb +40 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gem_stats.rb +83 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/gist.rb +102 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/help.rb +164 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/hist.rb +181 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/import_set.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/install_command.rb +54 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/jump_to.rb +29 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/list_inspectors.rb +35 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/constants.rb +58 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/formatter.rb +51 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/globals.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/grep.rb +19 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/instance_vars.rb +38 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/interrogatable.rb +18 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/jruby_hacks.rb +49 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/local_names.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/local_vars.rb +37 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/ls_entity.rb +69 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods.rb +54 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/methods_helper.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls/self_methods.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ls.rb +113 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/nesting.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/play.rb +102 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/pry_backtrace.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/pry_version.rb +17 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/raise_up.rb +33 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/reload_code.rb +62 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/reset.rb +18 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/ri.rb +65 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/save_file.rb +61 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/shell_command.rb +75 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/shell_mode.rb +25 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_doc.rb +81 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_info.rb +216 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_input.rb +17 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/show_source.rb +53 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/stat.rb +40 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/switch_to.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/toggle_color.rb +24 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/watch_expression/expression.rb +38 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/watch_expression.rb +107 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/whereami.rb +197 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands/wtf.rb +70 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/commands.rb +6 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/behavior.rb +255 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/convenience.rb +28 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/default.rb +159 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config/memoization.rb +48 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/config.rb +35 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/core_extensions.rb +142 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/editor.rb +128 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/exceptions.rb +76 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/forwardable.rb +23 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/base_helpers.rb +200 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/command_helpers.rb +157 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/documentation_helpers.rb +76 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/options_helpers.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/platform.rb +58 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/table.rb +114 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers/text.rb +115 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/helpers.rb +6 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/history.rb +161 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/hooks.rb +171 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/indent.rb +408 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/input_completer.rb +265 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/input_lock.rb +130 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/inspector.rb +27 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/last_exception.rb +61 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/disowned.rb +55 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/patcher.rb +122 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb +198 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/method.rb +552 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/object_path.rb +83 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/output.rb +50 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/pager.rb +250 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/platform.rb +91 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/plugins.rb +122 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/prompt.rb +145 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/pry_class.rb +425 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/pry_instance.rb +699 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/repl.rb +261 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/repl_file_loader.rb +73 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/ring.rb +84 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/rubygem.rb +84 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/LICENSE +20 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/commands.rb +195 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop/option.rb +206 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/slop.rb +661 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/terminal.rb +91 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/evalable.rb +15 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/mockable.rb +14 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/pry_tester.rb +73 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/utility.rb +26 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable/variables.rb +46 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/testable.rb +70 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/version.rb +3 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/wrapped_module/candidate.rb +131 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry/wrapped_module.rb +378 -0
- data/vendor/bundle/gems/pry-0.12.2/lib/pry.rb +132 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/CHANGES +94 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/LICENSE +25 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/README.md +81 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/Rakefile +25 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/bench/_rl_adjust_point.rb +26 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/examples/example_readline.rb +8 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/examples/example_readline_with_completion.rb +18 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/examples/tinyirb.rb +11 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/rb-readline.rb +18 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/rbreadline/version.rb +3 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/rbreadline.rb +8920 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/lib/readline.rb +539 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/rb-readline.gemspec +51 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/setup.rb +1585 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/support/filesystem_completion_helper.rb +53 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_completion.rb +100 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_filename_completion_proc.rb +88 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_history.rb +29 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_rbreadline.rb +23 -0
- data/vendor/bundle/gems/rb-readline-0.5.5/test/test_readline.rb +221 -0
- data/vendor/bundle/specifications/coderay-1.1.2.gemspec +26 -0
- data/vendor/bundle/specifications/colorize-0.8.1.gemspec +38 -0
- data/vendor/bundle/specifications/method_source-0.9.2.gemspec +35 -0
- data/vendor/bundle/specifications/pry-0.12.2.gemspec +38 -0
- data/vendor/bundle/specifications/rb-readline-0.5.5.gemspec +39 -0
- metadata +363 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
require "./lib/chess_engine/game.rb"
|
2
|
+
|
3
|
+
describe ChessEngine::MoveValidator do
|
4
|
+
before(:each) do
|
5
|
+
@game = ChessEngine::Game.new
|
6
|
+
end
|
7
|
+
|
8
|
+
it "validates pawn moves" do
|
9
|
+
@game.instance_variable_get(:@board).set_at([1, 2], ChessEngine::Pawn.new(:black))
|
10
|
+
expect(@game.valid_moves([2, 1])).to contain_exactly([1, 2], [2, 2], [2, 3])
|
11
|
+
end
|
12
|
+
|
13
|
+
it "validates knight moves" do
|
14
|
+
@game.instance_variable_get(:@board).set_at([2, 4], ChessEngine::Knight.new(:white))
|
15
|
+
expect(@game.valid_moves([2, 4])).to contain_exactly(
|
16
|
+
[0, 3], [1, 2], [3, 2], [4, 3], [0, 5], [1, 6], [3, 6], [4, 5]
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "validates elephant moves" do
|
21
|
+
@game.instance_variable_get(:@board).set_at([2, 4], ChessEngine::Elephant.new(:white))
|
22
|
+
expect(@game.valid_moves([2, 4])).to contain_exactly(
|
23
|
+
[0, 2], [1, 3], [3, 5], [4, 6], [0, 6], [1, 5], [3, 3], [4, 2]
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by RubyGems.
|
4
|
+
#
|
5
|
+
# The application 'coderay' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
|
11
|
+
version = ">= 0.a"
|
12
|
+
|
13
|
+
if ARGV.first
|
14
|
+
str = ARGV.first
|
15
|
+
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
|
16
|
+
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
|
17
|
+
version = $1
|
18
|
+
ARGV.shift
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if Gem.respond_to?(:activate_bin_path)
|
23
|
+
load Gem.activate_bin_path('coderay', 'coderay', version)
|
24
|
+
else
|
25
|
+
gem "coderay", version
|
26
|
+
load Gem.bin_path("coderay", "coderay", version)
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by RubyGems.
|
4
|
+
#
|
5
|
+
# The application 'pry' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require 'rubygems'
|
10
|
+
|
11
|
+
version = ">= 0.a"
|
12
|
+
|
13
|
+
if ARGV.first
|
14
|
+
str = ARGV.first
|
15
|
+
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
|
16
|
+
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
|
17
|
+
version = $1
|
18
|
+
ARGV.shift
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
if Gem.respond_to?(:activate_bin_path)
|
23
|
+
load Gem.activate_bin_path('pry', 'pry', version)
|
24
|
+
else
|
25
|
+
gem "pry", version
|
26
|
+
load Gem.bin_path("pry", "pry", version)
|
27
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (C) 2005-2012 Kornelius Kalnbach <murphy@rubychan.de> (@murphy_karasu)
|
2
|
+
|
3
|
+
http://coderay.rubychan.de/
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,123 @@
|
|
1
|
+
= CodeRay
|
2
|
+
|
3
|
+
Tired of blue'n'gray? Try the original version of this documentation on
|
4
|
+
coderay.rubychan.de[http://coderay.rubychan.de/doc/] :-)
|
5
|
+
|
6
|
+
== About
|
7
|
+
|
8
|
+
CodeRay is a Ruby library for syntax highlighting.
|
9
|
+
|
10
|
+
You put your code in, and you get it back colored; Keywords, strings,
|
11
|
+
floats, comments - all in different colors. And with line numbers.
|
12
|
+
|
13
|
+
*Syntax* *Highlighting*...
|
14
|
+
* makes code easier to read and maintain
|
15
|
+
* lets you detect syntax errors faster
|
16
|
+
* helps you to understand the syntax of a language
|
17
|
+
* looks nice
|
18
|
+
* is what everybody wants to have on their website
|
19
|
+
* solves all your problems and makes the girls run after you
|
20
|
+
|
21
|
+
|
22
|
+
== Installation
|
23
|
+
|
24
|
+
% gem install coderay
|
25
|
+
|
26
|
+
|
27
|
+
=== Dependencies
|
28
|
+
|
29
|
+
CodeRay needs Ruby 1.8.7+ or 1.9.2+. It also runs on Rubinius and JRuby.
|
30
|
+
|
31
|
+
|
32
|
+
== Example Usage
|
33
|
+
|
34
|
+
require 'coderay'
|
35
|
+
|
36
|
+
html = CodeRay.scan("puts 'Hello, world!'", :ruby).div(:line_numbers => :table)
|
37
|
+
|
38
|
+
|
39
|
+
== Documentation
|
40
|
+
|
41
|
+
See CodeRay.
|
42
|
+
|
43
|
+
|
44
|
+
== Credits
|
45
|
+
|
46
|
+
=== Special Thanks to
|
47
|
+
|
48
|
+
* licenser (Heinz N. Gies) for ending my QBasic career, inventing the Coder
|
49
|
+
project and the input/output plugin system.
|
50
|
+
CodeRay would not exist without him.
|
51
|
+
* bovi (Daniel Bovensiepen) for helping me out on various occasions.
|
52
|
+
|
53
|
+
=== Thanks to
|
54
|
+
|
55
|
+
* Caleb Clausen for writing RubyLexer (see
|
56
|
+
http://rubyforge.org/projects/rubylexer) and lots of very interesting mail
|
57
|
+
traffic
|
58
|
+
* birkenfeld (Georg Brandl) and mitsuhiku (Arnim Ronacher) for PyKleur, now pygments.
|
59
|
+
You guys rock!
|
60
|
+
* Jamis Buck for writing Syntax (see http://rubyforge.org/projects/syntax)
|
61
|
+
I got some useful ideas from it.
|
62
|
+
* Doug Kearns and everyone else who worked on ruby.vim - it not only helped me
|
63
|
+
coding CodeRay, but also gave me a wonderful target to reach for the Ruby
|
64
|
+
scanner.
|
65
|
+
* everyone who uses CodeBB on http://www.rubyforen.de and http://www.python-forum.de
|
66
|
+
* iGEL, magichisoka, manveru, WoNáDo and everyone I forgot from rubyforen.de
|
67
|
+
* Dethix from ruby-mine.de
|
68
|
+
* zickzackw
|
69
|
+
* Dookie (who is no longer with us...) and Leonidas from http://www.python-forum.de
|
70
|
+
* Andreas Schwarz for finding out that CaseIgnoringWordList was not case
|
71
|
+
ignoring! Such things really make you write tests.
|
72
|
+
* closure for the first version of the Scheme scanner.
|
73
|
+
* Stefan Walk for the first version of the JavaScript and PHP scanners.
|
74
|
+
* Josh Goebel for another version of the JavaScript scanner, a SQL and a Diff scanner.
|
75
|
+
* Jonathan Younger for pointing out the licence confusion caused by wrong LICENSE file.
|
76
|
+
* Jeremy Hinegardner for finding the shebang-on-empty-file bug in FileType.
|
77
|
+
* Charles Oliver Nutter and Yehuda Katz for helping me benchmark CodeRay on JRuby.
|
78
|
+
* Andreas Neuhaus for pointing out a markup bug in coderay/for_redcloth.
|
79
|
+
* 0xf30fc7 for the FileType patch concerning Delphi file extensions.
|
80
|
+
* The folks at redmine.org - thank you for using and fixing CodeRay!
|
81
|
+
* Keith Pitt for his SQL scanners
|
82
|
+
* Rob Aldred for the terminal encoder
|
83
|
+
* Trans for pointing out $DEBUG dependencies
|
84
|
+
* Flameeyes for finding that Term::ANSIColor was obsolete
|
85
|
+
* matz and all Ruby gods and gurus
|
86
|
+
* The inventors of: the computer, the internet, the true color display, HTML &
|
87
|
+
CSS, VIM, Ruby, pizza, microwaves, guitars, scouting, programming, anime,
|
88
|
+
manga, coke and green ice tea.
|
89
|
+
|
90
|
+
Where would we be without all those people?
|
91
|
+
|
92
|
+
=== Created using
|
93
|
+
|
94
|
+
* Ruby[http://ruby-lang.org/]
|
95
|
+
* Chihiro (my Sony VAIO laptop); Henrietta (my old MacBook);
|
96
|
+
Triella, born Rico (my new MacBook); as well as
|
97
|
+
Seras and Hikari (my PCs)
|
98
|
+
* RDE[http://homepage2.nifty.com/sakazuki/rde_e.html],
|
99
|
+
VIM[http://vim.org] and TextMate[http://macromates.com]
|
100
|
+
* Subversion[http://subversion.tigris.org/]
|
101
|
+
* Redmine[http://redmine.org/]
|
102
|
+
* Firefox[http://www.mozilla.org/products/firefox/],
|
103
|
+
Firebug[http://getfirebug.com/], Safari[http://www.apple.com/safari/], and
|
104
|
+
Thunderbird[http://www.mozilla.org/products/thunderbird/]
|
105
|
+
* RubyGems[http://docs.rubygems.org/] and Rake[http://rake.rubyforge.org/]
|
106
|
+
* TortoiseSVN[http://tortoisesvn.tigris.org/] using Apache via
|
107
|
+
XAMPP[http://www.apachefriends.org/en/xampp.html]
|
108
|
+
* RDoc (though I'm quite unsatisfied with it)
|
109
|
+
* Microsoft Windows (yes, I confess!) and MacOS X
|
110
|
+
* GNUWin32, MinGW and some other tools to make the shell under windows a bit
|
111
|
+
less useless
|
112
|
+
* Term::ANSIColor[http://term-ansicolor.rubyforge.org/]
|
113
|
+
* PLEAC[http://pleac.sourceforge.net/] code examples
|
114
|
+
* Github
|
115
|
+
* Travis CI (http://travis-ci.org/rubychan/github)
|
116
|
+
|
117
|
+
=== Free
|
118
|
+
|
119
|
+
* As you can see, CodeRay was created under heavy use of *free* software.
|
120
|
+
* So CodeRay is also *free*.
|
121
|
+
* If you use CodeRay to create software, think about making this software
|
122
|
+
*free*, too.
|
123
|
+
* Thanks :)
|
@@ -0,0 +1,215 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'coderay'
|
3
|
+
|
4
|
+
$options, args = ARGV.partition { |arg| arg[/^-[hv]$|--\w+/] }
|
5
|
+
subcommand = args.first if /^\w/ === args.first
|
6
|
+
subcommand = nil if subcommand && File.exist?(subcommand)
|
7
|
+
args.delete subcommand
|
8
|
+
|
9
|
+
def option? *options
|
10
|
+
!($options & options).empty?
|
11
|
+
end
|
12
|
+
|
13
|
+
def tty?
|
14
|
+
$stdout.tty? || option?('--tty')
|
15
|
+
end
|
16
|
+
|
17
|
+
def version
|
18
|
+
puts <<-USAGE
|
19
|
+
CodeRay #{CodeRay::VERSION}
|
20
|
+
USAGE
|
21
|
+
end
|
22
|
+
|
23
|
+
def help
|
24
|
+
puts <<-HELP
|
25
|
+
This is CodeRay #{CodeRay::VERSION}, a syntax highlighting tool for selected languages.
|
26
|
+
|
27
|
+
usage:
|
28
|
+
coderay [-language] [input] [-format] [output]
|
29
|
+
|
30
|
+
defaults:
|
31
|
+
language detect from input file name or shebang; fall back to plain text
|
32
|
+
input STDIN
|
33
|
+
format detect from output file name or use terminal; fall back to HTML
|
34
|
+
output STDOUT
|
35
|
+
|
36
|
+
common:
|
37
|
+
coderay file.rb # highlight file to terminal
|
38
|
+
coderay file.rb -page > file.html # highlight file to HTML page
|
39
|
+
coderay file.rb -div > file.html # highlight file to HTML snippet
|
40
|
+
|
41
|
+
configure output:
|
42
|
+
coderay file.py output.json # output tokens as JSON
|
43
|
+
coderay file.py -loc # count lines of code in Python file
|
44
|
+
|
45
|
+
configure input:
|
46
|
+
coderay -python file # specify the input language
|
47
|
+
coderay -ruby # take input from STDIN
|
48
|
+
|
49
|
+
more:
|
50
|
+
coderay stylesheet [style] # print CSS stylesheet
|
51
|
+
HELP
|
52
|
+
end
|
53
|
+
|
54
|
+
def commands
|
55
|
+
puts <<-COMMANDS
|
56
|
+
general:
|
57
|
+
highlight code highlighting (default command, optional)
|
58
|
+
stylesheet print the CSS stylesheet with the given name (aliases: style, css)
|
59
|
+
|
60
|
+
about:
|
61
|
+
list [of] list all available plugins (or just the scanners|encoders|styles|filetypes)
|
62
|
+
commands print this list
|
63
|
+
help show some help
|
64
|
+
version print CodeRay version
|
65
|
+
COMMANDS
|
66
|
+
end
|
67
|
+
|
68
|
+
def print_list_of plugin_host
|
69
|
+
plugins = plugin_host.all_plugins.map do |plugin|
|
70
|
+
info = " #{plugin.plugin_id}: #{plugin.title}"
|
71
|
+
|
72
|
+
aliases = (plugin.aliases - [:default]).map { |key| "-#{key}" }.sort_by { |key| key.size }
|
73
|
+
if plugin.respond_to?(:file_extension) || !aliases.empty?
|
74
|
+
additional_info = []
|
75
|
+
additional_info << aliases.join(', ') unless aliases.empty?
|
76
|
+
info << " (#{additional_info.join('; ')})"
|
77
|
+
end
|
78
|
+
|
79
|
+
info << ' <-- default' if plugin.aliases.include? :default
|
80
|
+
|
81
|
+
info
|
82
|
+
end
|
83
|
+
puts plugins.sort
|
84
|
+
end
|
85
|
+
|
86
|
+
if option? '-v', '--version'
|
87
|
+
version
|
88
|
+
end
|
89
|
+
|
90
|
+
if option? '-h', '--help'
|
91
|
+
help
|
92
|
+
end
|
93
|
+
|
94
|
+
case subcommand
|
95
|
+
when 'highlight', nil
|
96
|
+
if ARGV.empty?
|
97
|
+
version
|
98
|
+
help
|
99
|
+
else
|
100
|
+
signature = args.map { |arg| arg[/^-/] ? '-' : 'f' }.join
|
101
|
+
names = args.map { |arg| arg.sub(/^-/, '') }
|
102
|
+
case signature
|
103
|
+
when /^$/
|
104
|
+
exit
|
105
|
+
when /^ff?$/
|
106
|
+
input_file, output_file, = *names
|
107
|
+
when /^f-f?$/
|
108
|
+
input_file, output_format, output_file, = *names
|
109
|
+
when /^-ff?$/
|
110
|
+
input_lang, input_file, output_file, = *names
|
111
|
+
when /^-f-f?$/
|
112
|
+
input_lang, input_file, output_format, output_file, = *names
|
113
|
+
when /^--?f?$/
|
114
|
+
input_lang, output_format, output_file, = *names
|
115
|
+
else
|
116
|
+
$stdout = $stderr
|
117
|
+
help
|
118
|
+
puts
|
119
|
+
puts "Unknown parameter order: #{args.join ' '}, expected: [-language] [input] [-format] [output]"
|
120
|
+
exit 1
|
121
|
+
end
|
122
|
+
|
123
|
+
if input_file
|
124
|
+
input_lang ||= CodeRay::FileType.fetch input_file, :text, true
|
125
|
+
end
|
126
|
+
|
127
|
+
if output_file
|
128
|
+
output_format ||= CodeRay::FileType[output_file] || :plain
|
129
|
+
else
|
130
|
+
output_format ||= :terminal
|
131
|
+
end
|
132
|
+
|
133
|
+
output_format = :page if output_format.to_s == 'html'
|
134
|
+
|
135
|
+
if input_file
|
136
|
+
input = File.read input_file
|
137
|
+
else
|
138
|
+
input = $stdin.read
|
139
|
+
end
|
140
|
+
|
141
|
+
begin
|
142
|
+
file =
|
143
|
+
if output_file
|
144
|
+
File.open output_file, 'w'
|
145
|
+
else
|
146
|
+
$stdout
|
147
|
+
end
|
148
|
+
CodeRay.encode(input, input_lang, output_format, :out => file)
|
149
|
+
file.puts
|
150
|
+
rescue CodeRay::PluginHost::PluginNotFound => boom
|
151
|
+
$stdout = $stderr
|
152
|
+
if boom.message[/CodeRay::(\w+)s could not load plugin :?(.*?): /]
|
153
|
+
puts "I don't know the #$1 \"#$2\"."
|
154
|
+
else
|
155
|
+
puts boom.message
|
156
|
+
end
|
157
|
+
# puts "I don't know this plugin: #{boom.message[/Could not load plugin (.*?): /, 1]}."
|
158
|
+
rescue CodeRay::Scanners::Scanner::ScanError
|
159
|
+
# this is sometimes raised by pagers; ignore
|
160
|
+
# FIXME: rescue Errno::EPIPE
|
161
|
+
ensure
|
162
|
+
file.close if output_file
|
163
|
+
end
|
164
|
+
end
|
165
|
+
when 'li', 'list'
|
166
|
+
arg = args.first && args.first.downcase
|
167
|
+
if [nil, 's', 'sc', 'scanner', 'scanners'].include? arg
|
168
|
+
puts 'input languages (Scanners):'
|
169
|
+
print_list_of CodeRay::Scanners
|
170
|
+
end
|
171
|
+
|
172
|
+
if [nil, 'e', 'en', 'enc', 'encoder', 'encoders'].include? arg
|
173
|
+
puts 'output formats (Encoders):'
|
174
|
+
print_list_of CodeRay::Encoders
|
175
|
+
end
|
176
|
+
|
177
|
+
if [nil, 'st', 'style', 'styles'].include? arg
|
178
|
+
puts 'CSS themes for HTML output (Styles):'
|
179
|
+
print_list_of CodeRay::Styles
|
180
|
+
end
|
181
|
+
|
182
|
+
if [nil, 'f', 'ft', 'file', 'filetype', 'filetypes'].include? arg
|
183
|
+
puts 'recognized file types:'
|
184
|
+
|
185
|
+
filetypes = Hash.new { |h, k| h[k] = [] }
|
186
|
+
CodeRay::FileType::TypeFromExt.inject filetypes do |types, (ext, type)|
|
187
|
+
types[type.to_s] << ".#{ext}"
|
188
|
+
types
|
189
|
+
end
|
190
|
+
CodeRay::FileType::TypeFromName.inject filetypes do |types, (name, type)|
|
191
|
+
types[type.to_s] << name
|
192
|
+
types
|
193
|
+
end
|
194
|
+
|
195
|
+
filetypes.sort.each do |type, exts|
|
196
|
+
puts " #{type}: #{exts.sort_by { |ext| ext.size }.join(', ')}"
|
197
|
+
end
|
198
|
+
end
|
199
|
+
when 'stylesheet', 'style', 'css'
|
200
|
+
puts CodeRay::Encoders[:html]::CSS.new(args.first || :default).stylesheet
|
201
|
+
when 'commands'
|
202
|
+
commands
|
203
|
+
when 'help'
|
204
|
+
help
|
205
|
+
else
|
206
|
+
$stdout = $stderr
|
207
|
+
help
|
208
|
+
puts
|
209
|
+
if subcommand[/\A\w+\z/]
|
210
|
+
puts "Unknown command: #{subcommand}"
|
211
|
+
else
|
212
|
+
puts "File not found: #{subcommand}"
|
213
|
+
end
|
214
|
+
exit 1
|
215
|
+
end
|