colorize 0.8.1 → 1.0.0.pre.pre.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,153 +1,128 @@
1
- require 'codeclimate-test-reporter'
2
- CodeClimate::TestReporter.start
1
+ # frozen_string_literal: true
3
2
 
4
3
  require 'minitest/autorun'
5
- require File.dirname(__FILE__) + '/../lib/colorize'
4
+ require "#{File.dirname(__FILE__)}/../lib/colorize"
6
5
 
7
6
  class TestColorize < Minitest::Test
8
7
  def test_blue_symbol
9
- assert_equal 'This is blue'.colorize(:blue),
10
- "\e[0;34;49mThis is blue\e[0m"
8
+ assert_equal "\001\033[0;34;49m\002This is blue\001\033[0m\002", 'This is blue'.colorize(:blue)
11
9
  end
12
10
 
13
11
  def test_incorrect_symbol
14
- assert_equal 'This is incorrect color'.colorize(:bold),
15
- "\e[0;39;49mThis is incorrect color\e[0m"
12
+ assert_equal "\001\033[0;39;49m\002This is incorrect color\001\033[0m\002", 'This is incorrect color'.colorize(:bold)
16
13
  end
17
14
 
18
15
  def test_incorrect_hash
19
- assert_equal 'This is incorrect color'.colorize(:color => :bold),
20
- "\e[0;39;49mThis is incorrect color\e[0m"
16
+ assert_equal "\001\033[0;39;49m\002This is incorrect color\001\033[0m\002", 'This is incorrect color'.colorize(:color => :bold)
21
17
 
22
- assert_equal 'This is incorrect color'.colorize(:mode => :green),
23
- "\e[0;39;49mThis is incorrect color\e[0m"
18
+ assert_equal "\001\033[0;39;49m\002This is incorrect color\001\033[0m\002", 'This is incorrect color'.colorize(:mode => :green)
24
19
 
25
- assert_equal 'This is incorrect color'.colorize(:background => :bold),
26
- "\e[0;39;49mThis is incorrect color\e[0m"
20
+ assert_equal "\001\033[0;39;49m\002This is incorrect color\001\033[0m\002", 'This is incorrect color'.colorize(:background => :bold)
27
21
  end
28
22
 
29
23
  def test_blue_hash
30
- assert_equal 'This is also blue'.colorize(:color => :blue),
31
- "\e[0;34;49mThis is also blue\e[0m"
24
+ assert_equal "\001\033[0;34;49m\002This is also blue\001\033[0m\002", 'This is also blue'.colorize(:color => :blue)
32
25
  end
33
26
 
34
27
  def test_light_blue_symbol
35
- assert_equal 'This is light blue'.colorize(:light_blue),
36
- "\e[0;94;49mThis is light blue\e[0m"
28
+ assert_equal "\001\033[0;94;49m\002This is light blue\001\033[0m\002", 'This is light blue'.colorize(:light_blue)
37
29
  end
38
30
 
39
31
  def test_light_blue_with_red_background_hash
40
- assert_equal 'This is light blue with red background'.colorize(:color => :light_blue, :background => :red),
41
- "\e[0;94;41mThis is light blue with red background\e[0m"
32
+ assert_equal "\001\033[0;94;41m\002This is light blue with red background\001\033[0m\002", 'This is light blue with red background'.colorize(:color => :light_blue, :background => :red)
42
33
  end
43
34
 
44
35
  def test_light_blue_with_red_background_symbol_and_hash
45
- assert_equal 'This is light blue with red background'.colorize(:light_blue).colorize(:background => :red),
46
- "\e[0;94;41mThis is light blue with red background\e[0m"
36
+ assert_equal "\001\033[0;94;41m\002This is light blue with red background\001\033[0m\002", 'This is light blue with red background'.colorize(:light_blue).colorize(:background => :red)
47
37
  end
48
38
 
49
39
  def test_blue_with_red_background_method
50
- assert_equal 'This is blue text on red'.blue.on_red,
51
- "\e[0;34;41mThis is blue text on red\e[0m"
40
+ assert_equal "\001\033[0;34;41m\002This is blue text on red\001\033[0m\002", 'This is blue text on red'.blue.on_red
52
41
  end
