pry 0.9.10pre1-i386-mingw32 → 0.9.11-i386-mingw32
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.
- data/.travis.yml +3 -1
 - data/CHANGELOG +63 -2
 - data/CONTRIBUTORS +43 -25
 - data/Gemfile +7 -0
 - data/Guardfile +62 -0
 - data/README.markdown +4 -4
 - data/Rakefile +34 -35
 - data/lib/pry.rb +107 -54
 - data/lib/pry/cli.rb +34 -11
 - data/lib/pry/code.rb +165 -182
 - data/lib/pry/code/code_range.rb +70 -0
 - data/lib/pry/code/loc.rb +92 -0
 - data/lib/pry/code_object.rb +153 -0
 - data/lib/pry/command.rb +160 -22
 - data/lib/pry/command_set.rb +37 -26
 - data/lib/pry/commands.rb +4 -27
 - data/lib/pry/commands/amend_line.rb +99 -0
 - data/lib/pry/commands/bang.rb +20 -0
 - data/lib/pry/commands/bang_pry.rb +17 -0
 - data/lib/pry/commands/cat.rb +53 -0
 - data/lib/pry/commands/cat/abstract_formatter.rb +27 -0
 - data/lib/pry/commands/cat/exception_formatter.rb +78 -0
 - data/lib/pry/commands/cat/file_formatter.rb +84 -0
 - data/lib/pry/commands/cat/input_expression_formatter.rb +43 -0
 - data/lib/pry/commands/cd.rb +30 -0
 - data/lib/pry/commands/code_collector.rb +165 -0
 - data/lib/pry/commands/deprecated_commands.rb +2 -0
 - data/lib/pry/commands/disable_pry.rb +27 -0
 - data/lib/pry/commands/easter_eggs.rb +112 -0
 - data/lib/pry/commands/edit.rb +206 -0
 - data/lib/pry/commands/edit/exception_patcher.rb +25 -0
 - data/lib/pry/commands/edit/file_and_line_locator.rb +38 -0
 - data/lib/pry/commands/edit/method_patcher.rb +122 -0
 - data/lib/pry/commands/exit.rb +42 -0
 - data/lib/pry/commands/exit_all.rb +29 -0
 - data/lib/pry/commands/exit_program.rb +24 -0
 - data/lib/pry/commands/find_method.rb +199 -0
 - data/lib/pry/commands/fix_indent.rb +19 -0
 - data/lib/pry/commands/gem_cd.rb +26 -0
 - data/lib/pry/commands/gem_install.rb +29 -0
 - data/lib/pry/commands/gem_list.rb +33 -0
 - data/lib/pry/commands/gem_open.rb +29 -0
 - data/lib/pry/commands/gist.rb +95 -0
 - data/lib/pry/commands/help.rb +164 -0
 - data/lib/pry/commands/hist.rb +161 -0
 - data/lib/pry/commands/import_set.rb +22 -0
 - data/lib/pry/commands/install_command.rb +51 -0
 - data/lib/pry/commands/jump_to.rb +29 -0
 - data/lib/pry/commands/ls.rb +339 -0
 - data/lib/pry/commands/nesting.rb +25 -0
 - data/lib/pry/commands/play.rb +69 -0
 - data/lib/pry/commands/pry_backtrace.rb +26 -0
 - data/lib/pry/commands/pry_version.rb +17 -0
 - data/lib/pry/commands/raise_up.rb +32 -0
 - data/lib/pry/commands/reload_code.rb +39 -0
 - data/lib/pry/commands/reset.rb +18 -0
 - data/lib/pry/commands/ri.rb +56 -0
 - data/lib/pry/commands/save_file.rb +61 -0
 - data/lib/pry/commands/shell_command.rb +43 -0
 - data/lib/pry/commands/shell_mode.rb +27 -0
 - data/lib/pry/commands/show_doc.rb +78 -0
 - data/lib/pry/commands/show_info.rb +139 -0
 - data/lib/pry/commands/show_input.rb +17 -0
 - data/lib/pry/commands/show_source.rb +37 -0
 - data/lib/pry/commands/simple_prompt.rb +22 -0
 - data/lib/pry/commands/stat.rb +40 -0
 - data/lib/pry/commands/switch_to.rb +23 -0
 - data/lib/pry/commands/toggle_color.rb +20 -0
 - data/lib/pry/commands/whereami.rb +114 -0
 - data/lib/pry/commands/wtf.rb +57 -0
 - data/lib/pry/completion.rb +120 -46
 - data/lib/pry/config.rb +11 -0
 - data/lib/pry/core_extensions.rb +30 -19
 - data/lib/pry/editor.rb +129 -0
 - data/lib/pry/helpers.rb +1 -0
 - data/lib/pry/helpers/base_helpers.rb +89 -119
 - data/lib/pry/helpers/command_helpers.rb +7 -122
 - data/lib/pry/helpers/table.rb +100 -0
 - data/lib/pry/helpers/text.rb +4 -4
 - data/lib/pry/history_array.rb +5 -0
 - data/lib/pry/hooks.rb +1 -3
 - data/lib/pry/indent.rb +104 -30
 - data/lib/pry/method.rb +66 -22
 - data/lib/pry/module_candidate.rb +26 -15
 - data/lib/pry/pager.rb +70 -0
 - data/lib/pry/plugins.rb +1 -2
 - data/lib/pry/pry_class.rb +63 -22
 - data/lib/pry/pry_instance.rb +58 -37
 - data/lib/pry/rubygem.rb +74 -0
 - data/lib/pry/terminal_info.rb +43 -0
 - data/lib/pry/test/helper.rb +185 -0
 - data/lib/pry/version.rb +1 -1
 - data/lib/pry/wrapped_module.rb +58 -24
 - data/pry.gemspec +21 -37
 - data/{test/test_cli.rb → spec/cli_spec.rb} +0 -0
 - data/spec/code_object_spec.rb +277 -0
 - data/{test/test_code.rb → spec/code_spec.rb} +19 -1
 - data/{test/test_command_helpers.rb → spec/command_helpers_spec.rb} +0 -0
 - data/{test/test_command_integration.rb → spec/command_integration_spec.rb} +38 -46
 - data/{test/test_command_set.rb → spec/command_set_spec.rb} +18 -1
 - data/{test/test_command.rb → spec/command_spec.rb} +250 -149
 - data/spec/commands/amend_line_spec.rb +247 -0
 - data/spec/commands/bang_spec.rb +19 -0
 - data/spec/commands/cat_spec.rb +164 -0
 - data/spec/commands/cd_spec.rb +250 -0
 - data/spec/commands/disable_pry_spec.rb +25 -0
 - data/spec/commands/edit_spec.rb +727 -0
 - data/spec/commands/exit_all_spec.rb +34 -0
 - data/spec/commands/exit_program_spec.rb +19 -0
 - data/spec/commands/exit_spec.rb +34 -0
 - data/{test/test_default_commands/test_find_method.rb → spec/commands/find_method_spec.rb} +27 -7
 - data/spec/commands/gem_list_spec.rb +26 -0
 - data/spec/commands/gist_spec.rb +75 -0
 - data/{test/test_default_commands/test_help.rb → spec/commands/help_spec.rb} +8 -9
 - data/spec/commands/hist_spec.rb +181 -0
 - data/spec/commands/jump_to_spec.rb +15 -0
 - data/spec/commands/ls_spec.rb +177 -0
 - data/spec/commands/play_spec.rb +140 -0
 - data/spec/commands/raise_up_spec.rb +56 -0
 - data/spec/commands/save_file_spec.rb +177 -0
 - data/spec/commands/show_doc_spec.rb +378 -0
 - data/spec/commands/show_input_spec.rb +17 -0
 - data/spec/commands/show_source_spec.rb +597 -0
 - data/spec/commands/whereami_spec.rb +154 -0
 - data/spec/completion_spec.rb +233 -0
 - data/spec/control_d_handler_spec.rb +58 -0
 - data/spec/editor_spec.rb +79 -0
 - data/{test/test_exception_whitelist.rb → spec/exception_whitelist_spec.rb} +0 -0
 - data/{test → spec/fixtures}/candidate_helper1.rb +0 -0
 - data/{test → spec/fixtures}/candidate_helper2.rb +0 -0
 - data/{test/test_default_commands → spec/fixtures}/example.erb +0 -0
 - data/spec/fixtures/example_nesting.rb +33 -0
 - data/spec/fixtures/show_source_doc_examples.rb +15 -0
 - data/{test → spec/fixtures}/testrc +0 -0
 - data/{test → spec/fixtures}/testrcbad +0 -0
 - data/spec/helper.rb +34 -0
 - data/spec/helpers/bacon.rb +86 -0
 - data/spec/helpers/mock_pry.rb +43 -0
 - data/spec/helpers/table_spec.rb +83 -0
 - data/{test/test_history_array.rb → spec/history_array_spec.rb} +21 -19
 - data/{test/test_hooks.rb → spec/hooks_spec.rb} +0 -0
 - data/{test/test_indent.rb → spec/indent_spec.rb} +24 -0
 - data/{test/test_input_stack.rb → spec/input_stack_spec.rb} +4 -0
 - data/{test/test_method.rb → spec/method_spec.rb} +65 -1
 - data/{test/test_prompt.rb → spec/prompt_spec.rb} +0 -0
 - data/{test/test_pry_defaults.rb → spec/pry_defaults_spec.rb} +14 -14
 - data/{test/test_pry_history.rb → spec/pry_history_spec.rb} +15 -0
 - data/spec/pry_output_spec.rb +95 -0
 - data/{test/test_pry.rb → spec/pry_spec.rb} +74 -32
 - data/{test/test_sticky_locals.rb → spec/sticky_locals_spec.rb} +27 -25
 - data/{test/test_syntax_checking.rb → spec/syntax_checking_spec.rb} +17 -1
 - data/{test/test_wrapped_module.rb → spec/wrapped_module_spec.rb} +92 -5
 - metadata +239 -115
 - data/examples/example_basic.rb +0 -15
 - data/examples/example_command_override.rb +0 -32
 - data/examples/example_commands.rb +0 -36
 - data/examples/example_hooks.rb +0 -9
 - data/examples/example_image_edit.rb +0 -67
 - data/examples/example_input.rb +0 -7
 - data/examples/example_input2.rb +0 -29
 - data/examples/example_output.rb +0 -11
 - data/examples/example_print.rb +0 -6
 - data/examples/example_prompt.rb +0 -9
 - data/examples/helper.rb +0 -6
 - data/lib/pry/default_commands/cd.rb +0 -81
 - data/lib/pry/default_commands/commands.rb +0 -62
 - data/lib/pry/default_commands/context.rb +0 -98
 - data/lib/pry/default_commands/easter_eggs.rb +0 -95
 - data/lib/pry/default_commands/editing.rb +0 -420
 - data/lib/pry/default_commands/find_method.rb +0 -169
 - data/lib/pry/default_commands/gems.rb +0 -84
 - data/lib/pry/default_commands/gist.rb +0 -187
 - data/lib/pry/default_commands/help.rb +0 -127
 - data/lib/pry/default_commands/hist.rb +0 -120
 - data/lib/pry/default_commands/input_and_output.rb +0 -306
 - data/lib/pry/default_commands/introspection.rb +0 -410
 - data/lib/pry/default_commands/ls.rb +0 -272
 - data/lib/pry/default_commands/misc.rb +0 -38
 - data/lib/pry/default_commands/navigating_pry.rb +0 -110
 - data/lib/pry/default_commands/whereami.rb +0 -92
 - data/lib/pry/extended_commands/experimental.rb +0 -7
 - data/test/helper.rb +0 -223
 - data/test/test_completion.rb +0 -62
 - data/test/test_control_d_handler.rb +0 -45
 - data/test/test_default_commands/test_cd.rb +0 -321
 - data/test/test_default_commands/test_context.rb +0 -288
 - data/test/test_default_commands/test_documentation.rb +0 -315
 - data/test/test_default_commands/test_gems.rb +0 -18
 - data/test/test_default_commands/test_input.rb +0 -428
 - data/test/test_default_commands/test_introspection.rb +0 -511
 - data/test/test_default_commands/test_ls.rb +0 -151
 - data/test/test_default_commands/test_shell.rb +0 -343
 - data/test/test_default_commands/test_show_source.rb +0 -432
 - data/test/test_pry_output.rb +0 -41
 
