wirb 0.2.4 → 0.2.5

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/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.2.5
2
+ * Fix wrong \\ escaping
3
+ * Fix stupid rescue bug (no more wirb crashes)
4
+
1
5
  == 0.2.3 / 0.2.4
2
6
  * Support for rubygems-test <gem-testers.org>
3
7
 
File without changes
data/README.rdoc CHANGED
@@ -1,7 +1,5 @@
1
1
  == Wavy Interactive Ruby
2
- *Wirb* colorizes your inspected Ruby objects. It is based on Wirble[http://pablotron.org/software/wirble/], but only provides result highlighting.
3
-
4
- It fixes some displaying bugs and extends the original tokenizer.
2
+ *Wirb* colorizes your inspected Ruby objects. It is based on Wirble[http://pablotron.org/software/wirble/], but only provides and improves result highlighting.
5
3
 
6
4
  == Install
7
5
  Install the gem with:
@@ -16,19 +14,20 @@ Add to your <tt>~/.irbrc</tt>
16
14
  Wirb.start
17
15
 
18
16
  == Improvements and fixed Wirble bugs
19
- * Basic support for regexes (Wirble displayed them as keywords)
20
- * Support for generic objects, especially sets and enumerators
21
- * Fixes some symbol bugs (e.g. :+, :*, ...)
22
17
  * Does not change the inspect value (e.g. ranges with 4 instead of 3 dots)
18
+ * Basic support for regexes
19
+ * Fixes some symbol bugs (e.g. :+, :*, ...)
20
+ * Support for generic objects, especially sets and enumerators
23
21
  * Comes with tests
24
22
  * Can be used without irb
23
+ * Supports 1.8, 1.9, jruby, rbx
25
24
 
26
25
  == Customize
27
26
  The color schema can be changed with:
28
27
 
29
28
  Wirb.schema = { :comma => :purple, ... }
30
29
 
31
- Wirb color schemas are (almost) compatible with those from the original Wirble, but there are many extensions. Take a look at wirb/schema.rb or </tt>Wirb.schema</tt> for a list of available token descriptions. See wirb/colors.rb or <tt>Wirb::COLORS</tt> for the available colors.
30
+ Wirb color schemas are (almost) compatible with those from the original Wirble, but there are many extensions. Take a look at wirb/schema.rb or <tt>Wirb.schema</tt> for a list of available token descriptions. See wirb/colors.rb or <tt>Wirb::COLORS</tt> for the available colors.
32
31
 
33
32
  Color schemas wanted! You've got a good looking alternative color schema? Please post it on the wiki[https://github.com/janlelis/wirb/wiki/schemas], it may be bundled with a next version ;)
34
33
 
@@ -61,13 +61,20 @@ class << Wirb
61
61
  when '.' then push_state[:range, :repeat]
62
62
  when /\s/ then pass[:whitespace, c]
63
63
  when ',' then pass[:comma, ',']
64
- when '>' then pass[:refers, '=>'] if lc == '='
64
+ when '>'
65
+ if lc == '='
66
+ if get_state[:hash]
67
+ pass[:refers, '=>']
68
+ else # FIXME remove this buggy <=> cheat
69
+ pass[:symbol, '=>']
70
+ end
71
+ end
65
72
  when '('
66
73
  if nc =~ /[0-9-]/
67
74
  push_state[:rational, :repeat]
68
75
  else
69
76
  push_state[:object_description, :repeat]
70
- open_brackets = 0 # TODO also count ()?
77
+ open_brackets = 0
71
78
  end
72
79
 
73
80
  when '{'
@@ -126,8 +133,9 @@ class << Wirb
126
133
  when /[^"., }\])=]/
127
134
  @token << c
128
135
  else
129
- if ( c == '=' && !(nc == '>' && lc != '<' ) ) ||
130
- ( c == ']' && lc == '[' )
136
+ if c == ']' && lc == '['
137
+ @token << c
138
+ elsif c == '=' && nc != '>' # FIXME: spaceship error
131
139
  @token << c
132
140
  else
133
141
  pass[:symbol_prefix, ':']
@@ -136,7 +144,7 @@ class << Wirb
136
144
  end
137
145
 
138
146
  when :symbol_string
139
- if c == '"' && lc != '\\'
147
+ if c == '"' && ( !( @token =~ /\\+$/; $& ) || $&.size % 2 == 0 ) # see string
140
148
  pass[:open_symbol_string, '"']
141
149
  pass_state[:remove]
142
150
  pop_state[]
@@ -146,8 +154,8 @@ class << Wirb
146
154
  end
147
155
 
148
156
  when :string
149
- if c == '"' && lc != '\\'
150
- pass[:open_string, '"']
157
+ if c == '"' && ( !( @token =~ /\\+$/; $& ) || $&.size % 2 == 0 ) # allow escaping of " and
158
+ pass[:open_string, '"'] # work around \\
151
159
  pass_state[:remove]
152
160
  pass[:close_string, '"']
153
161
  else
@@ -155,7 +163,7 @@ class << Wirb
155
163
  end
156
164
 
157
165
  when :regexp
158
- if c == '/' && lc != '\\'
166
+ if c == '/' && ( !( @token =~ /\\+$/; $& ) || $&.size % 2 == 0 ) # see string
159
167
  pass[:open_regexp, '/']
160
168
  pass_state[:remove]
161
169
  pass[:close_regexp, '/']
@@ -318,7 +326,7 @@ class << Wirb
318
326
  end
319
327
  rescue
320
328
  # p$!, $!.backtrace[0]
321
- pass[:default, str.gsub(/^#{@passed}/, '')]
329
+ pass[:default, str.sub(@passed, '')]
322
330
  end
323
331
  end
324
332
 
data/lib/wirb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wirb
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
@@ -3,7 +3,7 @@ require 'set'
3
3
  describe tokenizer(__FILE__) do
4
4
  after :each do check_value end
5
5
 
6
- please do check [2,'sdf',:hallosfe, /34jf3/, [[[[]]]], {{5=> "4"} => {Set.new => binding}}]
6
+ please do check [2,'sdf',:hallosfe, /34jf3/, [[[[]]]], {{5=> "4"} => {Set.new => Object.new}}]
7
7
  tokens.should be_like [
8
8
  [:open_array, "["],
9
9
  [:number, "2"],
@@ -52,7 +52,7 @@ describe tokenizer(__FILE__) do
52
52
  [:close_object, ">"],
53
53
  [:refers, "=>"],
54
54
  [:open_object, "#<"],
55
- [:object_class, "Binding"],
55
+ [:object_class, "Object"],
56
56
  [:object_description_prefix, ":"],
57
57
  [:object_addr, OBJECT_ID],
58
58
  [:close_object, ">"],
@@ -8,4 +8,28 @@ describe tokenizer(__FILE__) do
8
8
  please do check '"quote"'
9
9
  tokens.should == [[:open_string, '"'], [:string, "\\\"quote\\\""], [:close_string, '"']]
10
10
  end
11
+
12
+ please do check "\\"
13
+ tokens.should == [
14
+ [:open_string, "\""],
15
+ [:string, "\\\\"],
16
+ [:close_string, "\""],
17
+ ]
18
+ end
19
+
20
+ please do check "\\\\"
21
+ tokens.should == [
22
+ [:open_string, "\""],
23
+ [:string, "\\\\\\\\"],
24
+ [:close_string, "\""],
25
+ ]
26
+ end
27
+
28
+ please do check "\\\"X"
29
+ tokens.should == [
30
+ [:open_string, "\""],
31
+ [:string, "\\\\\\\"X"],
32
+ [:close_string, "\""],
33
+ ]
34
+ end
11
35
  end
@@ -37,7 +37,9 @@ describe tokenizer(__FILE__) do
37
37
  [:comma, ","],
38
38
  [:whitespace, " "],
39
39
  [:symbol_prefix, ":"],
40
- [:symbol, "<=>"],
40
+ # [:symbol, "<=>"], # FIXME
41
+ [:symbol, "<"],
42
+ [:symbol, "=>"],
41
43
  [:comma, ","],
42
44
  [:whitespace, " "],
43
45
  [:symbol_prefix, ":"],
@@ -81,7 +83,7 @@ describe tokenizer(__FILE__) do
81
83
  ]
82
84
  end
83
85
 
84
- please do check [[:hallo],{:'hallo'=>:'test'}, {:'hallo='=>:'test='}]
86
+ please do check [[:hallo],{:'hallo'=>:'test'}, {:'hallo='=>:'test='}, {:'<'=>9}]
85
87
  tokens.should == [
86
88
  [:open_array, "["],
87
89
  [:open_array, "["],
@@ -106,6 +108,14 @@ describe tokenizer(__FILE__) do
106
108
  [:symbol_prefix, ":"],
107
109
  [:symbol, "test="],
108
110
  [:close_hash, "}"],
111
+ [:comma, ","],
112
+ [:whitespace, " "],
113
+ [:open_hash, "{"],
114
+ [:symbol_prefix, ":"],
115
+ [:symbol, "<"],
116
+ [:refers, "=>"],
117
+ [:number, "9"],
118
+ [:close_hash, "}"],
109
119
  [:close_array, "]"],
110
120
  ]
111
121
  end
data/wirb.gemspec CHANGED
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  s.description = "Colorizes your irb results. It's based on Wirble but only provides result highlighting. Just call Wirb.start and enjoy the colors ;)."
13
13
  s.required_rubygems_version = '>= 1.3.6'
14
14
  s.required_ruby_version = '>= 1.8.7'
15
- s.files = Dir.glob(%w[{lib,test,spec}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile wirb.gemspec .gemtest}
16
- s.extra_rdoc_files = ["README.rdoc", "COPYING"]
15
+ s.files = Dir.glob(%w[{lib,test,spec}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c}]) + %w{Rakefile wirb.gemspec .gemtest}
16
+ s.extra_rdoc_files = ["README.rdoc", "COPYING.txt"]
17
17
  s.license = 'MIT'
18
18
  s.add_development_dependency 'rspec'
19
19
  s.add_development_dependency 'rspec-core'
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wirb
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 4
9
- version: 0.2.4
4
+ prerelease:
5
+ version: 0.2.5
10
6
  platform: ruby
11
7
  authors:
12
8
  - Jan Lelis
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-02-03 00:00:00 +01:00
18
- default_executable:
13
+ date: 2011-05-12 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
16
  name: rspec
@@ -25,8 +20,6 @@ dependencies:
25
20
  requirements:
26
21
  - - ">="
27
22
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
23
  version: "0"
31
24
  type: :development
32
25
  version_requirements: *id001
@@ -38,8 +31,6 @@ dependencies:
38
31
  requirements:
39
32
  - - ">="
40
33
  - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
34
  version: "0"
44
35
  type: :development
45
36
  version_requirements: *id002
@@ -51,8 +42,6 @@ dependencies:
51
42
  requirements:
52
43
  - - ">="
53
44
  - !ruby/object:Gem::Version
54
- segments:
55
- - 9
56
45
  version: "9"
57
46
  type: :development
58
47
  version_requirements: *id003
@@ -64,7 +53,7 @@ extensions: []
64
53
 
65
54
  extra_rdoc_files:
66
55
  - README.rdoc
67
- - COPYING
56
+ - COPYING.txt
68
57
  files:
69
58
  - lib/wirb.rb
70
59
  - lib/wirb/schema.rb
@@ -87,13 +76,12 @@ files:
87
76
  - spec/tokenizer_object_spec.rb
88
77
  - spec/tokenizer_nested_spec.rb
89
78
  - spec/tokenizer_string_spec.rb
79
+ - COPYING.txt
90
80
  - README.rdoc
91
81
  - CHANGELOG.rdoc
92
82
  - Rakefile
93
83
  - wirb.gemspec
94
84
  - .gemtest
95
- - COPYING
96
- has_rdoc: true
97
85
  homepage: http://github.com/janlelis/wirb
98
86
  licenses:
99
87
  - MIT
@@ -107,25 +95,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
95
  requirements:
108
96
  - - ">="
109
97
  - !ruby/object:Gem::Version
110
- segments:
111
- - 1
112
- - 8
113
- - 7
114
98
  version: 1.8.7
115
99
  required_rubygems_version: !ruby/object:Gem::Requirement
116
100
  none: false
117
101
  requirements:
118
102
  - - ">="
119
103
  - !ruby/object:Gem::Version
120
- segments:
121
- - 1
122
- - 3
123
- - 6
124
104
  version: 1.3.6
125
105
  requirements: []
126
106
 
127
107
  rubyforge_project:
128
- rubygems_version: 1.3.7
108
+ rubygems_version: 1.8.1
129
109
  signing_key:
130
110
  specification_version: 3
131
111
  summary: Colorizes your irb results.