53
42
 
54
43
  def test_red_with_blue_background_symbol_and_method
55
- assert_equal 'This is red on blue'.colorize(:red).on_blue,
56
- "\e[0;31;44mThis is red on blue\e[0m"
44
+ assert_equal "\001\033[0;31;44m\002This is red on blue\001\033[0m\002", 'This is red on blue'.colorize(:red).on_blue
57
45
  end
58
46
 
59
- def test_red_with_blue_background_and_underline_sumbol_and_methods
60
- assert_equal 'This is red on blue and underline'.colorize(:red).on_blue.underline,
61
- "\e[4;31;44mThis is red on blue and underline\e[0m"
47
+ def test_red_with_blue_background_and_underline_symbol_and_methods
48
+ assert_equal "\001\033[4;31;44m\002This is red on blue and underline\001\033[0m\002", 'This is red on blue and underline'.colorize(:red).on_blue.underline
62
49
  end
63
50
 
64
51
  def test_blue_with_red_background_and_blink_methods
65
- assert_equal 'This is blue text on red'.blue.on_red.blink,
66
- "\e[5;34;41mThis is blue text on red\e[0m"
52
+ assert_equal "\001\033[5;34;41m\002This is blue text on red\001\033[0m\002", 'This is blue text on red'.blue.on_red.blink
67
53
  end
68
54
 
69
55
  def test_uncolorize
70
- assert_equal 'This is uncolorized'.blue.on_red.uncolorize,
71
- 'This is uncolorized'
56
+ assert_equal 'This is uncolorized', 'This is uncolorized'.blue.on_red.uncolorize
72
57
  end
73
58
 
74
59
  def test_colorized?
75
- assert_equal 'Red'.red.colorized?, true
76
- assert_equal 'Blue'.colorized?, false
77
- assert_equal 'Green'.blue.green.uncolorize.colorized?, false
60
+ assert_predicate 'Red'.red, :colorized?
61
+ refute_predicate 'Blue', :colorized?
62
+ refute_predicate 'Green'.blue.green.uncolorize, :colorized?
78
63
  end
79
64
 
80
65
  def test_concatenated__colorize?
81
- assert_equal "none #{'red'.red} none #{'blue'.blue} none".colorized?, true
82
- assert_equal "none #{'red'.red} none #{'blue'.blue} none".uncolorize.colorized?, false
66
+ assert_predicate "none #{'red'.red} none #{'blue'.blue} none", :colorized?
67
+ refute_predicate "none #{'red'.red} none #{'blue'.blue} none".uncolorize, :colorized?
83
68
  end
84
69
 
85
70
  def test_concatenated_strings_on_green
86
- assert_equal "none #{'red'.red} none #{'blue'.blue} none".on_green,
87
- "\e[0;39;42mnone \e[0m\e[0;31;42mred\e[0m\e[0;39;42m none \e[0m\e[0;34;42mblue\e[0m\e[0;39;42m none\e[0m"
71
+ assert_equal "\001\033[0;39;42m\002none \001\033[0m\002\001\033[0;31;42m\002red\001\033[0m\002\001\033[0;39;42m\002 none \001\033[0m\002\001\033[0;34;42m\002blue\001\033[0m\002\001\033[0;39;42m\002 none\001\033[0m\002", "none #{'red'.red} none #{'blue'.blue} none".on_green
88
72
  end
89
73
 
90
74
  def test_concatenated_strings_uncolorize
91
- assert_equal "none #{'red'.red} none #{'blue'.blue} none".uncolorize,
92
- 'none red none blue none'
93
- end
94
-
95
- def test_frozen_strings
96
- assert_equal 'This is blue text on red'.freeze.blue.on_red.blink,
97
- "\e[5;34;41mThis is blue text on red\e[0m"
75
+ assert_equal 'none red none blue none', "none #{'red'.red} none #{'blue'.blue} none".uncolorize
98
76
  end
99
77
 
