ripl-color_result 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemspec +1 -1
- data/CHANGELOG.rdoc +4 -0
- data/lib/ripl/color_result.rb +13 -72
- metadata +3 -3
    
        data/.gemspec
    CHANGED
    
    | @@ -12,7 +12,7 @@ Gem::Specification.new do |s| | |
| 12 12 | 
             
              s.description =  "This ripl plugin colorizes ripl results."
         | 
| 13 13 | 
             
              s.required_rubygems_version = ">= 1.3.6"
         | 
| 14 14 | 
             
              s.add_dependency 'ripl', '>= 0.4.1'
         | 
| 15 | 
            -
              s.add_dependency 'wirb', '>= 0. | 
| 15 | 
            +
              s.add_dependency 'wirb', '>= 0.4.0'
         | 
| 16 16 | 
             
              s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
         | 
| 17 17 | 
             
              s.extra_rdoc_files = ["README.rdoc", "COPYING"]
         | 
| 18 18 | 
             
              s.license = 'MIT'
         | 
    
        data/CHANGELOG.rdoc
    CHANGED
    
    
    
        data/lib/ripl/color_result.rb
    CHANGED
    
    | @@ -2,21 +2,28 @@ require 'ripl' | |
| 2 2 |  | 
| 3 3 | 
             
            module Ripl
         | 
| 4 4 | 
             
              module ColorResult
         | 
| 5 | 
            -
                VERSION = '0. | 
| 5 | 
            +
                VERSION = '0.4.0'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def before_loop
         | 
| 8 | 
            +
                  if Ripl.config[:color_result_engine] == :default
         | 
| 9 | 
            +
                    require 'wirb' unless defined?(Wirb)
         | 
| 10 | 
            +
                    Ripl.config[:color_result_default_schema].merge! Wirb.schema
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
                end
         | 
| 6 13 |  | 
| 7 14 | 
             
                def format_result(result)
         | 
| 8 15 | 
             
                  return super if !config[:color_result_engine]
         | 
| 9 16 |  | 
| 10 17 | 
             
                  @result_prompt + case config[:color_result_engine].to_sym
         | 
| 11 18 | 
             
                  when :coderay
         | 
| 12 | 
            -
                    require 'coderay'
         | 
| 19 | 
            +
                    require 'coderay' unless defined?(CodeRay)
         | 
| 13 20 | 
             
                    CodeRay.scan( result.inspect, :ruby ).term
         | 
| 14 21 | 
             
                  when :ap, :awesome_print
         | 
| 15 | 
            -
                    require 'ap'
         | 
| 22 | 
            +
                    require 'ap' unless defined?(AwesomePrint)
         | 
| 16 23 | 
             
                    result.awesome_inspect( config[:color_result_ap_options] || {} )
         | 
| 17 24 | 
             
                  else # :default
         | 
| 18 | 
            -
                    require 'wirb'
         | 
| 19 | 
            -
                    Wirb.start
         | 
| 25 | 
            +
                    require 'wirb' unless defined?(Wirb)
         | 
| 26 | 
            +
                    Wirb.start unless Wirb.running?
         | 
| 20 27 | 
             
                    Wirb.colorize_result result.inspect, Ripl.config[:color_result_default_schema]
         | 
| 21 28 | 
             
                  end
         | 
| 22 29 | 
             
                end
         | 
| @@ -26,70 +33,4 @@ end | |
| 26 33 | 
             
            Ripl::Shell.include Ripl::ColorResult
         | 
| 27 34 |  | 
| 28 35 | 
             
            Ripl.config[:color_result_engine] ||= :default
         | 
| 29 | 
            -
            Ripl.config[:color_result_default_schema]  | 
| 30 | 
            -
                # container
         | 
| 31 | 
            -
                :open_hash        => :light_green,
         | 
| 32 | 
            -
                :close_hash       => :light_green,
         | 
| 33 | 
            -
                :open_array       => :light_green,
         | 
| 34 | 
            -
                :close_array      => :light_green,
         | 
| 35 | 
            -
             | 
| 36 | 
            -
                :open_set         => :green,
         | 
| 37 | 
            -
                :close_set        => :green,
         | 
| 38 | 
            -
             | 
| 39 | 
            -
                # delimiter colors
         | 
| 40 | 
            -
                :comma            => :green,
         | 
