ansi 1.1.0 → 1.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/LICENSE +23 -0
- data/README.rdoc +85 -0
- data/Syckfile +77 -0
- data/lib/ansi/code.rb +239 -105
- data/lib/ansi/mixin.rb +113 -0
- data/lib/ansi/progressbar.rb +228 -220
- data/lib/ansi/string.rb +7 -5
- data/lib/ansi/terminal.rb +4 -3
- data/meta/{project → collection} +0 -0
- data/meta/copyright +1 -0
- data/meta/description +1 -0
- data/meta/{package → name} +0 -0
- data/meta/released +1 -1
- data/meta/sites/development +1 -0
- data/meta/sites/documentation +1 -0
- data/meta/{homepage → sites/homepage} +0 -0
- data/meta/sites/mailinglist +1 -0
- data/meta/{repository → sites/repository} +0 -0
- data/meta/version +1 -1
- data/test/test_ansicode.rb +2 -2
- data/test/test_bbcode.rb +2 -2
- metadata +30 -35
- data/COPYING +0 -789
- data/MANIFEST +0 -39
- data/README +0 -72
- data/demo/logger.rd +0 -31
- data/demo/progressbar.rd +0 -63
- data/meta/abstract +0 -3
data/MANIFEST
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
#!mast bin demo lib meta test [A-Z]*
|
2
|
-
demo
|
3
|
-
demo/logger.rd
|
4
|
-
demo/progressbar.rd
|
5
|
-
lib
|
6
|
-
lib/ansi
|
7
|
-
lib/ansi/bbcode.rb
|
8
|
-
lib/ansi/code.rb
|
9
|
-
lib/ansi/logger.rb
|
10
|
-
lib/ansi/progressbar.rb
|
11
|
-
lib/ansi/string.rb
|
12
|
-
lib/ansi/terminal
|
13
|
-
lib/ansi/terminal/curses.rb
|
14
|
-
lib/ansi/terminal/stty.rb
|
15
|
-
lib/ansi/terminal/termios.rb
|
16
|
-
lib/ansi/terminal/win32.rb
|
17
|
-
lib/ansi/terminal.rb
|
18
|
-
lib/ansi.rb
|
19
|
-
meta
|
20
|
-
meta/abstract
|
21
|
-
meta/authors
|
22
|
-
meta/created
|
23
|
-
meta/homepage
|
24
|
-
meta/license
|
25
|
-
meta/package
|
26
|
-
meta/project
|
27
|
-
meta/released
|
28
|
-
meta/repository
|
29
|
-
meta/ruby
|
30
|
-
meta/summary
|
31
|
-
meta/title
|
32
|
-
meta/version
|
33
|
-
test
|
34
|
-
test/test_ansicode.rb
|
35
|
-
test/test_bbcode.rb
|
36
|
-
test/test_progressbar.rb
|
37
|
-
README
|
38
|
-
HISTORY
|
39
|
-
COPYING
|
data/README
DELETED
@@ -1,72 +0,0 @@
|
|
1
|
-
= ANSI
|
2
|
-
|
3
|
-
* http://rubyworks.github.com/ansi
|
4
|
-
* http://github.com/rubyworks/ansi
|
5
|
-
|
6
|
-
|
7
|
-
== DESCRIPTION
|
8
|
-
|
9
|
-
The ANSI project is a collection of ANSI code related libraries
|
10
|
-
enabling ANSI code based colorization and stylization of output.
|
11
|
-
It is very nice for beautifying shell output.
|
12
|
-
|
13
|
-
This collection is based on a set of scripts spun-off from
|
14
|
-
Ruby Facets. Include are Code (used to be ANSICode), Logger,
|
15
|
-
Progressbar and String. In addition the library include
|
16
|
-
Terminal which provides information about the current output
|
17
|
-
device.
|
18
|
-
|
19
|
-
|
20
|
-
== FEATURES/ISSUES
|
21
|
-
|
22
|
-
* ANSI::Code can be used as a mixin or as module functions.
|
23
|
-
* Good coverage of standard ANSI codes.
|
24
|
-
* Windows support needs some TLC :(
|
25
|
-
|
26
|
-
|
27
|
-
== RELEASE NOTES
|
28
|
-
|
29
|
-
Please see HISTORY file.
|
30
|
-
|
31
|
-
|
32
|
-
== SYNOPSIS
|
33
|
-
|
34
|
-
The ANSI::Code module defines ANSI codes as methods.
|
35
|
-
|
36
|
-
include ANSICode
|
37
|
-
|
38
|
-
p red, "Hello", blue, "World"
|
39
|
-
=> "\e[31mHello\e[34mWorld"
|
40
|
-
|
41
|
-
p red { "Hello" } + blue { "World" }
|
42
|
-
=> "\e[31mHello\e[0m\e[34mWorld\e[0m"
|
43
|
-
|
44
|
-
Thes mehods can also be called as module methods, eg. 'ANSI::Code.red'.
|
45
|
-
|
46
|
-
Please see the online documentation for more information on using
|
47
|
-
the other libraries.
|
48
|
-
|
49
|
-
|
50
|
-
== HOW TO INSTALL
|
51
|
-
|
52
|
-
To install with RubyGems simply open a console and type:
|
53
|
-
|
54
|
-
gem install ansi
|
55
|
-
|
56
|
-
Local installation requires Setup.rb (gem install setup),
|
57
|
-
then download the tarball package and type:
|
58
|
-
|
59
|
-
tar -xvzf ansi-1.0.0.tgz
|
60
|
-
cd ansi-1.0.0
|
61
|
-
sudo setup.rb all
|
62
|
-
|
63
|
-
Windows users use 'ruby setup.rb all'.
|
64
|
-
|
65
|
-
|
66
|
-
== LICENSE/COPYRIGHT
|
67
|
-
|
68
|
-
Copyright (c) 2004 Coding Dead
|
69
|
-
|
70
|
-
This program is ditributed unser the terms of the LGPLv3 license.
|
71
|
-
|
72
|
-
See LICENSE file for details.
|
data/demo/logger.rd
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
= ANSI::Logger
|
2
|
-
|
3
|
-
Require the ANSI::Logger library.
|
4
|
-
|
5
|
-
require 'ansi/logger'
|
6
|
-
|
7
|
-
Create a new ANSI::Logger
|
8
|
-
|
9
|
-
log = ANSI::Logger.new(STDOUT)
|
10
|
-
|
11
|
-
Info logging appears normal.
|
12
|
-
|
13
|
-
log.info{"Info logs are green.\n"}
|
14
|
-
|
15
|
-
Warn logging appears yellow.
|
16
|
-
|
17
|
-
log.warn{"Warn logs are yellow.\n"}
|
18
|
-
|
19
|
-
Debug logging appears cyan.
|
20
|
-
|
21
|
-
log.debug{"Debug logs are cyan.\n"}
|
22
|
-
|
23
|
-
Error logging appears red.
|
24
|
-
|
25
|
-
log.error{"Error logs are red.\n"}
|
26
|
-
|
27
|
-
Fatal logging appears bright red.
|
28
|
-
|
29
|
-
log.fatal{"Fatal logs are bold red!\n"}
|
30
|
-
|
31
|
-
QED.
|
data/demo/progressbar.rd
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
= ANSI::Progressbar
|
2
|
-
|
3
|
-
Pretty progress bars are easy to construct.
|
4
|
-
|
5
|
-
require 'ansi/progressbar'
|
6
|
-
|
7
|
-
pbar = ANSI::Progressbar.new("Test Bar", 100)
|
8
|
-
|
9
|
-
Running the bar simply requires calling the #inc method during
|
10
|
-
a loop and calling #finish when done.
|
11
|
-
|
12
|
-
100.times do |i|
|
13
|
-
sleep 0.01
|
14
|
-
pbar.inc
|
15
|
-
end
|
16
|
-
pbar.finish
|
17
|
-
|
18
|
-
We will use this same rountine in all the examples below, so lets
|
19
|
-
make a quick macro for it. Notice we have to use #reset first
|
20
|
-
before reusing the same progress bar.
|
21
|
-
|
22
|
-
def run(pbar)
|
23
|
-
pbar.reset
|
24
|
-
100.times do |i|
|
25
|
-
sleep 0.01
|
26
|
-
pbar.inc
|
27
|
-
end
|
28
|
-
pbar.finish
|
29
|
-
puts
|
30
|
-
end
|
31
|
-
|
32
|
-
The progress bar can be stylized in almost any way.
|
33
|
-
The #format setter provides control over the parts
|
34
|
-
that appear on the line. FOr example, by default the
|
35
|
-
format is:
|
36
|
-
|
37
|
-
pbar.format("%-14s %3d%% %s %s", :title, :percentage, :bar, :stat)
|
38
|
-
|
39
|
-
So lets vary it up to demonstrate the case.
|
40
|
-
|
41
|
-
pbar.format("%-14s %3d%% %s %s", :title, :percentage, :stat, :bar)
|
42
|
-
run(pbar)
|
43
|
-
|
44
|
-
The progress bar has an extra build in format intended for use with
|
45
|
-
file downloads called #transer_mode.
|
46
|
-
|
47
|
-
pbar.transfer_mode
|
48
|
-
run(pbar)
|
49
|
-
|
50
|
-
Calling this methods is the same as calling:
|
51
|
-
|
52
|
-
pbar.format("%-14s %3d%% %s %s",:title, :percentage, :bar, :stat_for_file_transfer)
|
53
|
-
run(pbar)
|
54
|
-
|
55
|
-
The #style setter allows each part of the line be modified with ANSI codes. And the
|
56
|
-
#bar_mark writer can be used to change the character used to make the bar.
|
57
|
-
|
58
|
-
pbar.standard_mode
|
59
|
-
pbar.style(:title => [:red], :bar=>[:blue])
|
60
|
-
pbar.bar_mark = "="
|
61
|
-
run(pbar)
|
62
|
-
|
63
|
-
QED.
|
data/meta/abstract
DELETED