| 
         @@ -0,0 +1,84 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::Cat
         
     | 
| 
      
 3 
     | 
    
         
            +
                class FileFormatter < AbstractFormatter
         
     | 
| 
      
 4 
     | 
    
         
            +
                  attr_accessor :file_with_embedded_line
         
     | 
| 
      
 5 
     | 
    
         
            +
                  attr_accessor :opts
         
     | 
| 
      
 6 
     | 
    
         
            +
                  attr_accessor :_pry_
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  def initialize(file_with_embedded_line, _pry_, opts)
         
     | 
| 
      
 9 
     | 
    
         
            +
                    @file_with_embedded_line = file_with_embedded_line
         
     | 
| 
      
 10 
     | 
    
         
            +
                    @opts = opts
         
     | 
| 
      
 11 
     | 
    
         
            +
                    @_pry_ = _pry_
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def format
         
     | 
| 
      
 15 
     | 
    
         
            +
                    raise CommandError, "Must provide a filename, --in, or --ex." if !file_with_embedded_line
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                    set_file_and_dir_locals(file_name, _pry_, _pry_.current_context)
         
     | 
| 
      
 18 
     | 
    
         
            +
                    decorate(Pry::Code.from_file(file_name))
         
     | 
| 
      
 19 
     | 
    
         
            +
                  end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  private
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def file_and_line
         
     | 