| 41 | 
            -
                :refers           => :green,
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                # class
         | 
| 44 | 
            -
                :class            => :light_green,
         | 
| 45 | 
            -
                :class_separator  => :green,
         | 
| 46 | 
            -
                :object_class     => :light_green,
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                # object
         | 
| 49 | 
            -
                :open_object               => :green,
         | 
| 50 | 
            -
                :object_description_prefix => :green,
         | 
| 51 | 
            -
                :object_description        => :brown,
         | 
| 52 | 
            -
                :object_address_prefi      => :brown_underline,
         | 
| 53 | 
            -
                :object_address            => :brown_underline,
         | 
| 54 | 
            -
                :object_line_prefix        => :brown_underline,
         | 
| 55 | 
            -
                :object_line               => :brown_underline,
         | 
| 56 | 
            -
                :object_line_number        => :brown_underline,
         | 
| 57 | 
            -
                :object_variable_prefix    => :light_purple,
         | 
| 58 | 
            -
                :object_variable           => :light_purple,
         | 
| 59 | 
            -
                :close_object              => :green,
         | 
| 60 | 
            -
             | 
| 61 | 
            -
                # symbol
         | 
| 62 | 
            -
                :symbol_prefix       => :yellow,
         | 
| 63 | 
            -
                :symbol              => :yellow,
         | 
| 64 | 
            -
                :open_symbol_string  => :brown,
         | 
| 65 | 
            -
                :symbol_string       => :yellow,
         | 
| 66 | 
            -
                :close_symbol_string => :brown,
         | 
| 67 | 
            -
             | 
| 68 | 
            -
                # string
         | 
| 69 | 
            -
                :open_string  => :light_gray,
         | 
| 70 | 
            -
                :string       => :dark_gray,
         | 
| 71 | 
            -
                :close_string => :light_gray,
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                # regexp
         | 
| 74 | 
            -
                :open_regexp  => :light_blue,
         | 
| 75 | 
            -
                :regexp       => :dark_gray,
         | 
| 76 | 
            -
                :close_regexp => :light_blue,
         | 
| 77 | 
            -
                :regexp_flags => :light_red,
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                # number
         | 
| 80 | 
            -
                :number => :cyan,
         | 
| 81 | 
            -
                :range  => :red,
         | 
| 82 | 
            -
                :open_rational      => :light_cyan,
         | 
| 83 | 
            -
                :rational_separator => :light_cyan,
         | 
| 84 | 
            -
                :close_rational     => :light_cyan,
         | 
| 85 | 
            -
             | 
| 86 | 
            -
                # misc
         | 
| 87 | 
            -
                :default => nil,
         | 
| 88 | 
            -
                :keyword => nil, # some lowercased word, merge with default?
         | 
| 89 | 
            -
                :time    => :purple,
         | 
| 90 | 
            -
                :nil     => :light_red,
         | 
| 91 | 
            -
                :false   => :red,
         | 
| 92 | 
            -
                :true    => :green,
         | 
| 93 | 
            -
            }
         | 
| 94 | 
            -
             | 
| 95 | 
            -
            # J-_-L
         | 
| 36 | 
            +
            Ripl.config[:color_result_default_schema] = Hash.new{ |h,k| h[k] = {} }
         | 
    
        metadata
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            name: ripl-color_result
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 4 | 
             
              prerelease: 
         | 
| 5 | 
            -
              version: 0. | 
| 5 | 
            +
              version: 0.4.0
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors: 
         | 
| 8 8 | 
             
            - Jan Lelis
         | 
| @@ -10,7 +10,7 @@ autorequire: | |
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 12 |  | 
| 13 | 
            -
            date: 2011- | 
| 13 | 
            +
            date: 2011-07-09 00:00:00 Z
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 16 16 | 
             
              name: ripl
         | 
| @@ -31,7 +31,7 @@ dependencies: | |
| 31 31 | 
             
                requirements: 
         | 
| 32 32 | 
             
                - - ">="
         | 
| 33 33 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 34 | 
            -
                    version: 0. | 
| 34 | 
            +
                    version: 0.4.0
         | 
| 35 35 | 
             
              type: :runtime
         | 
| 36 36 | 
             
              version_requirements: *id002
         | 
| 37 37 | 
             
            description: This ripl plugin colorizes ripl results.
         |