riel 1.1.16 → 1.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/README.md +2 -37
  2. data/lib/riel/log/log.rb +17 -24
  3. data/lib/riel/log/loggable.rb +13 -15
  4. data/lib/riel/log/logger.rb +34 -66
  5. data/lib/riel/log.rb +0 -63
  6. data/lib/riel/optproc.rb +0 -3
  7. data/lib/riel/string.rb +0 -2
  8. data/lib/riel.rb +1 -1
  9. data/test/riel/log/format_test.rb +48 -0
  10. data/test/riel/optproc_test.rb +1 -30
  11. data/test/riel/{log_stack_test.rb → testlog/log_stack_test.rb} +0 -0
  12. data/test/riel/testlog/log_test.rb +254 -0
  13. data/test/riel/testlog/loggable_test.rb +31 -0
  14. metadata +89 -133
  15. data/lib/riel/ansicolor.rb +0 -91
  16. data/lib/riel/asciitable/cell.rb +0 -82
  17. data/lib/riel/asciitable/column.rb +0 -26
  18. data/lib/riel/asciitable/row.rb +0 -105
  19. data/lib/riel/asciitable/table.rb +0 -295
  20. data/lib/riel/text/ansi/ansi_color.rb +0 -31
  21. data/lib/riel/text/ansi/ansi_colors.rb +0 -16
  22. data/lib/riel/text/ansi/ansi_highlight.rb +0 -69
  23. data/lib/riel/text/ansi/ansi_list.rb +0 -17
  24. data/lib/riel/text/ansi/ansi_palette.rb +0 -48
  25. data/lib/riel/text/ansi/attributes.rb +0 -21
  26. data/lib/riel/text/ansi/backgrounds.rb +0 -13
  27. data/lib/riel/text/ansi/color.rb +0 -62
  28. data/lib/riel/text/ansi/foregrounds.rb +0 -12
  29. data/lib/riel/text/ansi/grey.rb +0 -30
  30. data/lib/riel/text/ansi/grey_palette.rb +0 -36
  31. data/lib/riel/text/ansi/palette.rb +0 -18
  32. data/lib/riel/text/ansi/rgb_color.rb +0 -28
  33. data/lib/riel/text/ansi/rgb_highlighter.rb +0 -73
  34. data/lib/riel/text/ansi/rgb_palette.rb +0 -49
  35. data/lib/riel/text/highlight.rb +0 -130
  36. data/lib/riel/text/highlightable.rb +0 -85
  37. data/lib/riel/text/html_highlight.rb +0 -98
  38. data/lib/riel/text/non_highlight.rb +0 -17
  39. data/lib/riel/text/string.rb +0 -10
  40. data/lib/riel/text.rb +0 -4
  41. data/test/riel/asciitable/table_test.rb +0 -77
  42. data/test/riel/log_test.rb +0 -164
  43. data/test/riel/text/ansi/ansi_highlight_test.rb +0 -116
  44. data/test/riel/text/ansi/ansi_palette_test.rb +0 -65
  45. data/test/riel/text/ansi/grey_palette_test.rb +0 -39
  46. data/test/riel/text/ansi/rgb_highlighter_test.rb +0 -99
  47. data/test/riel/text/ansi/rgb_palette_test.rb +0 -122
  48. data/test/riel/text/highlightable_test.rb +0 -24
  49. data/test/riel/text/string_test.rb +0 -47
  50. data/test/riel/text_test.rb +0 -62