| 
      
 24 
     | 
    
         
            +
                    file_name, line_num = file_with_embedded_line.split(':')
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                    [File.expand_path(file_name), line_num ? line_num.to_i : nil]
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  def file_name
         
     | 
| 
      
 30 
     | 
    
         
            +
                    file_and_line.first
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  def line_number
         
     | 
| 
      
 34 
     | 
    
         
            +
                    file_and_line.last
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  def code_window_size
         
     | 
| 
      
 38 
     | 
    
         
            +
                    Pry.config.default_window_size || 7
         
     | 
| 
      
 39 
     | 
    
         
            +
                  end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                  def decorate(content)
         
     | 
| 
      
 42 
     | 
    
         
            +
                    line_number ? super.around(line_number, code_window_size) : super
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                  def code_type
         
     | 
| 
      
 46 
     | 
    
         
            +
                    opts[:type] || detect_code_type_from_file(file_name)
         
     | 
| 
      
 47 
     | 
    
         
            +
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  def detect_code_type_from_file(file_name)
         
     | 
| 
      
 50 
     | 
    
         
            +
                    name, ext = File.basename(file_name).split('.', 2)
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                    if ext
         
     | 
| 
      
 53 
     | 
    
         
            +
                      case ext
         
     | 
| 
      
 54 
     | 
    
         
            +
                      when "py"
         
     | 
| 
      
 55 
     | 
    
         
            +
                        :python
         
     | 
| 
      
 56 
     | 
    
         
            +
                      when "rb", "gemspec", "rakefile", "ru", "pryrc", "irbrc"
         
     | 
| 
      
 57 
     | 
    
         
            +
                        :ruby
         
     | 
| 
      
 58 
     | 
    
         
            +
                      when "js"
         
     | 
| 
      
 59 
     | 
    
         
            +
                        return :javascript
         
     | 
| 
      
 60 
     | 
    
         
            +
                      when "yml", "prytheme"
         
     | 
| 
      
 61 
     | 
    
         
            +
                        :yaml
         
     | 
| 
      
 62 
     | 
    
         
            +
                      when "groovy"
         
     | 
| 
      
 63 
     | 
    
         
            +
                        :groovy
         
     | 
| 
      
 64 
     | 
    
         
            +
                      when "c"
         
     | 
| 
      
 65 
     | 
    
         
            +
                        :c
         
     | 
| 
      
 66 
     | 
    
         
            +
                      when "cpp"
         
     | 
