ripl-color_result 0.1.3 → 0.2.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'rubygems' unless Object.const_defined?(:Gem)
2
+ require 'rubygems' unless defined? Gem
3
3
  require File.dirname(__FILE__) + "/lib/ripl/color_result"
4
4
 
5
5
  Gem::Specification.new do |s|
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.summary = "A ripl plugin to colorize result."
12
12
  s.description = "This ripl plugin colorizes your result."
13
13
  s.required_rubygems_version = ">= 1.3.6"
14
- s.add_dependency 'ripl', '>= 0.2.4'
14
+ s.add_dependency 'ripl', '>= 0.2.8'
15
15
  s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
16
16
  s.extra_rdoc_files = ["README.rdoc", "COPYING"]
17
17
  s.license = 'MIT'
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.2.0
2
+ * Added ap_options to pass a options hash to awesome_inspect (thanks to DirtYiCE)
3
+ * Renamed color_result_schema option to color_result_default_schema (better logical nesting)
4
+
5
+ == 0.1.3
6
+ * Rails (bundler) compatibility
7
+
1
8
  == 0.1.2
2
9
  * customize default colorization colors with Ripl.config[:color_result_scheme]
3
10
 
data/README.rdoc CHANGED
@@ -4,7 +4,7 @@ This {ripl}[http://github.com/cldwalker/ripl] plugin colorizes your results.
4
4
  == Install
5
5
  Install the gem with:
6
6
 
7
- sudo gem install ripl-color_result
7
+ gem install ripl-color_result
8
8
 
9
9
  == Usage
10
10
 
@@ -14,8 +14,8 @@ Add to your ~/.riplrc
14
14
 
15
15
  You can choose a <tt>:color_result_engine</tt>. By default, the bundled +Wirble+-like colorization is used. Possible other values are:
16
16
 
17
- * <tt>:ap</tt> - using the awesome_print gem
18
- * <tt>:coderay</tt> - using the coderay gem
17
+ * <tt>:ap</tt> - using the _awesome_print_ gem
18
+ * <tt>:coderay</tt> - using the _coderay_ gem
19
19
 
20
20
  Example (in your ~/.riplrc)
21
21
 
@@ -23,9 +23,11 @@ Example (in your ~/.riplrc)
23
23
 
24
24
  Set it to +nil+ to deactivate result colorization.
25
25
 
26
- You can change the colors used by the default colorization by editing the <tt>:color_result_scheme</tt> hash:
26
+ You can change the colors used by the default colorization by editing the <tt>:color_result_default_schema</tt> hash:
27
+ Ripl.config[:color_result_default_schema][:comma] = :green
27
28
 
28
- Ripl.config[:color_result_scheme][:comma] = :green
29
+ If you use <tt>awesome_print</tt>, you can override default options using <tt>:color_result_ap_options</tt> hash:
30
+ Ripl.config[:color_result_ap_options] = { :multiline => false }
29
31
 
30
32
  == Credits
31
33
 
@@ -33,8 +35,8 @@ The default colorization uses code from Wirble
33
35
  * Copyright (C) 2006-2009 Paul Duncan <pabs@pablotron.org>
34
36
  * Copyright (C) 2009 Jens Wille <jens.wille@gmail.com>
35
37
 
36
- Copyright (c) 2010 Jan Lelis, http://rbjl.net. See COPYING for details.
38
+ Copyright (c) 2010 Jan Lelis <http://code-needs-smileys.com>, see COPYING for details.
37
39
 
38
- and cldwalker.
40
+ Plus contributions by cldwalker and DirtYiCE.
39
41
 
40
42
  J-_-L
data/deps.rip CHANGED
@@ -1 +1 @@
1
- ripl >=0.2.4
1
+ ripl >=0.2.8
@@ -2,7 +2,7 @@ require 'ripl'
2
2
 
3
3
  module Ripl
4
4
  module ColorResult
5
- VERSION = '0.1.3'
5
+ VERSION = '0.2.0'
6
6
  COLORS = {
7
7
  :nothing => '0;0',
8
8
  :black => '0;30',
@@ -23,31 +23,17 @@ module Ripl
23
23
  :white => '1;37',
24
24
  }
25
25
 
26
- # def inspect_result(result)
27
- # result.inspect
28
- # end
29
-
30
- def format_prompt(result)
31
- @result_prompt
32
- end
33
-
34
26
  def format_result(result)
35
27
  return super if !config[:color_result_engine]
36
- format_prompt(result) + inspect_result(result)
37
- end
38
-
39
- def inspect_result(result)
40
- # return super if !config[:color_result_engine]
41
28
 
42
- case config[:color_result_engine].to_sym
29
+ @result_prompt + case config[:color_result_engine].to_sym
43
30
  when :coderay
44
31
  require 'coderay'
45
32
  CodeRay.scan( result.inspect, :ruby ).term
46
33
  when :ap, :awesome_print
47
34
  require 'ap'
48
- result.awesome_inspect
35
+ result.awesome_inspect( config[:color_result_ap_options] || {} )
49
36
  else # :default
50
- #require File.expand_path('default_colorizer', dirname(__FILE__))
51
37
  require File.dirname(__FILE__) + "/color_result/default_colorizer"
52
38
  DefaultColorizer.colorize_code( result.inspect )
53
39
  end
@@ -56,10 +42,12 @@ module Ripl
56
42
  end
57
43
  end
58
44
 
59
- Ripl::Shell.send :include, Ripl::ColorResult if defined? Ripl::Shell
45
+ Ripl::Shell.send :include, Ripl::ColorResult
46
+
60
47
 
61
48
  Ripl.config[:color_result_engine] ||= :default
62
- Ripl.config[:color_result_scheme] ||= { # color scheme for default colorization, original from wirble
49
+ # color scheme for default colorization, original from wirble
50
+ Ripl.config[:color_result_default_schema] ||= {
63
51
  # delimiter colors
64
52
  :comma => :blue,
65
53
  :refers => :blue,
@@ -182,7 +182,7 @@ class << Ripl::ColorResult::DefaultColorizer = Module.new
182
182
  def colorize_code(str)
183
183
  ret, nocol = '', get_color(:nothing)
184
184
  tokenize(str) do |tok, val|
185
- ret << colorize_string(val, Ripl.config[:color_result_scheme][tok])
185
+ ret << colorize_string(val, Ripl.config[:color_result_default_schema][tok])
186
186
  end
187
187
  ret
188
188
  rescue # catch any errors from the tokenizer (just in case)
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
8
- - 3
9
- version: 0.1.3
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jan Lelis
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-18 00:00:00 +01:00
17
+ date: 2010-12-13 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -28,8 +28,8 @@ dependencies:
28
28
  segments:
29
29
  - 0
30
30
  - 2
31
- - 4
32
- version: 0.2.4
31
+ - 8
32
+ version: 0.2.8
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
35
  description: This ripl plugin colorizes your result.