@@ -1,122 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'riel/text/ansi/rgb_palette'
5
- require 'riel/text/ansi/palette_tc'
6
-
7
- module Text
8
- class RGBPaletteTest < PaletteTest
9
- def cls
10
- RGBPalette
11
- end
12
-
13
- def test_foregrounds
14
- expected = [
15
- "rgb foreground colors\n",
16
- "000 001 002 003 004 005 \n",
17
- "010 011 012 013 014 015 \n",
18
- "020 021 022 023 024 025 \n",
19
- "030 031 032 033 034 035 \n",
20
- "040 041 042 043 044 045 \n",
21
- "050 051 052 053 054 055 \n",
22
- "\n",
23
- "100 101 102 103 104 105 \n",
24
- "110 111 112 113 114 115 \n",
25
- "120 121 122 123 124 125 \n",
26
- "130 131 132 133 134 135 \n",
27
- "140 141 142 143 144 145 \n",
28
- "150 151 152 153 154 155 \n",
29
- "\n",
30
- "200 201 202 203 204 205 \n",
31
- "210 211 212 213 214 215 \n",
32
- "220 221 222 223 224 225 \n",
33
- "230 231 232 233 234 235 \n",
34
- "240 241 242 243 244 245 \n",
35
- "250 251 252 253 254 255 \n",
36
- "\n",
37
- "300 301 302 303 304 305 \n",
38
- "310 311 312 313 314 315 \n",
39
- "320 321 322 323 324 325 \n",
40
- "330 331 332 333 334 335 \n",
41
- "340 341 342 343 344 345 \n",
42
- "350 351 352 353 354 355 \n",
43
- "\n",
44
- "400 401 402 403 404 405 \n",
45
- "410 411 412 413 414 415 \n",
46
- "420 421 422 423 424 425 \n",
47
- "430 431 432 433 434 435 \n",
48
- "440 441 442 443 444 445 \n",
49
- "450 451 452 453 454 455 \n",
50
- "\n",
51
- "500 501 502 503 504 505 \n",
52
- "510 511 512 513 514 515 \n",
53
- "520 521 522 523 524 525 \n",
54
- "530 531 532 533 534 535 \n",
55
- "540 541 542 543 544 545 \n",
56
- "550 551 552 553 554 555 \n",
57
- "\n",
58
- ]
59
-
60
- assert_print expected, :print_foregrounds
61
- end
62
-
63
- def test_backgrounds
64
- expected = [
65
- "rgb background colors\n",
66
- "000 001 002 003 004 005 \n",
67
- "010 011 012 013 014 015 \n",
68
- "020 021 022 023 024 025 \n",
69
- "030 031 032 033 034 035 \n",
70
- "040 041 042 043 044 045 \n",
71
- "050 051 052 053 054 055 \n",
72
- "\n",
73
- "100 101 102 103 104 105 \n",
74
- "110 111 112 113 114 115 \n",
75
- "120 121 122 123 124 125 \n",
76
- "130 131 132 133 134 135 \n",
77
- "140 141 142 143 144 145 \n",
78
- "150 151 152 153 154 155 \n",
79
- "\n",
80
- "200 201 202 203 204 205 \n",
81
- "210 211 212 213 214 215 \n",
82
- "220 221 222 223 224 225 \n",
83
- "230 231 232 233 234 235 \n",
84
- "240 241 242 243 244 245 \n",
85
- "250 251 252 253 254 255 \n",
86
- "\n",
87
- "300 301 302 303 304 305 \n",
88
- "310 311 312 313 314 315 \n",
89
- "320 321 322 323 324 325 \n",
90
- "330 331 332 333 334 335 \n",
91
- "340 341 342 343 344 345 \n",
92
- "350 351 352 353 354 355 \n",
93
- "\n",
94
- "400 401 402 403 404 405 \n",
95
- "410 411 412 413 414 415 \n",
96
- "420 421 422 423 424 425 \n",
97
- "430 431 432 433 434 435 \n",
98
- "440 441 442 443 444 445 \n",
99
- "450 451 452 453 454 455 \n",
100
- "\n",
101
- "500 501 502 503 504 505 \n",
102
- "510 511 512 513 514 515 \n",
103
- "520 521 522 523 524 525 \n",
104
- "530 531 532 533 534 535 \n",
105
- "540 541 542 543 544 545 \n",
106
- "550 551 552 553 554 555 \n",
107
- "\n",
108
- ]
109
-
110
- assert_print expected, :print_backgrounds
111
- end
112
-
113
- def test_combinations
114
- # not checking this, since it is over 9000 lines of output:
115
- expected = [
116
- # a lot
117
- ]
118
-
119
- # assert_print expected, :print_combinations
120
- end
121
- end
122
- end
@@ -1,24 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'test/unit'
5
- require 'riel/text/highlightable'
6
- require 'riel/text/ansi/ansi_highlight'
7
- require 'riel/text/string'
8
-
9
- class HighlightableTestCase < Test::Unit::TestCase
10
- def test_string_add_to
11
- Text::Highlightable.add_to String
12
- assert_equal "\e[34mfoo\e[0m", "foo".blue
13
- end
14
-
15
- def test_string_include
16
- assert_equal "\e[34mfoo\e[0m", "foo".blue
17
- end
18
-
19
- def test_string_respond_to
20
- str = ""
21
- assert str.respond_to? :blue
22
- assert !str.respond_to?(:azure)
23
- end
24
- end
@@ -1,47 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'test/unit'
5
- require 'riel/text/ansi/ansi_highlight'
6
- require 'riel/text/string'
7
-
8
- class StringTestCase < Test::Unit::TestCase
9
- def run_test str, input, *chars
10
- escape_sequence = chars.collect { |ch| "\e[#{ch}m" }.join("")
11
- assert_equal "#{escape_sequence}#{str}\e[0m", input
12
- end
13
-
14
- def test_all_ansi
15
- Text::Highlightable.add_to String
16
- str = "precision"
17
-
18
- run_test str, str.none, 0
19
- run_test str, str.bold, 1
20
- run_test str, str.underline, 4
21
- run_test str, str.underscore, 4
22
- run_test str, str.blink, 5 # every geocities site circa 1998
23
- run_test str, str.negative, 7
24
- run_test str, str.concealed, 8
25
- run_test str, str.black, 30
26
- run_test str, str.red, 31
27
- run_test str, str.green, 32
28
- run_test str, str.yellow, 33
29
- run_test str, str.blue, 34
30
- run_test str, str.magenta, 35
31
- run_test str, str.cyan, 36
32
- run_test str, str.white, 37
33
- run_test str, str.on_black, 40
34
- run_test str, str.on_red, 41
35
- run_test str, str.on_green, 42
36
- run_test str, str.on_yellow, 43
37
- run_test str, str.on_blue, 44
38
- run_test str, str.on_magenta, 45
39
- run_test str, str.on_cyan, 46
40
- run_test str, str.on_white, 47
41
- run_test str, str.none_on_white, 0, 47
42
- run_test str, str.none_on_black, 0, 40
43
- run_test str, str.none_on_blue, 0, 44
44
- run_test str, str.red_on_white, 31, 47
45
- run_test str, str.bold_red_on_white, 1, 31, 47
46
- end
47
- end
@@ -1,62 +0,0 @@
1
- #!/usr/bin/ruby -w
2
- # -*- ruby -*-
3
-
4
- require 'test/unit'
5
- require 'riel/text'
6
-
7
- class TextTestCase < Test::Unit::TestCase
8
- def run_html_test expected, input
9
- assert_equal expected, input
10
- end
11
-
12
- def xxx_disabled_test_html_highlight
13
- String.highlighter = "HTML"
14
-
15
- str = "precision"
16
-
17
- run_html_test str, str.none
18
- run_html_test "<b>" + str + "</b>", str.bold
19
-
20
- [ str.underline, str.underscore ].each do |input|
21
- run_html_test "<u>" + str + "</u>", input
22
- end
23
-
24
- run_html_test "<blink>" + str + "</blink>", str.blink
25
- run_html_test "<span style=\"color: white; background-color: black\">" + str + "</span>", str.negative
26
- run_html_test "<!-- " + str + " -->", str.concealed
27
- run_html_test "<span style=\"color: black\">" + str + "</span>", str.black
28
- run_html_test "<span style=\"color: red\">" + str + "</span>", str.red
29
- run_html_test "<span style=\"color: green\">" + str + "</span>", str.green
30
- run_html_test "<span style=\"color: yellow\">" + str + "</span>", str.yellow
31
- run_html_test "<span style=\"color: blue\">" + str + "</span>", str.blue
32
- run_html_test "<span style=\"color: #FF00FF\">" + str + "</span>", str.magenta
33
- run_html_test "<span style=\"color: #00FFFF\">" + str + "</span>", str.cyan
34
- run_html_test "<span style=\"color: white\">" + str + "</span>", str.white
35
- run_html_test "<span style=\"background-color: black\">" + str + "</span>", str.on_black
36
- run_html_test "<span style=\"background-color: red\">" + str + "</span>", str.on_red
37
- run_html_test "<span style=\"background-color: green\">" + str + "</span>", str.on_green
38
- run_html_test "<span style=\"background-color: yellow\">" + str + "</span>", str.on_yellow
39
- run_html_test "<span style=\"background-color: blue\">" + str + "</span>", str.on_blue
40
- run_html_test "<span style=\"background-color: #FF00FF\">" + str + "</span>", str.on_magenta
41
- run_html_test "<span style=\"background-color: #00FFFF\">" + str + "</span>", str.on_cyan
42
- run_html_test "<span style=\"background-color: white\">" + str + "</span>", str.on_white
43
- run_html_test "<span style=\"background-color: white\">" + str + "</span>", str.none_on_white
44
- run_html_test "<span style=\"background-color: black\">" + str + "</span>", str.none_on_black
45
- run_html_test "<span style=\"background-color: blue\">" + str + "</span>", str.none_on_blue
46
- run_html_test "<span style=\"color: red\">" + "<span style=\"background-color: white\">" + str + "</span>" + "</span>", str.red_on_white
47
- run_html_test "<b><span style=\"color: red\">" + "<span style=\"background-color: white\">" + str + "</span>" + "</span></b>", str.bold_red_on_white
48
- end
49
-
50
- def xxx_disabled_test_string_reverse
51
- String.highlighter = "HTML"
52
-
53
- str = "precision"
54
-
55
- # string.reverse does not mean ANSI reverse:
56
- assert_equal "noisicerp", str.reverse
57
- end
58
-
59
- def test_nothing
60
-
61
- end
62
- end