| 
      
 67 
     | 
    
         
            +
                        :cpp
         
     | 
| 
      
 68 
     | 
    
         
            +
                      when "java"
         
     | 
| 
      
 69 
     | 
    
         
            +
                        :java
         
     | 
| 
      
 70 
     | 
    
         
            +
                      else
         
     | 
| 
      
 71 
     | 
    
         
            +
                        :text
         
     | 
| 
      
 72 
     | 
    
         
            +
                      end
         
     | 
| 
      
 73 
     | 
    
         
            +
                    else
         
     | 
| 
      
 74 
     | 
    
         
            +
                      case name
         
     | 
| 
      
 75 
     | 
    
         
            +
                      when "Rakefile", "Gemfile"
         
     | 
| 
      
 76 
     | 
    
         
            +
                        :ruby
         
     | 
| 
      
 77 
     | 
    
         
            +
                      else
         
     | 
| 
      
 78 
     | 
    
         
            +
                        :text
         
     | 
| 
      
 79 
     | 
    
         
            +
                      end
         
     | 
| 
      
 80 
     | 
    
         
            +
                    end
         
     | 
| 
      
 81 
     | 
    
         
            +
                  end
         
     | 
| 
      
 82 
     | 
    
         
            +
                end
         
     | 
| 
      
 83 
     | 
    
         
            +
              end
         
     | 
| 
      
 84 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,43 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::Cat
         
     | 
| 
      
 3 
     | 
    
         
            +
                class InputExpressionFormatter < AbstractFormatter
         
     | 
| 
      
 4 
     | 
    
         
            +
                  attr_accessor :input_expressions
         
     | 
| 
      
 5 
     | 
    
         
            +
                  attr_accessor :opts
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  def initialize(input_expressions, opts)
         
     | 
| 
      
 8 
     | 
    
         
            +
                    @input_expressions = input_expressions
         
     | 
| 
      
 9 
     | 
    
         
            +
                    @opts = opts
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  def format
         
     | 
| 
      
 13 
     | 
    
         
            +
                    raise CommandError, "No input expressions!" if numbered_input_items.length < 1
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                    if numbered_input_items.length > 1
         
     | 
| 
      
 16 
     | 
    
         
            +
                      content = ""
         
     | 
| 
      
 17 
     | 
    
         
            +
                      numbered_input_items.each do |i, s|
         
     | 
| 
      
 18 
     | 
    
         
            +
                        content << "#{Helpers::Text.bold(i.to_s)}:\n" << decorate(Pry::Code(s).with_indentation(2)).to_s
         
     | 
| 
      
 19 
     | 
    
         
            +
                      end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                      content
         
     | 
| 
      
 22 
     | 
    
         
            +
                    else
         
     | 
| 
      
 23 
     | 
    
         
            +
                      decorate(Pry::Code(selected_input_items.first)).to_s
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  private
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  def selected_input_items
         
     | 
| 
      
 30 
     | 
    
         
            +
                    input_expressions[normalized_expression_range] || []
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  def numbered_input_items
         
     | 
| 
      
 34 
     | 
    
         
            +
                    @numbered_input_items ||= normalized_expression_range.zip(selected_input_items).
         
     | 
| 
      
 35 
     | 
    
         
            +
                      reject { |_, s| s.nil? || s == "" }
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  def normalized_expression_range
         
     | 
| 
      
 39 
     | 
    
         
            +
                    absolute_index_range(opts[:i], input_expressions.length)
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::Cd < Pry::ClassCommand
         
     | 
| 
      
 3 
     | 
    
         
            +
                match 'cd'
         
     | 
| 
      
 4 
     | 
    
         
            +
                group 'Context'
         
     | 
| 
      
 5 
     | 
    
         
            +
                description 'Move into a new context (object or scope).'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                banner <<-'BANNER'
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Usage: cd [OPTIONS] [--help]
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  Move into new context (object or scope). As in UNIX shells use `cd ..` to go
         
     | 
| 
      
 11 
     | 
    
         
            +
                  back, `cd /` to return to Pry top-level and `cd -` to toggle between last two
         
     | 
| 
      
 12 
     | 
    
         
            +
                  scopes. Complex syntax (e.g `cd ../@x/y`) also supported.
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  cd @x
         
     | 
| 
      
 15 
     | 
    
         
            +
                  cd ..
         
     | 
| 
      
 16 
     | 
    
         
            +
                  cd /
         
     | 
| 
      
 17 
     | 
    
         
            +
                  cd -
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  https://github.com/pry/pry/wiki/State-navigation#wiki-Changing_scope
         
     | 
| 
      
 20 
     | 
    
         
            +
                BANNER
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def process
         
     | 
| 
      
 23 
     | 
    
         
            +
                  state.old_stack ||= []
         
     | 
| 
      
 24 
     | 
    
         
            +
                  stack, state.old_stack = context_from_object_path(arg_string, _pry_, state.old_stack)
         
     | 
| 
      
 25 
     | 
    
         
            +
                  _pry_.binding_stack = stack if stack
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              Pry::Commands.add_command(Pry::Command::Cd)
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,165 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::CodeCollector
         
     | 
| 
      
 3 
     | 
    
         
            +
                include Helpers::CommandHelpers
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                attr_accessor :args
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_accessor :opts
         
     | 
| 
      
 7 
     | 
    
         
            +
                attr_accessor :_pry_
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                # The name of the explicitly given file (if any).
         
     | 