100
78
  def test_new_line
101
- assert_equal "This is blue\ntext on red".freeze.blue.on_red.blink,
102
- "\e[5;34;41mThis is blue\ntext on red\e[0m"
79
+ assert_equal "\001\033[5;34;41m\002This is blue\ntext on red\001\033[0m\002", "This is blue\ntext on red".blue.on_red.blink
103
80
  end
104
81
 
105
82
  def test_disable_colorization_with_=
106
83
  String.disable_colorization = true
107
- assert_equal String.disable_colorization, true
84
+
85
+ assert String.disable_colorization
86
+
108
87
  String.disable_colorization = false
109
88
  end
110
89
 
111
90
  def test_disable_colorization_with_method
112
91
  String.disable_colorization true
113
- assert_equal String.disable_colorization, true
92
+
93
+ assert String.disable_colorization
94
+
114
95
  String.disable_colorization false
115
96
  end
116
97
 
117
98
  def test_string_disable_colorization_with_=
118
99
  String.disable_colorization = true
119
100
 
120
- assert_equal String.disable_colorization, true
101
+ assert String.disable_colorization
121
102
 
122
- assert_equal 'This is blue after disabling'.blue,
123
- 'This is blue after disabling'
103
+ assert_equal 'This is blue after disabling', 'This is blue after disabling'.blue
124
104
 
125
105
  String.disable_colorization = false
126
106
 
127
- assert_equal 'This is blue after enabling'.colorize(:blue),
128
- "\e[0;34;49mThis is blue after enabling\e[0m"
107
+ assert_equal "\001\033[0;34;49m\002This is blue after enabling\001\033[0m\002", 'This is blue after enabling'.colorize(:blue)
129
108
  end
130
109
 
131
110
  def test_string_disable_colorization_with_method
132
- assert_equal 'This is blue before disabling'.colorize(:blue),
133
- "\e[0;34;49mThis is blue before disabling\e[0m"
111
+ assert_equal "\001\033[0;34;49m\002This is blue before disabling\001\033[0m\002", 'This is blue before disabling'.colorize(:blue)
134
112
 
135
113
  String.disable_colorization true
136
114
 
137
- assert_equal String.disable_colorization, true
115
+ assert String.disable_colorization
138
116
 
139
- assert_equal 'This is blue after disabling'.blue,
140
- 'This is blue after disabling'
117
+ assert_equal 'This is blue after disabling', 'This is blue after disabling'.blue
141
118
 
142
119
  String.disable_colorization false
143
120
 
144
- assert_equal 'This is blue after enabling'.colorize(:blue),
145
- "\e[0;34;49mThis is blue after enabling\e[0m"
121
+ assert_equal "\001\033[0;34;49m\002This is blue after enabling\001\033[0m\002", 'This is blue after enabling'.colorize(:blue)
146
122
  end
147
123
 
148
124
  def test_already_colored_string_with_one_value
149
- assert_equal "\e[31mThis is red\e[0m".red,
150
- 'This is red'.red
125
+ assert_equal 'This is red'.red, "\001\033[31m\002This is red\001\033[0m\002".red
151
126
  end
152
127
 
153
128
  def test_color_matrix_method
@@ -161,4 +136,75 @@ class TestColorize < Minitest::Test
161
136
  String.color_samples
162
137
  end
163
138
  end
