ansi 1.4.3 → 1.6.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/demo/09_diff.rdoc DELETED
@@ -1,47 +0,0 @@
1
- = ANSI::Diff
2
-
3
- require 'ansi/diff'
4
-
5
- a = 'abcYefg'
6
- b = 'abcXefg'
7
-
8
- diff = ANSI::Diff.new(a,b)
9
-
10
- diff.to_s.assert == "\e[31mabc\e[0m\e[33mYefg\e[0m\n\e[31mabc\e[0mXefg"
11
-
12
- Try another.
13
-
14
- a = 'abc'
15
- b = 'abcdef'
16
-
17
- diff = ANSI::Diff.new(a,b)
18
-
19
- diff.to_s.assert == "\e[31mabc\e[0m\n\e[31mabc\e[0mdef"
20
-
21
- And another.
22
-
23
- a = 'abcXXXghi'
24
- b = 'abcdefghi'
25
-
26
- diff = ANSI::Diff.new(a,b)
27
-
28
- diff.to_s.assert == "\e[31mabc\e[0m\e[33mXXXghi\e[0m\n\e[31mabc\e[0mdefghi"
29
-
30
- And another.
31
-
32
- a = 'abcXXXdefghi'
33
- b = 'abcdefghi'
34
-
35
- diff = ANSI::Diff.new(a,b)
36
-
37
- 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"
38
-
39
- Comparison that is mostly different.
40
-
41
- a = 'abcpppz123'
42
- b = 'abcxyzzz43'
43
-
44
- diff = ANSI::Diff.new(a,b)
45
-
46
- diff.to_s.assert == "\e[31mabc\e[0m\e[33mpppz123\e[0m\n\e[31mabc\e[0mxyzzz43"
47
-
data/demo/10_bbcode.rdoc DELETED
@@ -1,24 +0,0 @@
1
- = ANSI::BBCode
2
-
3
- The BBCode module provides methods for converting between
4
- BBCodes, basic HTML and ANSI codes.
5
-
6
- require 'ansi/bbcode'
7
-
8
- BBCodes are color and style codes in square brackets, quite
9
- popular with on line forums.
10
-
11
- bbcode = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"
12
-
13
- We can convert this to ANSI code simply enough:
14
-
15
- ansi = ANSI::BBCode.bbcode_to_ansi(bbcode)
16
-
17
- ansi.assert == "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n"
18
-
19
- In addition the BBCode module supports conversion to simple HTML.
20
-
21
- html = ANSI::BBCode.bbcode_to_html(bbcode)
22
-
23
- html.assert == "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n"
24
-
@@ -1,8 +0,0 @@
1
- = ANSI::Terminal
2
-
3
- We should be ables to get the terminal width via the `terminal_width` method.
4
-
5
- width = ANSI::Terminal.terminal_width
6
-
7
- Fixnum.assert === width
8
-
data/lib/ansi.yml DELETED
@@ -1,63 +0,0 @@
1
- ---
2
- source:
3
- - var
4
- authors:
5
- - name: Thomas Sawyer
6
- email: transfire@gmail.com
7
- - name: Florian Frank
8
- copyrights:
9
- - holder: Rubyworks
10
- year: '2009'
11
- requirements:
12
- - name: detroit
13
- groups:
14
- - build
15
- development: true
16
- - name: qed
17
- groups:
18
- - test
19
- development: true
20
- - name: lemon
21
- groups:
22
- - test
23
- development: true
24
- dependencies: []
25
- alternatives: []
26
- conflicts: []
27
- repositories:
28
- - uri: git://github.com/rubyworks/ansi.git
29
- scm: git
30
- name: upstream
31
- resources:
32
- - uri: http://rubyworks.github.com/ansi
33
- label: Website
34
- type: home
35
- - uri: http://github.com/rubyworks/ansi
36
- label: Source Code
37
- type: code
38
- - uri: http://rubydoc.info/gems/ansi/frames
39
- label: Documentation
40
- type: docs
41
- - uri: http://groups.google.com/group/rubyworks-mailinglist
42
- label: Mailing List
43
- type: mail
44
- categories: []
45
- extra: {}
46
- load_path:
47
- - lib
48
- revision: 0
49
- name: ansi
50
- title: ANSI
51
- created: '2009-08-01'
52
- summary: ANSI at your fingertips!
53
- description: ! 'The ANSI project is a superlative collection of ANSI escape code related
54
- libraries
55
-
56
- enabling ANSI colorization and stylization of console output. Byte for byte
57
-
58
- ANSI is the best ANSI code library available for the Ruby programming
59
-
60
- language.'
61
- organization: Rubyworks
62
- version: 1.4.3
63
- date: '2012-06-28'
@@ -1,31 +0,0 @@
1
- require 'test_helper'
2
- require 'ansi/code'
3
-
4
- testcase ANSI::Code do
5
-
6
- unit :red do
7
- str = ANSI::Code.red
8
- out = "\e[31m"
9
- out.assert == str
10
- end
11
-
12
- unit :red => "with block notation" do
13
- str = ANSI::Code.red { "Hello" }
14
- out = "\e[31mHello\e[0m"
15
- out.assert == str
16
- end
17
-
18
- unit :blue do
19
- str = ANSI::Code.blue
20
- out = "\e[34m"
21
- out.assert == str
22
- end
23
-
24
- unit :blue => "with block notation" do
25
- str = ANSI::Code.blue { "World" }
26
- out = "\e[34mWorld\e[0m"
27
- out.assert == str
28
- end
29
-
30
- end
31
-
data/test/case_bbcode.rb DELETED
@@ -1,35 +0,0 @@
1
- require 'test_helper'
2
- require 'ansi/bbcode'
3
-
4
- testcase ANSI::BBCode do
5
-
6
- class_method :bbcode_to_ansi do
7
- test do
8
- str = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"
9
- out = "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n"
10
- out.assert == ANSI::BBCode.bbcode_to_ansi(str)
11
- end
12
- end
13
-
14
- class_method :bbcode_to_html do
15
- test do
16
- str = "this is [COLOR=red]red[/COLOR], this is [B]bold[/B]"
17
- out = "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n"
18
- out.assert == ANSI::BBCode.bbcode_to_html(str)
19
- end
20
- end
21
-
22
- class_method :ansi_to_html do
23
- test do
24
- str = "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n" +
25
- "this is a line without any ansi code\n" +
26
- "this is \e[0;31mred\e[0m, this is \e[1mbold\e[0m\n"
27
- out = "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n" +
28
- "this is a line without any ansi code<br />\n" +
29
- "this is <font color=\"red\">red</font>, this is <strong>bold</strong><br />\n"
30
- out.assert == ANSI::BBCode.ansi_to_html(str)
31
- end
32
- end
33
-
34
- end
35
-
data/test/case_mixin.rb DELETED
@@ -1,29 +0,0 @@
1
- require 'test_helper'
2
- require 'ansi/mixin'
3
-
4
- testcase ANSI::Mixin do
5
-
6
- # TODO: subclass
7
- class ::String
8
- include ANSI::Mixin
9
- end
10
-
11
- unit :red do
12
- str = "Hello".red
13
- out = "\e[31mHello\e[0m"
14
- out.assert == str
15
- end
16
-
17
- unit :blue do
18
- str = "World".blue
19
- out = "\e[34mWorld\e[0m"
20
- out.assert == str
21
- end
22
-
23
- unit :display do
24
- str = "Hello".display(4,10)
25
- out = "\e[s\e[4;10HHello\e[u"
26
- out.assert == str
27
- end
28
-
29
- end
@@ -1,19 +0,0 @@
1
- require 'test_helper'
2
- require 'stringio'
3
- require 'ansi/progressbar'
4
-
5
- testcase ANSI::Progressbar do
6
-
7
- unit :initialize do
8
- stio = StringIO.new
9
- pbar = ANSI::Progressbar.new("Test Bar", 10, stio) do |b|
10
- b.style(:title => [:red], :bar=>[:blue])
11
- end
12
- 10.times do |i|
13
- sleep 0.1
14
- pbar.inc
15
- end
16
- true
17
- end
18
-
19
- end
data/test/test_helper.rb DELETED
@@ -1,3 +0,0 @@
1
- require 'lemon'
2
- require 'ae'
3
-