| 
      
 10 
     | 
    
         
            +
                attr_accessor :file
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                class << self
         
     | 
| 
      
 13 
     | 
    
         
            +
                  attr_accessor :input_expression_ranges
         
     | 
| 
      
 14 
     | 
    
         
            +
                  attr_accessor :output_result_ranges
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                @input_expression_ranges = []
         
     | 
| 
      
 18 
     | 
    
         
            +
                @output_result_ranges = []
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def initialize(args, opts, _pry_)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @args = args
         
     | 
| 
      
 22 
     | 
    
         
            +
                  @opts = opts
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @_pry_ = _pry_
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                # Add the `--lines`, `-o`, `-i`, `-s`, `-d` options.
         
     | 
| 
      
 27 
     | 
    
         
            +
                def self.inject_options(opt)
         
     | 
| 
      
 28 
     | 
    
         
            +
                  @input_expression_ranges = []
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @output_result_ranges = []
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                  opt.on :l, :lines, "Restrict to a subset of lines. Takes a line number or range",
         
     | 
| 
      
 32 
     | 
    
         
            +
                                     :optional_argument => true, :as => Range, :default => 1..-1
         
     | 
| 
      
 33 
     | 
    
         
            +
                  opt.on :o, :out,   "Select lines from Pry's output result history. Takes an index or range",
         
     | 
| 
      
 34 
     | 
    
         
            +
                  :optional_argument => true, :as => Range, :default => -5..-1 do |r|
         
     | 
| 
      
 35 
     | 
    
         
            +
                    output_result_ranges << (r || (-5..-1))
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
                  opt.on :i, :in,    "Select lines from Pry's input expression history. Takes an index or range",
         
     | 
| 
      
 38 
     | 
    
         
            +
                  :optional_argument => true, :as => Range, :default => -5..-1 do |r|
         
     | 
| 
      
 39 
     | 
    
         
            +
                    input_expression_ranges << (r || (-5..-1))
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                  opt.on :s, :super, "Select the 'super' method. Can be repeated to traverse the ancestors",
         
     | 
| 
      
 42 
     | 
    
         
            +
                                     :as => :count
         
     | 
| 
      
 43 
     | 
    
         
            +
                  opt.on :d, :doc,   "Select lines from the code object's documentation"
         
     | 
| 
      
 44 
     | 
    
         
            +
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                # The content (i.e code/docs) for the selected object.
         
     | 
| 
      
 47 
     | 
    
         
            +
                # If the user provided a bare code object, it returns the source.
         
     | 
| 
      
 48 
     | 
    
         
            +
                # If the user provided the `-i` or `-o` switches, it returns the
         
     | 
| 
      
 49 
     | 
    
         
            +
                # selected input/output lines joined as a string. If the user used
         
     | 
| 
      
 50 
     | 
    
         
            +
                # `-d CODE_OBJECT` it returns the docs for that code object.
         
     | 
| 
      
 51 
     | 
    
         
            +
                #
         
     | 
| 
      
 52 
     | 
    
         
            +
                # @return [String]
         
     | 
| 
      
 53 
     | 
    
         
            +
                def content
         
     | 
| 
      
 54 
     | 
    
         
            +
                  return @content if @content
         
     | 
| 
      
 55 
     | 
    
         
            +
                  raise CommandError, "Only one of --out, --in, --doc and CODE_OBJECT may be specified." if bad_option_combination?
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  content = case
         
     | 
| 
      
 58 
     | 
    
         
            +
                            when opts.present?(:o)
         
     | 
| 
      
 59 
     | 
    
         
            +
                              pry_output_content
         
     | 
| 
      
 60 
     | 
    
         
            +
                            when opts.present?(:i)
         
     | 
| 
      
 61 
     | 
    
         
            +
                              pry_input_content
         
     | 
| 
      
 62 
     | 
    
         
            +
                            when opts.present?(:d)
         
     | 
| 
      
 63 
     | 
    
         
            +
                              code_object_doc
         
     | 
| 
      
 64 
     | 
    
         
            +
                            else
         
     | 
| 
      
 65 
     | 
    
         
            +
                              code_object_source_or_file
         
     | 
| 
      
 66 
     | 
    
         
            +
                            end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  @content ||= restrict_to_lines(content, line_range)
         
     | 
| 
      
 69 
     | 
    
         
            +
                end
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                # The code object
         
     | 
| 
      
 72 
     | 
    
         
            +
                #
         
     | 
| 
      
 73 
     | 
    
         
            +
                # @return [Pry::WrappedModule, Pry::Method, Pry::Command]
         
     | 
| 
      
 74 
     | 
    
         
            +
                def code_object
         
     | 
| 
      
 75 
     | 
    
         
            +
                  Pry::CodeObject.lookup(obj_name, _pry_,  :super =>  opts[:super])
         
     | 
| 
      
 76 
     | 
    
         
            +
                end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                # Given a string and a range, return the `range` lines of that
         
     | 
| 
      
 79 
     | 
    
         
            +
                # string.
         
     | 
| 
      
 80 
     | 
    
         
            +
                #
         
     | 
| 
      
 81 
     | 
    
         
            +
                # @param [String] content
         
     | 
| 
      
 82 
     | 
    
         
            +
                # @param [Range, Fixnum] range
         
     | 
| 
      
 83 
     | 
    
         
            +
                # @return [String] The string restricted to the given range
         
     | 
| 
      
 84 
     | 
    
         
            +
                def restrict_to_lines(content, range)
         
     | 
