color_echo 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +55 -32
- data/lib/color_echo/variables.rb +12 -4
- data/lib/color_echo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7d3a8d427f0500c579883ec1383e41f925a3d29
|
4
|
+
data.tar.gz: fe121aaf4ccf3b4e47df7c416c8a6629b0b9798c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b37774a01401322360023eba2f8af2fa1a48a0982eb6ae14c0ec96f8567b0351605ac0ccca55cf1af1f9ebbdc5eee55bb1ed9da2b1f8f127b991b1e16780a70
|
7
|
+
data.tar.gz: ad2b93edfe490738e6e73e3a26372df536a73c7b1328410176a38e60c951c2cfa759798759f22925838dd22a529b60ee1b8c7802fa971d23c38aa715f5bde2ac
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ To add color to the command line output.
|
|
3
3
|
This Library will extend the Kernel module's functions(#print, #puts, #p).
|
4
4
|
required StringIO.
|
5
5
|
|
6
|
-
Version: 0.2.
|
6
|
+
Version: 0.2.3
|
7
7
|
Compliant Rubys Version: 1.9.3, 2.0.0, 2.1.0 (for Linux)
|
8
8
|
License: MIT
|
9
9
|
Gems repository: http://rubygems.org/gems/color_echo
|
@@ -23,7 +23,7 @@ Or install it yourself as:
|
|
23
23
|
### module functions
|
24
24
|
#### CE.ch_fg :symbol
|
25
25
|
Change the foreground color to the your specified color.
|
26
|
-
Alias is,
|
26
|
+
Alias is, fg
|
27
27
|
This method alias is available in version 0.2.0 on and after.
|
28
28
|
|
29
29
|
* symbol list:
|
@@ -40,7 +40,7 @@ ex.) CE.ch_fg :red #=> foreground color will be changed red
|
|
40
40
|
|
41
41
|
#### CE.ch_bg :symbol
|
42
42
|
Change the background color to the your specified color.
|
43
|
-
Alias is,
|
43
|
+
Alias is, bg
|
44
44
|
This method alias is available in version 0.2.0 on and after.
|
45
45
|
|
46
46
|
|
@@ -67,10 +67,9 @@ Change the text attribute to the your specified decoration.
|
|
67
67
|
* concealed
|
68
68
|
|
69
69
|
ex.) CE.ch_tx :blink #=> text blink on
|
70
|
-
Alias is,
|
70
|
+
Alias is, tx
|
71
71
|
This method alias is available in version 0.2.0 on and after.
|
72
72
|
|
73
|
-
|
74
73
|
#### CE.ch :foreground [,:background [,:text_attribute]]
|
75
74
|
Change collectively.
|
76
75
|
This method is available in version 0.1.0 on and after.
|
@@ -78,7 +77,7 @@ ex.) CE.ch :white, :green
|
|
78
77
|
|
79
78
|
#### CE.reset
|
80
79
|
Reset to set the color sequence.
|
81
|
-
Alias is,
|
80
|
+
Alias is, off, disable
|
82
81
|
This method alias is available in version 0.1.0 on and after.
|
83
82
|
|
84
83
|
#### CE.unuse
|
@@ -86,65 +85,89 @@ Force ignore the function of this library.
|
|
86
85
|
This method is available in version 0.1.0 on and after.
|
87
86
|
|
88
87
|
#### CE.rainbow
|
89
|
-
|
88
|
+
Text color will change to rainbow color.
|
89
|
+
String Object only.
|
90
|
+
Non-string object is excluded.
|
90
91
|
This method is available in version 0.2.0 on and after.
|
91
92
|
|
92
93
|
### Example
|
93
|
-
|
94
|
+
```ruby
|
94
95
|
#
|
95
96
|
# Example Code
|
96
97
|
#
|
97
98
|
require "color_echo"
|
98
99
|
|
99
100
|
# force ignore the function of this library
|
100
|
-
#CE
|
101
|
+
#CE.unuse
|
101
102
|
|
102
103
|
CE.ch :yellow
|
103
104
|
puts "fooooooooo"
|
104
105
|
puts "baaaaaaaar"
|
106
|
+
puts "AAAAA", "BBBBB", "CCCCC"
|
105
107
|
|
106
108
|
CE.ch :white, :red
|
107
|
-
print "
|
109
|
+
print "fooooooooo"
|
110
|
+
print "baaaaaaaar"
|
111
|
+
print "AAAAA", "BBBBB", "CCCCC"
|
112
|
+
|
113
|
+
CE.ch :black, :magenta, :underscore
|
114
|
+
p "fooooooooo"
|
115
|
+
p "baaaaaaaar"
|
116
|
+
p "AAAAA", "BBBBB", "CCCCC"
|
108
117
|
|
109
|
-
CE.ch :black, :cyan, :underscore
|
110
118
|
ary = ["Duis", "aute", "irure", "dolor", "in", "reprehenderit", "in", "voluptate"]
|
111
|
-
p ary
|
112
|
-
print ary
|
113
119
|
|
114
120
|
CE.off
|
121
|
+
puts "turn off all colors and attribute."
|
115
122
|
|
116
|
-
CE.fg :
|
117
|
-
|
123
|
+
CE.fg :red
|
124
|
+
puts ary
|
118
125
|
|
119
|
-
CE.bg :
|
126
|
+
CE.bg :cyan
|
120
127
|
print ary
|
121
128
|
|
122
|
-
CE.reset
|
123
|
-
puts "hogehoge"
|
124
|
-
|
125
129
|
CE.tx :underscore
|
126
|
-
|
130
|
+
p ary
|
127
131
|
|
128
132
|
CE.ch :black, :white, :blink
|
129
|
-
puts
|
133
|
+
puts <<EOM
|
130
134
|
Lorem ipsum dolor sit amet,
|
131
135
|
consectetur adipisicing elit,
|
132
136
|
sed do eiusmod tempor incididunt
|
133
|
-
ut labore et dolore magna aliqua.
|
137
|
+
ut labore et dolore magna aliqua.
|
134
138
|
EOM
|
135
139
|
|
136
140
|
CE.rainbow
|
137
|
-
puts "
|
138
|
-
puts
|
139
|
-
puts "
|
141
|
+
puts "fooooooooo"
|
142
|
+
puts "baaaaaaaar"
|
143
|
+
puts "AAAAA", "BBBBB", "CCCCC"
|
144
|
+
puts ary
|
140
145
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
146
|
+
print "fooooooooo"
|
147
|
+
print "baaaaaaaar"
|
148
|
+
print "AAAAA", "BBBBB", "CCCCC"
|
149
|
+
print ary
|
150
|
+
|
151
|
+
p "fooooooooo"
|
152
|
+
p "baaaaaaaar"
|
153
|
+
p "AAAAA", "BBBBB", "CCCCC"
|
154
|
+
p ary
|
155
|
+
|
156
|
+
puts <<EOM
|
157
|
+
Lorem ipsum dolor sit amet,
|
158
|
+
consectetur adipisicing elit,
|
159
|
+
sed do eiusmod tempor incididunt
|
160
|
+
ut labore et dolore magna aliqua.
|
161
|
+
EOM
|
147
162
|
|
148
163
|
CE.off
|
149
164
|
puts "Disable rainbow mode."
|
150
|
-
|
165
|
+
```
|
166
|
+
|
167
|
+
#### Result
|
168
|
+
|
169
|
+
![screen shot](/images/screenshot.png)
|
170
|
+
|
171
|
+
|
172
|
+
## Release Note
|
173
|
+
* v0.2.3, 2014-12-02, Fixed small bugs.
|
data/lib/color_echo/variables.rb
CHANGED
@@ -13,10 +13,18 @@ module CE
|
|
13
13
|
@@task = lambda do |*arg|
|
14
14
|
if available?
|
15
15
|
if @@rainbow && arg.first.instance_of?(String)
|
16
|
-
|
16
|
+
# change output destination to StringIO Object
|
17
|
+
strio = StringIO.new
|
18
|
+
$stdout = strio
|
17
19
|
|
18
20
|
# call original method
|
19
|
-
eval("@@#{caller_locations(2).first.label}").call(arg)
|
21
|
+
eval("@@#{caller_locations(2).first.label}").call(*arg)
|
22
|
+
|
23
|
+
# change output destination to STDOUT
|
24
|
+
$stdout = STDOUT
|
25
|
+
|
26
|
+
# output to STDOUT
|
27
|
+
$stdout.print add_rainbow(strio.string)
|
20
28
|
|
21
29
|
else
|
22
30
|
# change output destination to StringIO Object
|
@@ -27,7 +35,7 @@ module CE
|
|
27
35
|
$stdout.print get_start_code
|
28
36
|
|
29
37
|
# call original method
|
30
|
-
eval("@@#{caller_locations(2).first.label}").call(arg)
|
38
|
+
eval("@@#{caller_locations(2).first.label}").call(*arg)
|
31
39
|
|
32
40
|
# change output destination to STDOUT
|
33
41
|
$stdout = STDOUT
|
@@ -39,7 +47,7 @@ module CE
|
|
39
47
|
# no available "color echo"
|
40
48
|
else
|
41
49
|
# call original method
|
42
|
-
eval("@@#{caller_locations(2).first.label}").call(arg)
|
50
|
+
eval("@@#{caller_locations(2).first.label}").call(*arg)
|
43
51
|
end
|
44
52
|
end
|
45
53
|
end
|
data/lib/color_echo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: color_echo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nyanko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'To add color to the command line output.This Library will extend the
|
14
14
|
Kernel module''s functions(#print, #puts, #p). required StringIO.'
|