colorize 0.5.8 → 0.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.
- checksums.yaml +15 -0
- data/CHANGELOG.rdoc +11 -3
- data/README.rdoc +6 -8
- data/Rakefile +5 -14
- data/colorize.gemspec +17 -33
- data/lib/colorize.rb +6 -16
- metadata +30 -38
- data/.gitignore +0 -6
- data/VERSION +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YjYzYzBlYzk3MmQyNzgxYzRkYjFhNGMxNDJlYTZkNDUzYWYwMzA5OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MmEwNzhjMmQ5NTIwNjVlYjQzMTQxMzYwZmM1MzMxZGJkMDY5MzQzNA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTQ2NjJhYWUyMjUzYTc4MzAzMWRmY2IyNGExYTA1YzU4NWFiYzk5OGFmZDFl
|
10
|
+
Y2UzNmI1Y2MyYTE5OTMzYjA5MjJkZWNjZWIzMzE1OGQ1YzE3MjgwYWM5NjE0
|
11
|
+
NzY0ODQyNmMzMGM3YTRlMDg3MGY3ODJiNzdmYjA1NGRhYmNmYWY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YmJjODAxOTZjNTMzMTY1OTRmMTE0YWNhYTMzMGVjYjU3NjQ1OGJkNzUzZjY1
|
14
|
+
M2IxYzg0MzVjMWEzM2ZhNWUyNWNhMDEyYzBiMGZiMjM1MTk2MmQ4MTU1NWZi
|
15
|
+
ZWNlZDkyOGEzYjVlMDRlMGM5YjVlMDYyMDk5OWFkZGZjOGUyNzM=
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,10 +1,18 @@
|
|
1
|
+
== 0.6.0 / 2013-09-25
|
2
|
+
* code cleanups
|
3
|
+
* bold mode fixed
|
4
|
+
* STDOUT.isatty condition removed
|
5
|
+
* doc updated
|
6
|
+
* jeweler tasks removed
|
7
|
+
* Rakefile updated
|
8
|
+
|
1
9
|
== 0.5.8 / 2009-12-02
|
2
10
|
* code cleanups
|
3
11
|
* removed 'ruby -w' warnings
|
4
12
|
|
5
13
|
== 0.5.7 / 2009-11-24
|
6
14
|
* moved to github/gemcutter
|
7
|
-
* 1.9
|
15
|
+
* 1.9 compatible
|
8
16
|
|
9
17
|
== 0.5.6 / 2007-08-27
|
10
18
|
* rdocs Allison template
|
@@ -12,8 +20,8 @@
|
|
12
20
|
|
13
21
|
== 0.5.5 / 2007-08-11
|
14
22
|
* added effects methods
|
15
|
-
*
|
23
|
+
* README files
|
16
24
|
* new rake file
|
17
25
|
|
18
26
|
== 0.5.0 / 2007-04-22
|
19
|
-
* initial
|
27
|
+
* initial rewritten version
|
data/README.rdoc
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
== colorize
|
2
|
-
http://colorize.rubyforge.org
|
3
|
-
http://fazibear.prv.pl
|
4
|
-
|
5
1
|
== DESCRIPTION:
|
6
2
|
|
7
|
-
Ruby
|
3
|
+
Ruby String class extension. Adds methods to set text color, background color and, text effects on ruby console and command line output, using ANSI escape sequences.
|
8
4
|
|
9
5
|
== FEATURES/PROBLEMS:
|
10
6
|
|
@@ -40,11 +36,13 @@ Ruby string class extension. It add some methods to set color, background color
|
|
40
36
|
|
41
37
|
== INSTALL:
|
42
38
|
|
43
|
-
*
|
39
|
+
* gem install colorize
|
40
|
+
|
41
|
+
*Note:* You may need to use sudo to install gems
|
44
42
|
|
45
43
|
== LICENSE:
|
46
44
|
|
47
|
-
colorize - Ruby
|
45
|
+
colorize - Ruby String class extension. Adds methods to set text color, background color and, text effects on ruby console and command line output, using ANSI escape sequences.
|
48
46
|
|
49
47
|
Copyright (C) 2007 Michal Kalbarczyk
|
50
48
|
|
@@ -52,4 +50,4 @@ This program is free software; you can redistribute it and/or modify it under th
|
|
52
50
|
|
53
51
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
54
52
|
|
55
|
-
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation,
|
53
|
+
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335, USA
|
data/Rakefile
CHANGED
@@ -1,17 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
require 'rake'
|
1
|
+
require 'rake/testtask'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
Jeweler::Tasks.new do |gemspec|
|
7
|
-
gemspec.name = "colorize"
|
8
|
-
gemspec.summary = "Add colors methods to string class"
|
9
|
-
gemspec.email = "fazibear@gmail.com"
|
10
|
-
gemspec.homepage = "http://github.com/fazibear/colorize"
|
11
|
-
gemspec.description = "Ruby string class extension. It add some methods to set color, background color and text effect on console easier. Uses ANSI escape sequences."
|
12
|
-
gemspec.authors = ["fazibear"]
|
13
|
-
end
|
14
|
-
rescue LoadError
|
15
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
3
|
+
Rake::TestTask.new do |t|
|
4
|
+
t.libs << 'test'
|
16
5
|
end
|
17
6
|
|
7
|
+
desc "Run tests"
|
8
|
+
task :default => :test
|
data/colorize.gemspec
CHANGED
@@ -1,49 +1,33 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
1
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.
|
2
|
+
s.name = "colorize"
|
3
|
+
s.version = "0.6.0"
|
9
4
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
5
|
s.authors = ["fazibear"]
|
12
|
-
s.
|
13
|
-
|
14
|
-
s.
|
15
|
-
|
16
|
-
|
17
|
-
|
6
|
+
s.email = "fazibear@gmail.com"
|
7
|
+
|
8
|
+
s.date = "2012-09-15"
|
9
|
+
|
10
|
+
s.homepage = "http://github.com/fazibear/colorize"
|
11
|
+
s.description = "Ruby String class extension. Adds methods to set text color, background color and, text effects on ruby console and command line output, using ANSI escape sequences."
|
12
|
+
s.summary = "Add color methods to String class"
|
13
|
+
s.license = 'GPL'
|
14
|
+
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
|
18
17
|
s.files = [
|
19
|
-
".gitignore",
|
20
18
|
"CHANGELOG.rdoc",
|
21
19
|
"README.rdoc",
|
22
20
|
"Rakefile",
|
23
|
-
"VERSION",
|
24
21
|
"colorize.gemspec",
|
25
22
|
"lib/colorize.rb",
|
26
23
|
"test/test_colorize.rb",
|
27
24
|
"test/test_helper.rb"
|
28
25
|
]
|
29
|
-
s.homepage = %q{http://github.com/fazibear/colorize}
|
30
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
31
|
-
s.require_paths = ["lib"]
|
32
|
-
s.rubygems_version = %q{1.3.5}
|
33
|
-
s.summary = %q{Add colors methods to string class}
|
34
26
|
s.test_files = [
|
35
27
|
"test/test_helper.rb",
|
36
|
-
|
28
|
+
"test/test_colorize.rb"
|
29
|
+
]
|
30
|
+
s.extra_rdoc_files = [
|
31
|
+
"README.rdoc"
|
37
32
|
]
|
38
|
-
|
39
|
-
if s.respond_to? :specification_version then
|
40
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
41
|
-
s.specification_version = 3
|
42
|
-
|
43
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
44
|
-
else
|
45
|
-
end
|
46
|
-
else
|
47
|
-
end
|
48
33
|
end
|
49
|
-
|
data/lib/colorize.rb
CHANGED
@@ -32,7 +32,7 @@ class String
|
|
32
32
|
#
|
33
33
|
MODES = {
|
34
34
|
:default => 0, # Turn off all attributes
|
35
|
-
|
35
|
+
:bold => 1, # Set bold mode
|
36
36
|
:underline => 4, # Set underline mode
|
37
37
|
:blink => 5, # Set blink mode
|
38
38
|
:swap => 7, # Exchange foreground and background colors
|
@@ -42,7 +42,7 @@ class String
|
|
42
42
|
protected
|
43
43
|
|
44
44
|
#
|
45
|
-
# Set color values in new string
|
45
|
+
# Set color values in new string instance
|
46
46
|
#
|
47
47
|
def set_color_parameters( params )
|
48
48
|
if (params.instance_of?(Hash))
|
@@ -75,8 +75,6 @@ class String
|
|
75
75
|
# puts "This is uncolorized".blue.on_red.uncolorize
|
76
76
|
#
|
77
77
|
def colorize( params )
|
78
|
-
return self unless STDOUT.isatty
|
79
|
-
|
80
78
|
begin
|
81
79
|
require 'Win32/Console/ANSI' if RUBY_PLATFORM =~ /win32/
|
82
80
|
rescue LoadError
|
@@ -99,7 +97,7 @@ class String
|
|
99
97
|
|
100
98
|
color_parameters[:uncolorized] ||= @uncolorized ||= self.dup
|
101
99
|
|
102
|
-
#
|
100
|
+
# Calculate bright mode
|
103
101
|
color_parameters[:color] += 50 if color_parameters[:color] > 10
|
104
102
|
|
105
103
|
color_parameters[:background] += 50 if color_parameters[:background] > 10
|
@@ -153,26 +151,18 @@ class String
|
|
153
151
|
# Return array of available modes used by colorize method
|
154
152
|
#
|
155
153
|
def modes
|
156
|
-
keys
|
157
|
-
MODES.each_key do | key |
|
158
|
-
keys << key
|
159
|
-
end
|
160
|
-
keys
|
154
|
+
MODES.keys
|
161
155
|
end
|
162
156
|
|
163
157
|
#
|
164
158
|
# Return array of available colors used by colorize method
|
165
159
|
#
|
166
160
|
def colors
|
167
|
-
keys
|
168
|
-
COLORS.each_key do | key |
|
169
|
-
keys << key
|
170
|
-
end
|
171
|
-
keys
|
161
|
+
COLORS.keys
|
172
162
|
end
|
173
163
|
|
174
164
|
#
|
175
|
-
# Display color matrix with color names
|
165
|
+
# Display color matrix with color names
|
176
166
|
#
|
177
167
|
def color_matrix( txt = "[X]" )
|
178
168
|
size = String.colors.length
|
metadata
CHANGED
@@ -1,64 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: colorize
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
|
-
authors:
|
6
|
+
authors:
|
7
7
|
- fazibear
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
|
12
|
-
date: 2009-12-02 00:00:00 +01:00
|
13
|
-
default_executable:
|
11
|
+
date: 2012-09-15 00:00:00.000000000 Z
|
14
12
|
dependencies: []
|
15
|
-
|
16
|
-
|
13
|
+
description: Ruby String class extension. Adds methods to set text color, background
|
14
|
+
color and, text effects on ruby console and command line output, using ANSI escape
|
15
|
+
sequences.
|
17
16
|
email: fazibear@gmail.com
|
18
17
|
executables: []
|
19
|
-
|
20
18
|
extensions: []
|
21
|
-
|
22
|
-
extra_rdoc_files:
|
19
|
+
extra_rdoc_files:
|
23
20
|
- README.rdoc
|
24
|
-
files:
|
25
|
-
- .gitignore
|
21
|
+
files:
|
26
22
|
- CHANGELOG.rdoc
|
27
23
|
- README.rdoc
|
28
24
|
- Rakefile
|
29
|
-
- VERSION
|
30
25
|
- colorize.gemspec
|
31
26
|
- lib/colorize.rb
|
32
27
|
- test/test_colorize.rb
|
33
28
|
- test/test_helper.rb
|
34
|
-
has_rdoc: true
|
35
29
|
homepage: http://github.com/fazibear/colorize
|
36
|
-
licenses:
|
37
|
-
|
30
|
+
licenses:
|
31
|
+
- GPL
|
32
|
+
metadata: {}
|
38
33
|
post_install_message:
|
39
|
-
rdoc_options:
|
40
|
-
|
41
|
-
require_paths:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
42
36
|
- lib
|
43
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version:
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
version: "0"
|
54
|
-
version:
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
55
47
|
requirements: []
|
56
|
-
|
57
48
|
rubyforge_project:
|
58
|
-
rubygems_version: 1.
|
49
|
+
rubygems_version: 2.1.4
|
59
50
|
signing_key:
|
60
|
-
specification_version:
|
61
|
-
summary: Add
|
62
|
-
test_files:
|
51
|
+
specification_version: 4
|
52
|
+
summary: Add color methods to String class
|
53
|
+
test_files:
|
63
54
|
- test/test_helper.rb
|
64
55
|
- test/test_colorize.rb
|
56
|
+
has_rdoc:
|
data/.gitignore
DELETED
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.5.8
|