| 
      
 85 
     | 
    
         
            +
                  Array(content.lines.to_a[range]).join
         
     | 
| 
      
 86 
     | 
    
         
            +
                end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                # The selected `_pry_.output_array` as a string, as specified by
         
     | 
| 
      
 89 
     | 
    
         
            +
                # the `-o` switch.
         
     | 
| 
      
 90 
     | 
    
         
            +
                #
         
     | 
| 
      
 91 
     | 
    
         
            +
                # @return [String]
         
     | 
| 
      
 92 
     | 
    
         
            +
                def pry_output_content
         
     | 
| 
      
 93 
     | 
    
         
            +
                  pry_array_content_as_string(_pry_.output_array, self.class.output_result_ranges) do |v|
         
     | 
| 
      
 94 
     | 
    
         
            +
                    Pry.config.gist.inspecter.call(v)
         
     | 
| 
      
 95 
     | 
    
         
            +
                  end
         
     | 
| 
      
 96 
     | 
    
         
            +
                end
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
                # The selected `_pry_.input_array` as a string, as specified by
         
     | 
| 
      
 99 
     | 
    
         
            +
                # the `-i` switch.
         
     | 
| 
      
 100 
     | 
    
         
            +
                #
         
     | 
| 
      
 101 
     | 
    
         
            +
                # @return [String]
         
     | 
| 
      
 102 
     | 
    
         
            +
                def pry_input_content
         
     | 
| 
      
 103 
     | 
    
         
            +
                  pry_array_content_as_string(_pry_.input_array, self.class.input_expression_ranges) { |v| v }
         
     | 
| 
      
 104 
     | 
    
         
            +
                end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
                # The line range passed to `--lines`, converted to a 0-indexed range.
         
     | 
| 
      
 107 
     | 
    
         
            +
                def line_range
         
     | 
| 
      
 108 
     | 
    
         
            +
                  opts.present?(:lines) ? one_index_range_or_number(opts[:lines]) : 0..-1
         
     | 
| 
      
 109 
     | 
    
         
            +
                end
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                # Name of the object argument
         
     | 
| 
      
 112 
     | 
    
         
            +
                def obj_name
         
     | 
| 
      
 113 
     | 
    
         
            +
                  @obj_name ||= args.empty? ? no_arg : args.join(" ")
         
     | 
| 
      
 114 
     | 
    
         
            +
                end
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
                private
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                def bad_option_combination?
         
     | 
| 
      
 119 
     | 
    
         
            +
                  [opts.present?(:in), opts.present?(:out),
         
     | 
| 
      
 120 
     | 
    
         
            +
                   !args.empty?].count(true) > 1
         
     | 
| 
      
 121 
     | 
    
         
            +
                end
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
                def pry_array_content_as_string(array, ranges, &block)
         
     | 
| 
      
 124 
     | 
    
         
            +
                  all = ''
         
     | 
| 
      
 125 
     | 
    
         
            +
                  ranges.each do |range|
         
     | 
| 
      
 126 
     | 
    
         
            +
                    raise CommandError, "Minimum value for range is 1, not 0." if convert_to_range(range).first == 0
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                    ranged_array = Array(array[range]) || []
         
     | 
| 
      
 129 
     | 
    
         
            +
                    ranged_array.compact.each { |v| all << block.call(v) }
         
     | 
| 
      
 130 
     | 
    
         
            +
                  end
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                  all
         
     | 
| 
      
 133 
     | 
    
         
            +
                end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                def code_object_doc
         
     | 
| 
      
 136 
     | 
    
         
            +
                  (code_object && code_object.doc) or could_not_locate(obj_name)
         
     | 
| 
      
 137 
     | 
    
         
            +
                end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                def code_object_source_or_file
         
     | 
| 
      
 140 
     | 
    
         
            +
                  (code_object && code_object.source) || file_content
         
     | 
| 
      
 141 
     | 
    
         
            +
                end
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
                def file_content
         
     | 
| 
      
 144 
     | 
    
         
            +
                  if File.exists?(obj_name)
         
     | 
| 
      
 145 
     | 
    
         
            +
                    # Set the file accessor.
         
     | 
| 
      
 146 
     | 
    
         
            +
                    self.file = obj_name
         
     | 
| 
      
 147 
     | 
    
         
            +
                    File.read(obj_name)
         
     | 
| 
      
 148 
     | 
    
         
            +
                  else
         
     | 
| 
      
 149 
     | 
    
         
            +
                    could_not_locate(obj_name)
         
     | 
| 
      
 150 
     | 
    
         
            +
                  end
         
     | 
| 
      
 151 
     | 
    
         
            +
                end
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
                def could_not_locate(name)
         
     | 
| 
      
 154 
     | 
    
         
            +
                  raise CommandError, "Cannot locate: #{name}!"
         
     | 
| 
      
 155 
     | 
    
         
            +
                end
         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                def convert_to_range(n)
         
     | 
| 
      
 158 
     | 
    
         
            +
                  if !n.is_a?(Range)
         
     | 
| 
      
 159 
     | 
    
         
            +
                    (n..n)
         
     | 
| 
      
 160 
     | 
    
         
            +
                  else
         
     | 
| 
      
 161 
     | 
    
         
            +
                    n
         
     | 
| 
      
 162 
     | 
    
         
            +
                  end
         
     | 
| 
      
 163 
     | 
    
         
            +
                end
         
     | 