139
+
140
+ def test_grey_alias
141
+ assert_equal 'This is grey'.grey, 'This is grey'.light_black
142
+ end
143
+
144
+ def test_gray_alias
145
+ assert_equal 'This is gray'.gray, 'This is gray'.light_black
146
+ end
147
+
148
+ def test_add_color_alias
149
+ String.add_color_alias(:extra_blue, :light_blue)
150
+
151
+ assert_equal 'blue'.light_blue, 'blue'.extra_blue
152
+ assert_equal 'blue'.on_light_blue, 'blue'.on_extra_blue
153
+ end
154
+
155
+ def test_add_color_alias_errors
156
+ String.add_color_alias(:extra_red, :light_red)
157
+
158
+ assert_raises ::Colorize::ColorAlreadyExist, 'Colorize: color :extra_red already exist!' do
159
+ String.add_color_alias(:extra_red, :light_blue)
160
+ end
161
+
162
+ assert_raises ::Colorize::ColorDontExist, 'Colorize: color :light_color don\'t exist!' do
163
+ String.add_color_alias(:extra_white, :light_color)
164
+ end
165
+ end
166
+
167
+ def test_add_color_alias_with_single_hash
168
+ String.add_color_alias(extra_green: :light_green)
169
+
170
+ assert_equal 'example string'.light_green, 'example string'.extra_green
171
+ assert_equal 'example string'.on_light_green, 'example string'.on_extra_green
172
+ end
173
+
174
+ def test_add_color_alias_with_single_hash_with_arrow
175
+ String.add_color_alias(:extra_color => :gray)
176
+
177
+ assert_equal 'example string'.gray, 'example string'.extra_color
178
+ assert_equal 'example string'.on_gray, 'example string'.on_extra_color
179
+ end
180
+
181
+ def test_add_color_alias_with_multi_hash
182
+ String.add_color_alias(extra_color_a: :gray, extra_color_b: :blue)
183
+
184
+ assert_equal 'example string'.gray, 'example string'.extra_color_a
185
+ assert_equal 'example string'.blue, 'example string'.extra_color_b
186
+ end
187
+
188
+ def test_add_color_alias_with_multi_hash_with_arrow
189
+ String.add_color_alias(:extra_color_c => :gray, :extra_color_d => :blue)
190
+
191
+ assert_equal 'example string'.gray, 'example string'.extra_color_c
192
+ assert_equal 'example string'.on_blue, 'example string'.on_extra_color_d
193
+ end
194
+
195
+ def test_add_color_alias_with_multi_hash_mixed
196
+ String.add_color_alias(extra_color_e: :gray, :extra_color_f => :blue)
197
+
198
+ assert_equal 'example string'.gray, 'example string'.extra_color_e
199
+ assert_equal 'example string'.on_blue, 'example string'.on_extra_color_f
200
+ end
201
+
202
+ def test_prevent_colors
203
+ String.prevent_colors true
204
+
205
+ assert String.prevent_colors
206
+ assert_equal "#{'blue'.blue}#{'red'.red}#{'green'.green}", "#{'blue'.blue}red#{'green'.green}".red
207
+
208
+ String.prevent_colors false
209
+ end
164
210
  end
