ansi 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
data/.ruby CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  source:
3
- - meta
3
+ - var
4
4
  authors:
5
5
  - name: Thomas Sawyer
6
6
  email: transfire@gmail.com
@@ -41,13 +41,15 @@ revision: 0
41
41
  created: '2009-08-01'
42
42
  summary: ANSI at your fingertips!
43
43
  title: ANSI
44
- version: 1.4.1
44
+ version: 1.4.2
45
45
  name: ansi
46
- description: ! 'The ANSI project is a collection of ANSI escape code related libraries
47
- enabling
46
+ description: ! 'The ANSI project is a superlative collection of ANSI escape code related
47
+ libraries
48
48
 
49
- ANSI code based colorization and stylization of output. It is very nice for
49
+ enabling ANSI colorization and stylization of console output. Byte for byte
50
50
 
51
- beautifying shell output.'
51
+ ANSI is the best ANSI code library available for the Ruby programming
52
+
53
+ language.'
52
54
  organization: Rubyworks
53
- date: '2011-11-09'
55
+ date: '2012-01-29'
@@ -1,6 +1,168 @@
1
- = Licenses
1
+ = COPYRIGHT
2
2
 
3
- == BSD 2-Clause License
3
+ == NOTICES
4
+
5
+ === ANSI
6
+
7
+ Copyright:: (c) 2009 {Rubyworks}[http://rubyworks.github.com]
8
+ License:: {BSD-2-Clause}[http://spdx.org/licenses/BSD-2-Clause]
9
+ Website:: http://rubyworks.github.com/ansi
10
+
11
+ Copyright 2009 Rubyworks.
12
+
13
+ All rights reserved.
14
+
15
+ Redistribution and use in source and binary forms, with or without modification, are
16
+ permitted provided that the following conditions are met:
17
+
18
+ 1. Redistributions of source code must retain the above copyright notice, this list of
19
+ conditions and the following disclaimer.
20
+
21
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
22
+ of conditions and the following disclaimer in the documentation and/or other materials
23
+ provided with the distribution.
24
+
25
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED
26
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
27
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
28
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
31
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+
35
+ (http://spdx.org/licenses/BSD-2-Clause)
36
+
37
+
38
+ === ProgressBar
39
+
40
+ Copyright:: (c) 2001 Satoru Takabayashi
41
+ License:: {Ruby}[http://spdx.org/licenses/Ruby]
42
+ Website:: http://0xcc.net/ruby-progressbar
43
+
44
+ ProgressBar class is based on the original ProgressBar by Satoru Takabayashi.
45
+
46
+ Ruby/ProgressBar - a text progress bar library
47
+
48
+ Copyright (C) 2001-2005 Satoru Takabayashi <satoru@namazu.org>
49
+ All rights reserved.
50
+ This is free software with ABSOLUTELY NO WARRANTY.
51
+
52
+ You can redistribute it and/or modify it under the terms
53
+ of Ruby's license.
54
+
55
+
56
+ === HighLine (Terminal Extensions)
57
+
58
+ Copyright:: (c) 2006 Gray Productions
59
+ License:: {Ruby}[http://spdx.org/licenses/Ruby]
60
+ Website:: http://highline.rubyforge.org
61
+
62
+ The terminal extensions are based on HighLine's SystemExtensions
63
+ by James Edward Gray II.
64
+
65
+ Copyright 2006 Gray Productions
66
+
67
+ Distributed under the user's choice of the {GPL Version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html]
68
+ (see GPL-2.0.txt for details) or the {Ruby software license}[http://www.ruby-lang.org/en/LICENSE.txt]
69
+ by James Edward Gray II and Greg Brown.
70
+
71
+ Please email James[mailto:james@grayproductions.net] with any questions.
72
+
73
+
74
+ == BBCode
75
+
76
+ Copyright:: (c) 2002 Thomas-Ivo Heinen
77
+ License:: {Ruby}[http://spdx.org/licenses/Ruby]
78
+
79
+ BBCode module is a derivative of BBCode by Thomas-Ivo Heinen.
80
+
81
+ Copyright (c) 2002 Thomas-Ivo Heinen
82
+
83
+ This module is free software. You may use, modify, and/or redistribute this
84
+ software under the same terms as Ruby.
85
+
86
+ This program is distributed in the hope that it will be useful, but WITHOUT
87
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
88
+ FOR A PARTICULAR PURPOSE.
89
+
90
+
91
+ == Rainbow (XTerm Color Support)
92
+
93
+ Copyright:: (c) Marcin Kulik
94
+ License:: {MIT}[http://spdx.org/licenses/MIT]
95
+ Website:: http://github.com/sickill/rainbow
96
+
97
+ Rainbox provided the bases for building the XTerm 256 color code
98
+ support into the ANSI::Code module.
99
+
100
+ Copyright (c) Marcin Kulik
101
+
102
+ Permission is hereby granted, free of charge, to any person obtaining
103
+ a copy of this software and associated documentation files (the
104
+ "Software"), to deal in the Software without restriction, including
105
+ without limitation the rights to use, copy, modify, merge, publish,
106
+ distribute, sublicense, and/or sell copies of the Software, and to
107
+ permit persons to whom the Software is furnished to do so, subject to
108
+ the following conditions:
109
+
110
+ The above copyright notice and this permission notice shall be
111
+ included in all copies or substantial portions of the Software.
112
+
113
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
114
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
115
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
116
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
117
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
118
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
119
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
120
+
121
+
122
+ === Paint
123
+
124
+ Copyright:: (c) 2011 Jan Lelis
125
+ License:: {MIT}[http://spdx.org/licenses/MIT]
126
+ Website:: https://github.com/janlelis/paint
127
+
128
+ Some of the latest ANSI code names, and inspiration to check out Rainbow
129
+ and include XTerm 256 color codes, came from Paint.
130
+
131
+ Copyright (c) 2011 Jan Lelis
132
+
133
+ Permission is hereby granted, free of charge, to any person obtaining
134
+ a copy of this software and associated documentation files (the
135
+ "Software"), to deal in the Software without restriction, including
136
+ without limitation the rights to use, copy, modify, merge, publish,
137
+ distribute, sublicense, and/or sell copies of the Software, and to
138
+ permit persons to whom the Software is furnished to do so, subject to
139
+ the following conditions:
140
+
141
+ The above copyright notice and this permission notice shall be
142
+ included in all copies or substantial portions of the Software.
143
+
144
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
145
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
146
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
147
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
148
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
149
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
150
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
151
+
152
+
153
+ === ANSIColor
154
+
155
+ Copyright:: (c) 2002 Florian Frank
156
+ Website:: http://flori.github.com/term-ansicolor
157
+
158
+ Albeit the code no long bares much if any resemblance to it, the ANSI Code
159
+ module (and subsequently the Constants module) originated with the
160
+ ANSIColor library by Florian Frank.
161
+
162
+
163
+ == LICENSES
164
+
165
+ === BSD 2-Clause License
4
166
 
5
167
  Redistribution and use in source and binary forms, with or without modification, are
6
168
  permitted provided that the following conditions are met:
@@ -12,9 +174,9 @@
12
174
  of conditions and the following disclaimer in the documentation and/or other materials
13
175
  provided with the distribution.
14
176
 
15
- THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR IMPLIED
16
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
177
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
178
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
179
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
18
180
  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
181
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20
182
  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
@@ -23,7 +185,7 @@
23
185
  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
186
 
25
187
 
26
- == MIT License
188
+ === MIT License
27
189
 
28
190
  Permission is hereby granted, free of charge, to any person obtaining
29
191
  a copy of this software and associated documentation files (the
@@ -45,7 +207,7 @@
45
207
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46
208
 
47
209
 
48
- == Ruby License
210
+ === Ruby License
49
211
 
50
212
  Ruby is copyrighted free software by <COPYRIGHT HOLDER>.
51
213
  You can redistribute it and/or modify it under either the terms of the GPL
@@ -106,7 +268,7 @@
106
268
  PURPOSE.
107
269
 
108
270
 
109
- == GPL 2 License
271
+ === GPL 2 License
110
272
 
111
273
  GNU GENERAL PUBLIC LICENSE
112
274
  Version 2, June 1991
@@ -1,5 +1,26 @@
1
1
  = RELEASE HISTORY
2
2
 
3
+ == 1.4.2 | 2012-01-29
4
+
5
+ ANSI chains are a new feature inspired by Kazuyoshi Tlacaelel's Isna project.
6
+ It is a fluid notation for the String#ansi method, e.g. `"foo".red.on_white`.
7
+ Also, ASNI now supports "smart codes", preventing previously applied codes
8
+ from undermining the applicaiton of additional codes --a subtle issue that
9
+ most other ANSI libraries overlook. Plus a few other improvements including
10
+ that of the API documentation.
11
+
12
+ Changes:
13
+
14
+ * Add ANSI::Chains, extending String#ansi method.
15
+ * Support smart code application.
16
+ * Add Diff#to_a and shortcut to it via Diff.diff().
17
+ * Improve #colorize method in ProgressBar.
18
+ * Change ProgressBar's default mark to `|` instead of `o`.
19
+ * Fix Curses return order of screen cols and rows.
20
+ * Support center alignment in Columns.
21
+ * Support custom padding for Columns.
22
+
23
+
3
24
  == 1.4.1 | 2011-11-09
4
25
 
5
26
  This release simply fixes a documentation issue, to make sure
data/QED.rdoc CHANGED
@@ -48,29 +48,16 @@ The ANSI::Code module supports most standard ANSI codes, though
48
48
  not all platforms support every code, so YMMV.
49
49
 
50
50
 
51
- = ANSI::BBCode
52
-
53
- The BBCode module provides methods for converting between
54
- BBCodes, basic HTML and ANSI codes.
55
-
56
- require 'ansi/bbcode'
57
-
58
- BBCodes are color and style codes in square brackets, quite
59
- popular with on line forums.
60
-
61
- bbcode = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"
62
-
63
- We can convert this to ANSI code simply enough:
64
-
65
- ansi = ANSI::BBCode.bbcode_to_ansi(bbcode)
66
-
67
- ansi.assert == "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n"
51
+ = String Extensions
68
52
 
69
- In addition the BBCode module supports conversion to simple HTML.
53
+ In addition the library offers an extension to String class
54
+ called #ansi, which allows some of the ANSI::Code methods
55
+ to be called in a more object-oriented fashion.
70
56
 
71
- html = ANSI::BBCode.bbcode_to_html(bbcode)
57
+ require 'ansi/core'
72
58
 
73
- html.assert == "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n"
59
+ str = "Hello".ansi(:red) + "World".ansi(:blue)
60
+ str.assert == "\e[31mHello\e[0m\e[34mWorld\e[0m"
74
61
 
75
62
 
76
63
  = ANSI::Logger
@@ -384,15 +371,85 @@ The output will be:
384
371
 
385
372
 
386
373
 
387
- = String Extensions
374
+ = ANSI::Diff
388
375
 
389
- In addition the library offers an extension to String class
390
- called #ansi, which allows some of the ANSI::Code methods
391
- to be called in a more object-oriented fashion.
376
+ require 'ansi/diff'
392
377
 
393
- require 'ansi/core'
378
+ a = 'abcYefg'
379
+ b = 'abcXefg'
394
380
 
395
- str = "Hello".ansi(:red) + "World".ansi(:blue)
396
- str.assert == "\e[31mHello\e[0m\e[34mWorld\e[0m"
381
+ diff = ANSI::Diff.new(a,b)
382
+
383
+ diff.to_s.assert == "\e[31mabc\e[0m\e[33mYefg\e[0m\n\e[31mabc\e[0mXefg"
384
+
385
+ Try another.
386
+
387
+ a = 'abc'
388
+ b = 'abcdef'
389
+
390
+ diff = ANSI::Diff.new(a,b)
391
+
392
+ diff.to_s.assert == "\e[31mabc\e[0m\n\e[31mabc\e[0mdef"
393
+
394
+ And another.
395
+
396
+ a = 'abcXXXghi'
397
+ b = 'abcdefghi'
398
+
399
+ diff = ANSI::Diff.new(a,b)
400
+
401
+ diff.to_s.assert == "\e[31mabc\e[0m\e[33mXXXghi\e[0m\n\e[31mabc\e[0mdefghi"
402
+
403
+ And another.
404
+
405
+ a = 'abcXXXdefghi'
406
+ b = 'abcdefghi'
407
+
408
+ diff = ANSI::Diff.new(a,b)
409
+
410
+ diff.to_s.assert == "\e[31mabc\e[0m\e[33mXXX\e[0m\e[35mdefghi\e[0m\n\e[31mabc\e[0m\e[35mdefghi\e[0m"
411
+
412
+ Comparison that is mostly different.
413
+
414
+ a = 'abcpppz123'
415
+ b = 'abcxyzzz43'
416
+
417
+ diff = ANSI::Diff.new(a,b)
418
+
419
+ diff.to_s.assert == "\e[31mabc\e[0m\e[33mpppz123\e[0m\n\e[31mabc\e[0mxyzzz43"
420
+
421
+
422
+ = ANSI::BBCode
423
+
424
+ The BBCode module provides methods for converting between
425
+ BBCodes, basic HTML and ANSI codes.
426
+
427
+ require 'ansi/bbcode'
428
+
429
+ BBCodes are color and style codes in square brackets, quite
430
+ popular with on line forums.
431
+
432
+ bbcode = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"
433
+
434
+ We can convert this to ANSI code simply enough:
435
+
436
+ ansi = ANSI::BBCode.bbcode_to_ansi(bbcode)
437
+
438
+ ansi.assert == "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n"
439
+
440
+ In addition the BBCode module supports conversion to simple HTML.
441
+
442
+ html = ANSI::BBCode.bbcode_to_html(bbcode)
443
+
444
+ html.assert == "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n"
445
+
446
+
447
+ = ANSI::Terminal
448
+
449
+ We should be ables to get the terminal width via the `terminal_width` method.
450
+
451
+ width = ANSI::Terminal.terminal_width
452
+
453
+ Fixnum.assert === width
397
454
 
398
455
 
@@ -1,8 +1,8 @@
1
1
  = ANSI
2
2
 
3
- {Home}[http://rubyworks.github.com/ansi] |
4
- {API}[http://rubydoc.info/gems/ansi/frames] |
5
- {Code}[http://github.com/rubyworks/ansi] |
3
+ {Home}[http://rubyworks.github.com/ansi] /
4
+ {API}[http://rubydoc.info/gems/ansi/frames] /
5
+ {Code}[http://github.com/rubyworks/ansi] /
6
6
  {Mail}[http://googlegroups.com/group/rubyworks-mailinglist]
7
7
 
8
8
  {<img src="http://travis-ci.org/rubyworks/ansi.png" />}[http://travis-ci.org/rubyworks/ansi]
@@ -27,6 +27,7 @@ device.
27
27
  * String#ansi makes common usage very easy and elegant.
28
28
  * ANSI::Mixin provides an alternative mixin (like +colored+ gem).
29
29
  * Very Good coverage of standard ANSI codes.
30
+ * Additional clases for colorized columns, tables, loggers and more.
30
31
 
31
32
 
32
33
  == RELEASE NOTES
@@ -58,7 +59,7 @@ The methods defined by this module are used throughout the rest of
58
59
  the system.
59
60
 
60
61
 
61
- == HOW TO INSTALL
62
+ == INSTALLATION
62
63
 
63
64
  To install with RubyGems simply open a console and type:
64
65
 
@@ -74,10 +75,13 @@ then download[http://github.com/rubyworks/ansi/download] the tarball package and
74
75
  Windows users use 'ruby setup.rb all'.
75
76
 
76
77
 
77
- == LICENSE & COPYRIGHT
78
+ == LICENSE & COPYRIGHTS
78
79
 
79
80
  Copyright (c) 2009 Rubyworks
80
81
 
81
- This program is distributed under the terms of the BSD 2-clause license.
82
+ This program is redistributable under the terms of the *FreeBSD* license.
83
+
84
+ Some pieces of the code are copyrighted by others.
85
+
86
+ See COPYING.rdoc file for details.
82
87
 
83
- See NOTICE.rdoc file and LICENSE directory for details.
@@ -1,3 +1,7 @@
1
+ # ANSI namespace module contains all the ANSI related classes.
2
+ module ANSI
3
+ end
4
+
1
5
  require 'ansi/version'
2
6
  require 'ansi/core'
3
7
  require 'ansi/code'
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  source:
3
- - meta
3
+ - var
4
4
  authors:
5
5
  - name: Thomas Sawyer
6
6
  email: transfire@gmail.com
@@ -41,13 +41,15 @@ revision: 0
41
41
  created: '2009-08-01'
42
42
  summary: ANSI at your fingertips!
43
43
  title: ANSI
44
- version: 1.4.1
44
+ version: 1.4.2
45
45
  name: ansi
46
- description: ! 'The ANSI project is a collection of ANSI escape code related libraries
47
- enabling
46
+ description: ! 'The ANSI project is a superlative collection of ANSI escape code related
47
+ libraries
48
48
 
49
- ANSI code based colorization and stylization of output. It is very nice for
49
+ enabling ANSI colorization and stylization of console output. Byte for byte
50
50
 
51
- beautifying shell output.'
51
+ ANSI is the best ANSI code library available for the Ruby programming
52
+
53
+ language.'
52
54
  organization: Rubyworks
53
- date: '2011-11-09'
55
+ date: '2012-01-29'