| 
      
 164 
     | 
    
         
            +
              end
         
     | 
| 
      
 165 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Command::DisablePry < Pry::ClassCommand
         
     | 
| 
      
 3 
     | 
    
         
            +
                match 'disable-pry'
         
     | 
| 
      
 4 
     | 
    
         
            +
                group 'Navigating Pry'
         
     | 
| 
      
 5 
     | 
    
         
            +
                description 'Stops all future calls to pry and exits the current session.'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                banner <<-'BANNER'
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Usage: disable-pry
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  After this command is run any further calls to pry will immediately return `nil`
         
     | 
| 
      
 11 
     | 
    
         
            +
                  without interrupting the flow of your program. This is particularly useful when
         
     | 
| 
      
 12 
     | 
    
         
            +
                  you've debugged the problem you were having, and now wish the program to run to
         
     | 
| 
      
 13 
     | 
    
         
            +
                  the end.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  As alternatives, consider using `exit!` to force the current Ruby process
         
     | 
| 
      
 16 
     | 
    
         
            +
                  to quit immediately; or using `edit-method -p` to remove the `binding.pry`
         
     | 
| 
      
 17 
     | 
    
         
            +
                  from the code.
         
     | 
| 
      
 18 
     | 
    
         
            +
                BANNER
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                def process
         
     | 
| 
      
 21 
     | 
    
         
            +
                  ENV['DISABLE_PRY'] = 'true'
         
     | 
| 
      
 22 
     | 
    
         
            +
                  _pry_.run_command "exit"
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              Pry::Commands.add_command(Pry::Command::DisablePry)
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,112 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            class Pry
         
     | 
| 
      
 2 
     | 
    
         
            +
              Pry::Commands.instance_eval do
         
     | 
| 
      
 3 
     | 
    
         
            +
                command "nyan-cat", "", :requires_gem => ["nyancat"] do
         
     | 
| 
      
 4 
     | 
    
         
            +
                  run ".nyancat"
         
     | 
| 
      
 5 
     | 
    
         
            +
                end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                command(/!s\/(.*?)\/(.*?)/, "") do |source, dest|
         
     | 