@@ -0,0 +1,214 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'minitest/autorun'
4
+ require "#{File.dirname(__FILE__)}/../lib/colorized_string"
5
+
6
+ class TestColorizedString < Minitest::Test
7
+ def test_colorize_not_required
8
+ refute_respond_to '', :colorize, 'Colorize should not be required. Only colorized_string'
9
+ end
10
+
11
+ def test_blue_symbol
12
+ assert_equal "\001\033[0;34;49m\002This is blue\001\033[0m\002", ColorizedString['This is blue'].colorize(:blue)
13
+ end
14
+
15
+ def test_incorrect_symbol
16
+ assert_equal "\001\033[0;39;49m\002This is incorrect color\001\033[0m\002", ColorizedString['This is incorrect color'].colorize(:bold)
17
+ end
18
+
19
+ def test_incorrect_hash
20
+ assert_equal "\001\033[0;39;49m\002This is incorrect color\001\033[0m\002", ColorizedString['This is incorrect color'].colorize(:color => :bold)
21
+
22
+ assert_equal "\001\033[0;39;49m\002This is incorrect color\001\033[0m\002", ColorizedString['This is incorrect color'].colorize(:mode => :green)
23
+
24
+ assert_equal "\001\033[0;39;49m\002This is incorrect color\001\033[0m\002", ColorizedString['This is incorrect color'].colorize(:background => :bold)
25
+ end
26
+
27
+ def test_blue_hash
28
+ assert_equal "\001\033[0;34;49m\002This is also blue\001\033[0m\002", ColorizedString['This is also blue'].colorize(:color => :blue)
29
+ end
30
+
31
+ def test_light_blue_symbol
32
+ assert_equal "\001\033[0;94;49m\002This is light blue\001\033[0m\002", ColorizedString['This is light blue'].colorize(:light_blue)
33
+ end
34
+
35
+ def test_light_blue_with_red_background_hash
36
+ assert_equal "\001\033[0;94;41m\002This is light blue with red background\001\033[0m\002", ColorizedString['This is light blue with red background'].colorize(:color => :light_blue, :background => :red)
37
+ end
38
+
39
+ def test_light_blue_with_red_background_symbol_and_hash
40
+ assert_equal "\001\033[0;94;41m\002This is light blue with red background\001\033[0m\002", ColorizedString['This is light blue with red background'].colorize(:light_blue).colorize(:background => :red)
41
+ end
42
+
43
+ def test_blue_with_red_background_method
44
+ assert_equal "\001\033[0;34;41m\002This is blue text on red\001\033[0m\002", ColorizedString['This is blue text on red'].blue.on_red
45
+ end
46
+
47
+ def test_red_with_blue_background_symbol_and_method
48
+ assert_equal "\001\033[0;31;44m\002This is red on blue\001\033[0m\002", ColorizedString['This is red on blue'].colorize(:red).on_blue
49
+ end
50
+
51
+ def test_red_with_blue_background_and_underline_sumbol_and_methods
52
+ assert_equal "\001\033[4;31;44m\002This is red on blue and underline\001\033[0m\002", ColorizedString['This is red on blue and underline'].colorize(:red).on_blue.underline
53
+ end
54
+
55
+ def test_blue_with_red_background_and_blink_methods
56
+ assert_equal "\001\033[5;34;41m\002This is blue text on red\001\033[0m\002", ColorizedString['This is blue text on red'].blue.on_red.blink
57
+ end
58
+
59
+ def test_uncolorize
60
+ assert_equal 'This is uncolorized', ColorizedString['This is uncolorized'].blue.on_red.uncolorize
61
+ end
62
+
63
+ def test_colorized?
64
+ assert_predicate ColorizedString['Red'].red, :colorized?
65
+ refute_predicate ColorizedString['Blue'], :colorized?
66
+ refute_predicate ColorizedString['Green'].blue.green.uncolorize, :colorized?
67
+ end
68
+
69
+ def test_concatenated__colorize?
70
+ assert_predicate ColorizedString["none #{ColorizedString['red'].red} none #{ColorizedString['blue'].blue} none"], :colorized?
71
+ refute_predicate ColorizedString["none #{ColorizedString['red'].red} none #{ColorizedString['blue'].blue} none"].uncolorize, :colorized?
72
+ end
73
+
74
+ def test_concatenated_strings_on_green
75
+ assert_equal "\001\033[0;39;42m\002none \001\033[0m\002\001\033[0;31;42m\002red\001\033[0m\002\001\033[0;39;42m\002 none \001\033[0m\002\001\033[0;34;42m\002blue\001\033[0m\002\001\033[0;39;42m\002 none\001\033[0m\002", ColorizedString["none #{ColorizedString['red'].red} none #{ColorizedString['blue'].blue} none"].on_green
76
+ end
77
+
78
+ def test_concatenated_strings_uncolorize
79
+ assert_equal 'none red none blue none', ColorizedString["none #{ColorizedString['red'].red} none #{ColorizedString['blue'].blue} none"].uncolorize
80
+ end
81
+
82
+ def test_frozen_strings
83
+ assert_equal "\001\033[5;34;41m\002This is blue text on red\001\033[0m\002", ColorizedString['This is blue text on red'].freeze.blue.on_red.blink
84
+ end
85
+
86
+ def test_new_line
87
+ assert_equal "\001\033[5;34;41m\002This is blue\ntext on red\001\033[0m\002", ColorizedString["This is blue\ntext on red"].freeze.blue.on_red.blink
88
+ end
89
+
90
+ def test_disable_colorization_with_=
91
+ ColorizedString.disable_colorization = true
92
+
93
+ assert ColorizedString.disable_colorization
94
+
95
+ ColorizedString.disable_colorization = false
96
+ end
97
+
98
+ def test_disable_colorization_with_method
99
+ ColorizedString.disable_colorization true
100
+
101
+ assert ColorizedString.disable_colorization
102
+
103
+ ColorizedString.disable_colorization false
104
+ end
105
+
106
+ def test_string_disable_colorization_with_=
107
+ ColorizedString.disable_colorization = true
108
+
109
+ assert ColorizedString.disable_colorization
110
+
111
+ assert_equal 'This is blue after disabling', ColorizedString['This is blue after disabling'].blue
112
+
113
+ ColorizedString.disable_colorization = false
114
+
115
+ assert_equal "\001\033[0;34;49m\002This is blue after enabling\001\033[0m\002", ColorizedString['This is blue after enabling'].colorize(:blue)
116
+ end
117
+
118
+ def test_string_disable_colorization_with_method
119
+ assert_equal "\001\033[0;34;49m\002This is blue before disabling\001\033[0m\002", ColorizedString['This is blue before disabling'].colorize(:blue)
120
+
121
+ ColorizedString.disable_colorization true
122
+
123
+ assert ColorizedString.disable_colorization
124
+
125
+ assert_equal 'This is blue after disabling', ColorizedString['This is blue after disabling'].blue
126
+
127
+ ColorizedString.disable_colorization false
128
+
129
+ assert_equal "\001\033[0;34;49m\002This is blue after enabling\001\033[0m\002", ColorizedString['This is blue after enabling'].colorize(:blue)
130
+ end
131
+
132
+ def test_already_colored_string_with_one_value
133
+ assert_equal ColorizedString['This is red'].red, ColorizedString["\001\033[31m\002This is red\001\033[0m\002"].red
134
+ end
135
+
136
+ def test_color_matrix_method
137
+ assert_raises NoMethodError do
138
+ ColorizedString.color_matrix
139
+ end
140
+ end
141
+
142
+ def test_color_samples_method
143
+ assert_output do
144
+ ColorizedString.color_samples
145
+ end
146
+ end
147
+
148
+ def test_grey_alias
149
+ assert_equal ColorizedString['This is grey'].grey, ColorizedString['This is grey'].light_black
150
+ end
151
+
152
+ def test_gray_alias
153
+ assert_equal ColorizedString['This is gray'].gray, ColorizedString['This is gray'].light_black
154
+ end
155
+
156
+ def test_add_color_alias
157
+ ColorizedString.add_color_alias(:extra_blue, :light_blue)
158
+
159
+ assert_equal ColorizedString['blue'].light_blue, ColorizedString['blue'].extra_blue
160
+ assert_equal ColorizedString['blue'].on_light_blue, ColorizedString['blue'].on_extra_blue
161
+
162
+ assert_raises ::Colorize::ColorAlreadyExist, 'Colorize: color :extra_blue already exist!' do
163
+ ColorizedString.add_color_alias(:extra_blue, :light_color)
164
+ end
165
+
166
+ assert_raises ::Colorize::ColorDontExist, 'Colorize: color :light_color don\'t exist!' do
167
+ ColorizedString.add_color_alias(:extra_white, :light_color)
168
+ end
169
+ end
170
+
171
+ def test_add_color_alias_with_single_hash
172
+ ColorizedString.add_color_alias(extra_green: :light_green)
173
+
174
+ assert_equal ColorizedString['example string'].light_green, ColorizedString['example string'].extra_green
175
+ assert_equal ColorizedString['example string'].on_light_green, ColorizedString['example string'].on_extra_green
176
+ end
177
+
178
+ def test_add_color_alias_with_single_hash_with_arrow
179
+ ColorizedString.add_color_alias(:extra_color => :gray)
180
+
181
+ assert_equal ColorizedString['example string'].gray, ColorizedString['example string'].extra_color
182
+ assert_equal ColorizedString['example string'].on_gray, ColorizedString['example string'].on_extra_color
183
+ end
184
+
185
+ def test_add_color_alias_with_multi_hash
186
+ ColorizedString.add_color_alias(extra_color_a: :gray, extra_color_b: :blue)
187
+
188
+ assert_equal ColorizedString['example string'].gray, ColorizedString['example string'].extra_color_a
189
+ assert_equal ColorizedString['example string'].blue, ColorizedString['example string'].extra_color_b
190
+ end
191
+
192
+ def test_add_color_alias_with_multi_hash_with_arrow
193
+ ColorizedString.add_color_alias(:extra_color_c => :gray, :extra_color_d => :blue)
194
+
195
+ assert_equal ColorizedString['example string'].gray, ColorizedString['example string'].extra_color_c
196
+ assert_equal ColorizedString['example string'].on_blue, ColorizedString['example string'].on_extra_color_d
197
+ end
198
+
199
+ def test_add_color_alias_with_multi_hash_mixed
200
+ ColorizedString.add_color_alias(extra_color_e: :gray, :extra_color_f => :blue)
201
+
202
+ assert_equal ColorizedString['example string'].gray, ColorizedString['example string'].extra_color_e
203
+ assert_equal ColorizedString['example string'].on_blue, ColorizedString['example string'].on_extra_color_f
204
+ end
205
+
206
+ def test_prevent_colors
207
+ ColorizedString.prevent_colors true
208
+
209
+ assert ColorizedString.prevent_colors
210
+ assert_equal "#{ColorizedString['blue'].blue}#{ColorizedString['red'].red}#{ColorizedString['green'].green}", ColorizedString["#{ColorizedString['blue'].blue}red#{ColorizedString['green'].green}"].red
211
+
212
+ ColorizedString.prevent_colors false
213
+ end
214
+ end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: colorize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 1.0.0.pre.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michał Kalbarczyk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2023-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '10.0'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '10.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,19 +39,89 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '5.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: codeclimate-test-reporter
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '13.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '13.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop-github
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: '0.4'
75
+ version: '0.20'
48
76
  type: :development
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
80
  - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: '0.4'
82
+ version: '0.20'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.29.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.29.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-performance
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.16'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.16'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.6'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.6'
55
125
  description: Extends String class or add a ColorizedString with methods to set text
56
126
  color, background color and text effects.
57
127
  email: fazibear@gmail.com
@@ -59,20 +129,24 @@ executables: []
59
129
  extensions: []
60
130
  extra_rdoc_files: []
61
131
  files:
62
- - CHANGELOG
132
+ - CHANGELOG.md
63
133
  - LICENSE
64
134
  - README.md
65
135
  - Rakefile
66
136
  - colorize.gemspec
67
137
  - lib/colorize.rb
68
138
  - lib/colorize/class_methods.rb
139
+ - lib/colorize/errors.rb
69
140
  - lib/colorize/instance_methods.rb
141
+ - lib/colorize/version.rb
70
142
  - lib/colorized_string.rb
71
143
  - test/test_colorize.rb
144
+ - test/test_colorized_string.rb
72
145
  homepage: http://github.com/fazibear/colorize
73
146
  licenses:
74
147
  - GPL-2.0
75
- metadata: {}
148
+ metadata:
149
+ rubygems_mfa_required: 'true'
76
150
  post_install_message:
77
151
  rdoc_options: []
78
152
  require_paths:
@@ -81,17 +155,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
155
  requirements:
82
156
  - - ">="
83
157
  - !ruby/object:Gem::Version
84
- version: '0'
158
+ version: '2.6'
85
159
  required_rubygems_version: !ruby/object:Gem::Requirement
86
160
  requirements:
87
- - - ">="
161
+ - - ">"
88
162
  - !ruby/object:Gem::Version
89
- version: '0'
163
+ version: 1.3.1
90
164
  requirements: []
91
- rubyforge_project:
92
- rubygems_version: 2.5.1
165
+ rubygems_version: 3.4.6
93
166
  signing_key:
94
167
  specification_version: 4
95
168
  summary: Ruby gem for colorizing text using ANSI escape sequences.
96
- test_files:
97
- - test/test_colorize.rb
169
+ test_files: []