| 
      
 8 
     | 
    
         
            +
                  eval_string.gsub!(/#{source}/) { dest }
         
     | 
| 
      
 9 
     | 
    
         
            +
                  run "show-input"
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                command "get-naked", "" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                  text = %{
         
     | 
| 
      
 14 
     | 
    
         
            +
              --
         
     | 
| 
      
 15 
     | 
    
         
            +
              We dont have to take our clothes off to have a good time.
         
     | 
| 
      
 16 
     | 
    
         
            +
              We could dance & party all night And drink some cherry wine.
         
     | 
| 
      
 17 
     | 
    
         
            +
              -- Jermaine Stewart }
         
     | 
| 
      
 18 
     | 
    
         
            +
                  output.puts text
         
     | 
| 
      
 19 
     | 
    
         
            +
                  text
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                command "east-coker", "" do
         
     | 
| 
      
 23 
     | 
    
         
            +
                  text = %{
         
     | 
| 
      
 24 
     | 
    
         
            +
              --
         
     | 
| 
      
 25 
     | 
    
         
            +
              Now the light falls
         
     | 
| 
      
 26 
     | 
    
         
            +
              Across the open field, leaving the deep lane
         
     | 
| 
      
 27 
     | 
    
         
            +
              Shuttered with branches, dark in the afternoon,
         
     | 
| 
      
 28 
     | 
    
         
            +
              Where you lean against a bank while a van passes,
         
     | 
| 
      
 29 
     | 
    
         
            +
              And the deep lane insists on the direction
         
     | 
| 
      
 30 
     | 
    
         
            +
              Into the village, in the electric heat
         
     | 
| 
      
 31 
     | 
    
         
            +
              Hypnotised. In a warm haze the sultry light
         
     | 
| 
      
 32 
     | 
    
         
            +
              Is absorbed, not refracted, by grey stone.
         
     | 
| 
      
 33 
     | 
    
         
            +
              The dahlias sleep in the empty silence.
         
     | 
| 
      
 34 
     | 
    
         
            +
              Wait for the early owl.
         
     | 
| 
      
 35 
     | 
    
         
            +
                            -- T.S Eliot
         
     | 
| 
      
 36 
     | 
    
         
            +
                      }
         
     | 
| 
      
 37 
     | 
    
         
            +
                  output.puts text
         
     | 
| 
      
 38 
     | 
    
         
            +
                  text
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                command "cohen-poem", "" do
         
     | 
| 
      
 42 
     | 
    
         
            +
                  text = %{
         
     | 
| 
      
 43 
     | 
    
         
            +
              --
         
     | 
| 
      
 44 
     | 
    
         
            +
              When this American woman,
         
     | 
| 
      
 45 
     | 
    
         
            +
              whose thighs are bound in casual red cloth,
         
     | 
| 
      
 46 
     | 
    
         
            +
              comes thundering past my sitting place
         
     | 
| 
      
 47 
     | 
    
         
            +
              like a forest-burning Mongol tribe,
         
     | 
| 
      
 48 
     | 
    
         
            +
              the city is ravished
         
     | 
| 
      
 49 
     | 
    
         
            +
              and brittle buildings of a hundred years
         
     | 
| 
      
 50 
     | 
    
         
            +
              splash into the street;
         
     | 
| 
      
 51 
     | 
    
         
            +
              and my eyes are burnt
         
     | 
| 
      
 52 
     | 
    
         
            +
              for the embroidered Chinese girls,
         
     | 
| 
      
 53 
     | 
    
         
            +
              already old,
         
     | 
| 
      
 54 
     | 
    
         
            +
              and so small between the thin pines
         
     | 
| 
      
 55 
     | 
    
         
            +
              on these enormous landscapes,
         
     | 
| 
      
 56 
     | 
    
         
            +
              that if you turn your head
         
     | 
| 
      
 57 
     | 
    
         
            +
              they are lost for hours.
         
     | 
| 
      
 58 
     | 
    
         
            +
                            -- Leonard Cohen
         
     | 
| 
      
 59 
     | 
    
         
            +
                          }
         
     | 
| 
      
 60 
     | 
    
         
            +
                  output.puts text
         
     | 
| 
      
 61 
     | 
    
         
            +
                  text
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                command "pessoa-poem", "" do
         
     | 
| 
      
 65 
     | 
    
         
            +
                  output.puts <<-TEXT
         
     | 
| 
      
 66 
     | 
    
         
            +
              --
         
     | 
| 
      
 67 
     | 
    
         
            +
              I've gone to bed with every feeling,
         
     | 
| 
      
 68 
     | 
    
         
            +
              I've been the pimp of every emotion,
         
     | 
| 
      
 69 
     | 
    
         
            +
              All felt sensations have bought me drinks,
         
     | 
| 
      
 70 
     | 
    
         
            +
              I've traded glances with every motive for every act,
         
     | 
| 
      
 71 
     | 
    
         
            +
              I've held hands with every urge to depart,
         
     | 
| 
      
 72 
     | 
    
         
            +
              ..
         
     | 
| 
      
 73 
     | 
    
         
            +
              Rage, foam, the vastness that doesn't fit in my handkerchief,
         
     | 
| 
      
 74 
     | 
    
         
            +
              The dog in heat howling in the night,
         
     | 
| 
      
 75 
     | 
    
         
            +
              The pond from the farm going in circles around my insomnia,
         
     | 
| 
      
 76 
     | 
    
         
            +
              The woods as they were, on our late-afternoon walks, the rose,
         
     | 
| 
      
 77 
     | 
    
         
            +
              The indifferent tuft of hair, the moss, the pines,
         
     | 
| 
      
 78 
     | 
    
         
            +
              The rage of not containing all this, not retaining all this,
         
     | 
| 
      
 79 
     | 
    
         
            +
              O abstract hunger for things, impotent libido for moments,
         
     | 
| 
      
 80 
     | 
    
         
            +
              Intellectual orgy of feeling life!
         
     | 
| 
      
 81 
     | 
    
         
            +
                            -- Fernando Pessoa
         
     | 
| 
      
 82 
     | 
    
         
            +
            TEXT
         
     | 
| 
      
 83 
     | 
    
         
            +
                end
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                command "test-ansi", "" do
         
     | 
| 
      
 86 
     | 
    
         
            +
                  prev_color = Pry.color
         
     | 
| 
      
 87 
     | 
    
         
            +
                  Pry.color = true
         
     | 
| 
      
 88 
     | 
    
         
            +
             
     | 
| 
      
 89 
     | 
    
         
            +
                  picture = unindent <<-'EOS'.gsub(/[[:alpha:]!]/) { |s| text.red(s) }
         
     | 
| 
      
 90 
     | 
    
         
            +
                     ____      _______________________
         
     | 
| 
      
 91 
     | 
    
         
            +
                    /    \    |  A         W     G    |
         
     | 
| 
      
 92 
     | 
    
         
            +
                   / O  O \   |   N    I    O   N !   |
         
     | 
| 
      
 93 
     | 
    
         
            +
                  |        |  |    S    S    R I   !  |
         
     | 
| 
      
 94 
     | 
    
         
            +
                   \ \__/ / __|     I         K     ! |
         
     | 
| 
      
 95 
     | 
    
         
            +
                    \____/   \________________________|
         
     | 
| 
      
 96 
     | 
    
         
            +
                  EOS
         
     | 
| 
      
 97 
     | 
    
         
            +
             
     | 
| 
      
 98 
     | 
    
         
            +
                  if windows_ansi?
         
     | 
| 
      
 99 
     | 
    
         
            +
                    move_up = proc { |n| "\e[#{n}F" }
         
     | 
| 
      
 100 
     | 
    
         
            +
                  else
         
     | 
| 
      
 101 
     | 
    
         
            +
                    move_up = proc { |n| "\e[#{n}A\e[0G" }
         
     | 
| 
      
 102 
     | 
    
         
            +
                  end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
                  output.puts "\n" * 6
         
     | 
| 
      
 105 
     | 
    
         
            +
                  output.puts picture.lines.map(&:chomp).reverse.join(move_up[1])
         
     | 
| 
      
 106 
     | 
    
         
            +
                  output.puts "\n" * 6
         
     | 
| 
      
 107 
     | 
    
         
            +
                  output.puts "** ENV['TERM'] is #{ENV['TERM']} **\n\n"
         
     | 
| 
      
 108 
     | 
    
         
            +
             
     | 
| 
      
 109 
     | 
    
         
            +
                  Pry.color = prev_color
         
     | 
| 
      
 110 
     | 
    
         
            +
                end
         
     | 
| 
      
 111 
     | 
    
         
            +
              end
         
     | 
| 
      
 112 
     | 
    
         
            +
            end
         
     |