super-color 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +5 -0
- data/Gemfile +11 -0
- data/README.md +80 -0
- data/Rakefile +16 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/coverage/index.html +634 -0
- data/ext/text_power/extconf.rb +7 -0
- data/ext/text_power/text_power.c +17 -0
- data/lib/mixin/string.rb +9 -0
- data/lib/super/color.rb +41 -0
- data/lib/super/color/version.rb +5 -0
- data/lib/super/power_color.rb +18 -0
- data/lib/text_power.bundle +0 -0
- data/super-color.gemspec +46 -0
- metadata +120 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57e93ef63ed74d3be7613fca85e9ba46cdf5ad1a
|
4
|
+
data.tar.gz: 02a1d8e7728a1c495aec5c91b118d2a0b54a196f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 940027df6d418a9a38d6a16a3c2ab92e116f385f4a8ba1b4cc0af49a38b325ee4f8ba1faac835963e37d1fa7b3fc3cb3c049c4046bc0eee34d19a6a32a2dbb2f
|
7
|
+
data.tar.gz: 7918a6711364ed6e36c76d37ad23668cceceb755bad96e39e7acfbeb73c01712ab37687c2aa6d393064fb3d3ff9264e3f2169ac1d253b12aebe6fe9718f81172
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# Super::Color
|
2
|
+
[![Build Status](https://travis-ci.org/MVV90/super-color.svg?branch=master)](https://travis-ci.org/MVV90/super-color)
|
3
|
+
|
4
|
+
<div id="coverage" style="background-color: white; border-radius: 5px; padding: 5px 5px 5px 10px; align: center">
|
5
|
+
SimpleCov Test Coverage: <span id="new-projects"></span>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<script src="http://code.jquery.com/jquery-3.1.1.min.js"></script>
|
9
|
+
<script>
|
10
|
+
$("#new-projects").load( "https://raw.githubusercontent.com/MVV90/super-color/master/coverage/index.html #footer div",
|
11
|
+
function(responseTxt, statusTxt, xhr) {
|
12
|
+
var coveragePercent = $(responseTxt).find(".yellow:first").text();
|
13
|
+
$("#new-projects").html(coveragePercent);
|
14
|
+
|
15
|
+
if(coveragePercent >= 100.0) {
|
16
|
+
$("#coverage").css("border", "2px solid green");
|
17
|
+
} else {
|
18
|
+
$("#coverage").css("border", "2px solid red");
|
19
|
+
}
|
20
|
+
}
|
21
|
+
);
|
22
|
+
</script>
|
23
|
+
---
|
24
|
+
SuperColor is an easy to use gem that gives color to any text in your terminal and `puts` statements.
|
25
|
+
|
26
|
+
## Installation
|
27
|
+
|
28
|
+
Add this line to your application's Gemfile:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
gem 'super-color'
|
32
|
+
```
|
33
|
+
|
34
|
+
And then execute:
|
35
|
+
|
36
|
+
$ bundle
|
37
|
+
|
38
|
+
Or install it yourself as:
|
39
|
+
|
40
|
+
$ gem install super-color
|
41
|
+
|
42
|
+
## Usage
|
43
|
+
|
44
|
+
It's as easy as:
|
45
|
+
```
|
46
|
+
puts "Hi, I'm colored".red
|
47
|
+
```
|
48
|
+
|
49
|
+
Available colors include:
|
50
|
+
```
|
51
|
+
red
|
52
|
+
yellow
|
53
|
+
green
|
54
|
+
magenta
|
55
|
+
color_warning
|
56
|
+
color_success
|
57
|
+
color_error
|
58
|
+
```
|
59
|
+
|
60
|
+
as well as helper methods like:
|
61
|
+
```
|
62
|
+
puts_warning
|
63
|
+
puts_success
|
64
|
+
puts_error
|
65
|
+
```
|
66
|
+
|
67
|
+
Which would be used as simply as:
|
68
|
+
```
|
69
|
+
1.even? ? "cool, i never knew that".puts_success : "oh -no! this hurts my brain..".puts_error
|
70
|
+
```
|
71
|
+
|
72
|
+
## Development
|
73
|
+
|
74
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
75
|
+
|
76
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
77
|
+
|
78
|
+
## Contributing
|
79
|
+
|
80
|
+
Bug reports and pull requests are `not` welcome. This project is mostly dead.. apologies.
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
require "rake/extensiontask"
|
4
|
+
|
5
|
+
Rake::TestTask.new(:test) do |t|
|
6
|
+
t.libs << "test"
|
7
|
+
t.libs << "lib"
|
8
|
+
t.test_files = FileList['test/**/*_test.rb']
|
9
|
+
end
|
10
|
+
|
11
|
+
task :default => :test
|
12
|
+
|
13
|
+
spec = Gem::Specification.load('text_power.gemspec')
|
14
|
+
Rake::ExtensionTask.new('text_power', spec)
|
15
|
+
|
16
|
+
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "super/color"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/coverage/index.html
ADDED
@@ -0,0 +1,634 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
+
<head>
|
4
|
+
<title>Code coverage for Super-color</title>
|
5
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6
|
+
<script src='./assets/0.10.0/application.js' type='text/javascript'></script>
|
7
|
+
<link href='./assets/0.10.0/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
|
8
|
+
<link rel="shortcut icon" type="image/png" href="./assets/0.10.0/favicon_green.png" />
|
9
|
+
<link rel="icon" type="image/png" href="./assets/0.10.0/favicon.png" />
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
<div id="loading">
|
14
|
+
<img src="./assets/0.10.0/loading.gif" alt="loading"/>
|
15
|
+
</div>
|
16
|
+
<div id="wrapper" style="display:none;">
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2016-12-16T14:31:50-05:00">2016-12-16T14:31:50-05:00</abbr></div>
|
18
|
+
<ul class="group_tabs"></ul>
|
19
|
+
|
20
|
+
<div id="content">
|
21
|
+
<div class="file_list_container" id="AllFiles">
|
22
|
+
<h2>
|
23
|
+
<span class="group_name">All Files</span>
|
24
|
+
(<span class="covered_percent"><span class="green">92.5%</span></span>
|
25
|
+
covered at
|
26
|
+
<span class="covered_strength">
|
27
|
+
<span class="green">
|
28
|
+
1.02
|
29
|
+
</span>
|
30
|
+
</span> hits/line)
|
31
|
+
</h2>
|
32
|
+
<a name="AllFiles"></a>
|
33
|
+
<div>
|
34
|
+
<b>4</b> files in total.
|
35
|
+
<b>40</b> relevant lines.
|
36
|
+
<span class="green"><b>37</b> lines covered</span> and
|
37
|
+
<span class="red"><b>3</b> lines missed </span>
|
38
|
+
</div>
|
39
|
+
<table class="file_list">
|
40
|
+
<thead>
|
41
|
+
<tr>
|
42
|
+
<th>File</th>
|
43
|
+
<th>% covered</th>
|
44
|
+
<th>Lines</th>
|
45
|
+
<th>Relevant Lines</th>
|
46
|
+
<th>Lines covered</th>
|
47
|
+
<th>Lines missed</th>
|
48
|
+
<th>Avg. Hits / Line</th>
|
49
|
+
</tr>
|
50
|
+
</thead>
|
51
|
+
<tbody>
|
52
|
+
|
53
|
+
<tr>
|
54
|
+
<td class="strong"><a href="#2143be85b47547de5ae8b5523f528e8c90f16151" class="src_link" title="lib/mixin/string.rb">lib/mixin/string.rb</a></td>
|
55
|
+
<td class="green strong">100.0 %</td>
|
56
|
+
<td>9</td>
|
57
|
+
<td>5</td>
|
58
|
+
<td>5</td>
|
59
|
+
<td>0</td>
|
60
|
+
<td>1.0</td>
|
61
|
+
</tr>
|
62
|
+
|
63
|
+
<tr>
|
64
|
+
<td class="strong"><a href="#21abb31e54bcfa81539d23777e6c1fc622dce2e4" class="src_link" title="lib/super/color.rb">lib/super/color.rb</a></td>
|
65
|
+
<td class="yellow strong">86.36 %</td>
|
66
|
+
<td>41</td>
|
67
|
+
<td>22</td>
|
68
|
+
<td>19</td>
|
69
|
+
<td>3</td>
|
70
|
+
<td>1.0</td>
|
71
|
+
</tr>
|
72
|
+
|
73
|
+
<tr>
|
74
|
+
<td class="strong"><a href="#2fe71b5479e9ede17c5b12e5acf5bdbfbda94171" class="src_link" title="lib/super/power_color.rb">lib/super/power_color.rb</a></td>
|
75
|
+
<td class="green strong">100.0 %</td>
|
76
|
+
<td>14</td>
|
77
|
+
<td>7</td>
|
78
|
+
<td>7</td>
|
79
|
+
<td>0</td>
|
80
|
+
<td>1.1</td>
|
81
|
+
</tr>
|
82
|
+
|
83
|
+
<tr>
|
84
|
+
<td class="strong"><a href="#ad8442bb6ed99b6304e04a7aba14ef3c59ad9050" class="src_link" title="test/super/power_color_test.rb">test/super/power_color_test.rb</a></td>
|
85
|
+
<td class="green strong">100.0 %</td>
|
86
|
+
<td>11</td>
|
87
|
+
<td>6</td>
|
88
|
+
<td>6</td>
|
89
|
+
<td>0</td>
|
90
|
+
<td>1.0</td>
|
91
|
+
</tr>
|
92
|
+
|
93
|
+
</tbody>
|
94
|
+
</table>
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
<div id="footer">
|
102
|
+
Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.12.0
|
103
|
+
and simplecov-html v0.10.0<br/>
|
104
|
+
using Unit Tests
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<div class="source_files">
|
108
|
+
|
109
|
+
<div class="source_table" id="2143be85b47547de5ae8b5523f528e8c90f16151">
|
110
|
+
<div class="header">
|
111
|
+
<h3>lib/mixin/string.rb</h3>
|
112
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
113
|
+
<div>
|
114
|
+
<b>5</b> relevant lines.
|
115
|
+
<span class="green"><b>5</b> lines covered</span> and
|
116
|
+
<span class="red"><b>0</b> lines missed.</span>
|
117
|
+
</div>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<pre>
|
121
|
+
<ol>
|
122
|
+
|
123
|
+
<li class="covered" data-hits="1" data-linenumber="1">
|
124
|
+
<span class="hits">1</span>
|
125
|
+
|
126
|
+
<code class="ruby">require_relative "../super/color"</code>
|
127
|
+
</li>
|
128
|
+
|
129
|
+
<li class="never" data-hits="" data-linenumber="2">
|
130
|
+
|
131
|
+
|
132
|
+
<code class="ruby"></code>
|
133
|
+
</li>
|
134
|
+
|
135
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
136
|
+
<span class="hits">1</span>
|
137
|
+
|
138
|
+
<code class="ruby">class String</code>
|
139
|
+
</li>
|
140
|
+
|
141
|
+
<li class="covered" data-hits="1" data-linenumber="4">
|
142
|
+
<span class="hits">1</span>
|
143
|
+
|
144
|
+
<code class="ruby"> include Super::Color</code>
|
145
|
+
</li>
|
146
|
+
|
147
|
+
<li class="never" data-hits="" data-linenumber="5">
|
148
|
+
|
149
|
+
|
150
|
+
<code class="ruby"></code>
|
151
|
+
</li>
|
152
|
+
|
153
|
+
<li class="covered" data-hits="1" data-linenumber="6">
|
154
|
+
<span class="hits">1</span>
|
155
|
+
|
156
|
+
<code class="ruby"> if ENV['RACK_ENV'] == 'test'</code>
|
157
|
+
</li>
|
158
|
+
|
159
|
+
<li class="covered" data-hits="1" data-linenumber="7">
|
160
|
+
<span class="hits">1</span>
|
161
|
+
|
162
|
+
<code class="ruby"> def ___only_for_test___!; true end</code>
|
163
|
+
</li>
|
164
|
+
|
165
|
+
<li class="never" data-hits="" data-linenumber="8">
|
166
|
+
|
167
|
+
|
168
|
+
<code class="ruby"> end</code>
|
169
|
+
</li>
|
170
|
+
|
171
|
+
<li class="never" data-hits="" data-linenumber="9">
|
172
|
+
|
173
|
+
|
174
|
+
<code class="ruby">end</code>
|
175
|
+
</li>
|
176
|
+
|
177
|
+
</ol>
|
178
|
+
</pre>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div class="source_table" id="21abb31e54bcfa81539d23777e6c1fc622dce2e4">
|
182
|
+
<div class="header">
|
183
|
+
<h3>lib/super/color.rb</h3>
|
184
|
+
<h4><span class="yellow">86.36 %</span> covered</h4>
|
185
|
+
<div>
|
186
|
+
<b>22</b> relevant lines.
|
187
|
+
<span class="green"><b>19</b> lines covered</span> and
|
188
|
+
<span class="red"><b>3</b> lines missed.</span>
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
<pre>
|
193
|
+
<ol>
|
194
|
+
|
195
|
+
<li class="covered" data-hits="1" data-linenumber="1">
|
196
|
+
<span class="hits">1</span>
|
197
|
+
|
198
|
+
<code class="ruby">require "super/color/version"</code>
|
199
|
+
</li>
|
200
|
+
|
201
|
+
<li class="covered" data-hits="1" data-linenumber="2">
|
202
|
+
<span class="hits">1</span>
|
203
|
+
|
204
|
+
<code class="ruby">require_relative "../mixin/string"</code>
|
205
|
+
</li>
|
206
|
+
|
207
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
208
|
+
<span class="hits">1</span>
|
209
|
+
|
210
|
+
<code class="ruby">require_relative "../text_power"</code>
|
211
|
+
</li>
|
212
|
+
|
213
|
+
<li class="never" data-hits="" data-linenumber="4">
|
214
|
+
|
215
|
+
|
216
|
+
<code class="ruby"></code>
|
217
|
+
</li>
|
218
|
+
|
219
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
220
|
+
<span class="hits">1</span>
|
221
|
+
|
222
|
+
<code class="ruby">module Super</code>
|
223
|
+
</li>
|
224
|
+
|
225
|
+
<li class="covered" data-hits="1" data-linenumber="6">
|
226
|
+
<span class="hits">1</span>
|
227
|
+
|
228
|
+
<code class="ruby"> module Color</code>
|
229
|
+
</li>
|
230
|
+
|
231
|
+
<li class="never" data-hits="" data-linenumber="7">
|
232
|
+
|
233
|
+
|
234
|
+
<code class="ruby"></code>
|
235
|
+
</li>
|
236
|
+
|
237
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
238
|
+
<span class="hits">1</span>
|
239
|
+
|
240
|
+
<code class="ruby"> def red</code>
|
241
|
+
</li>
|
242
|
+
|
243
|
+
<li class="covered" data-hits="2" data-linenumber="9">
|
244
|
+
<span class="hits">2</span>
|
245
|
+
|
246
|
+
<code class="ruby"> "\e[31m#{self}\e[0m"</code>
|
247
|
+
</li>
|
248
|
+
|
249
|
+
<li class="never" data-hits="" data-linenumber="10">
|
250
|
+
|
251
|
+
|
252
|
+
<code class="ruby"> end</code>
|
253
|
+
</li>
|
254
|
+
|
255
|
+
<li class="never" data-hits="" data-linenumber="11">
|
256
|
+
|
257
|
+
|
258
|
+
<code class="ruby"></code>
|
259
|
+
</li>
|
260
|
+
|
261
|
+
<li class="covered" data-hits="1" data-linenumber="12">
|
262
|
+
<span class="hits">1</span>
|
263
|
+
|
264
|
+
<code class="ruby"> def green</code>
|
265
|
+
</li>
|
266
|
+
|
267
|
+
<li class="covered" data-hits="2" data-linenumber="13">
|
268
|
+
<span class="hits">2</span>
|
269
|
+
|
270
|
+
<code class="ruby"> "\e[92m#{self}\e[0m"</code>
|
271
|
+
</li>
|
272
|
+
|
273
|
+
<li class="never" data-hits="" data-linenumber="14">
|
274
|
+
|
275
|
+
|
276
|
+
<code class="ruby"> end</code>
|
277
|
+
</li>
|
278
|
+
|
279
|
+
<li class="never" data-hits="" data-linenumber="15">
|
280
|
+
|
281
|
+
|
282
|
+
<code class="ruby"></code>
|
283
|
+
</li>
|
284
|
+
|
285
|
+
<li class="covered" data-hits="1" data-linenumber="16">
|
286
|
+
<span class="hits">1</span>
|
287
|
+
|
288
|
+
<code class="ruby"> def yellow</code>
|
289
|
+
</li>
|
290
|
+
|
291
|
+
<li class="covered" data-hits="2" data-linenumber="17">
|
292
|
+
<span class="hits">2</span>
|
293
|
+
|
294
|
+
<code class="ruby"> "\e[93m#{self}\e[0m"</code>
|
295
|
+
</li>
|
296
|
+
|
297
|
+
<li class="never" data-hits="" data-linenumber="18">
|
298
|
+
|
299
|
+
|
300
|
+
<code class="ruby"> end</code>
|
301
|
+
</li>
|
302
|
+
|
303
|
+
<li class="never" data-hits="" data-linenumber="19">
|
304
|
+
|
305
|
+
|
306
|
+
<code class="ruby"></code>
|
307
|
+
</li>
|
308
|
+
|
309
|
+
<li class="covered" data-hits="1" data-linenumber="20">
|
310
|
+
<span class="hits">1</span>
|
311
|
+
|
312
|
+
<code class="ruby"> def magenta</code>
|
313
|
+
</li>
|
314
|
+
|
315
|
+
<li class="covered" data-hits="1" data-linenumber="21">
|
316
|
+
<span class="hits">1</span>
|
317
|
+
|
318
|
+
<code class="ruby"> "\e[35m#{self}\e[0m"</code>
|
319
|
+
</li>
|
320
|
+
|
321
|
+
<li class="never" data-hits="" data-linenumber="22">
|
322
|
+
|
323
|
+
|
324
|
+
<code class="ruby"> end</code>
|
325
|
+
</li>
|
326
|
+
|
327
|
+
<li class="never" data-hits="" data-linenumber="23">
|
328
|
+
|
329
|
+
|
330
|
+
<code class="ruby"></code>
|
331
|
+
</li>
|
332
|
+
|
333
|
+
<li class="covered" data-hits="1" data-linenumber="24">
|
334
|
+
<span class="hits">1</span>
|
335
|
+
|
336
|
+
<code class="ruby"> alias color_warning yellow</code>
|
337
|
+
</li>
|
338
|
+
|
339
|
+
<li class="covered" data-hits="1" data-linenumber="25">
|
340
|
+
<span class="hits">1</span>
|
341
|
+
|
342
|
+
<code class="ruby"> alias color_error red</code>
|
343
|
+
</li>
|
344
|
+
|
345
|
+
<li class="covered" data-hits="1" data-linenumber="26">
|
346
|
+
<span class="hits">1</span>
|
347
|
+
|
348
|
+
<code class="ruby"> alias color_success green</code>
|
349
|
+
</li>
|
350
|
+
|
351
|
+
<li class="never" data-hits="" data-linenumber="27">
|
352
|
+
|
353
|
+
|
354
|
+
<code class="ruby"></code>
|
355
|
+
</li>
|
356
|
+
|
357
|
+
<li class="covered" data-hits="1" data-linenumber="28">
|
358
|
+
<span class="hits">1</span>
|
359
|
+
|
360
|
+
<code class="ruby"> def puts_warning</code>
|
361
|
+
</li>
|
362
|
+
|
363
|
+
<li class="missed" data-hits="0" data-linenumber="29">
|
364
|
+
|
365
|
+
|
366
|
+
<code class="ruby"> puts yellow</code>
|
367
|
+
</li>
|
368
|
+
|
369
|
+
<li class="never" data-hits="" data-linenumber="30">
|
370
|
+
|
371
|
+
|
372
|
+
<code class="ruby"> end</code>
|
373
|
+
</li>
|
374
|
+
|
375
|
+
<li class="never" data-hits="" data-linenumber="31">
|
376
|
+
|
377
|
+
|
378
|
+
<code class="ruby"></code>
|
379
|
+
</li>
|
380
|
+
|
381
|
+
<li class="covered" data-hits="1" data-linenumber="32">
|
382
|
+
<span class="hits">1</span>
|
383
|
+
|
384
|
+
<code class="ruby"> def puts_success</code>
|
385
|
+
</li>
|
386
|
+
|
387
|
+
<li class="missed" data-hits="0" data-linenumber="33">
|
388
|
+
|
389
|
+
|
390
|
+
<code class="ruby"> puts green</code>
|
391
|
+
</li>
|
392
|
+
|
393
|
+
<li class="never" data-hits="" data-linenumber="34">
|
394
|
+
|
395
|
+
|
396
|
+
<code class="ruby"> end</code>
|
397
|
+
</li>
|
398
|
+
|
399
|
+
<li class="never" data-hits="" data-linenumber="35">
|
400
|
+
|
401
|
+
|
402
|
+
<code class="ruby"></code>
|
403
|
+
</li>
|
404
|
+
|
405
|
+
<li class="covered" data-hits="1" data-linenumber="36">
|
406
|
+
<span class="hits">1</span>
|
407
|
+
|
408
|
+
<code class="ruby"> def puts_error</code>
|
409
|
+
</li>
|
410
|
+
|
411
|
+
<li class="missed" data-hits="0" data-linenumber="37">
|
412
|
+
|
413
|
+
|
414
|
+
<code class="ruby"> puts red</code>
|
415
|
+
</li>
|
416
|
+
|
417
|
+
<li class="never" data-hits="" data-linenumber="38">
|
418
|
+
|
419
|
+
|
420
|
+
<code class="ruby"> end</code>
|
421
|
+
</li>
|
422
|
+
|
423
|
+
<li class="never" data-hits="" data-linenumber="39">
|
424
|
+
|
425
|
+
|
426
|
+
<code class="ruby"></code>
|
427
|
+
</li>
|
428
|
+
|
429
|
+
<li class="never" data-hits="" data-linenumber="40">
|
430
|
+
|
431
|
+
|
432
|
+
<code class="ruby"> end</code>
|
433
|
+
</li>
|
434
|
+
|
435
|
+
<li class="never" data-hits="" data-linenumber="41">
|
436
|
+
|
437
|
+
|
438
|
+
<code class="ruby">end</code>
|
439
|
+
</li>
|
440
|
+
|
441
|
+
</ol>
|
442
|
+
</pre>
|
443
|
+
</div>
|
444
|
+
|
445
|
+
<div class="source_table" id="2fe71b5479e9ede17c5b12e5acf5bdbfbda94171">
|
446
|
+
<div class="header">
|
447
|
+
<h3>lib/super/power_color.rb</h3>
|
448
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
449
|
+
<div>
|
450
|
+
<b>7</b> relevant lines.
|
451
|
+
<span class="green"><b>7</b> lines covered</span> and
|
452
|
+
<span class="red"><b>0</b> lines missed.</span>
|
453
|
+
</div>
|
454
|
+
</div>
|
455
|
+
|
456
|
+
<pre>
|
457
|
+
<ol>
|
458
|
+
|
459
|
+
<li class="covered" data-hits="1" data-linenumber="1">
|
460
|
+
<span class="hits">1</span>
|
461
|
+
|
462
|
+
<code class="ruby">require "super/color/version"</code>
|
463
|
+
</li>
|
464
|
+
|
465
|
+
<li class="covered" data-hits="1" data-linenumber="2">
|
466
|
+
<span class="hits">1</span>
|
467
|
+
|
468
|
+
<code class="ruby">require File.expand_path('../../text_power', __FILE__)</code>
|
469
|
+
</li>
|
470
|
+
|
471
|
+
<li class="never" data-hits="" data-linenumber="3">
|
472
|
+
|
473
|
+
|
474
|
+
<code class="ruby"></code>
|
475
|
+
</li>
|
476
|
+
|
477
|
+
<li class="covered" data-hits="1" data-linenumber="4">
|
478
|
+
<span class="hits">1</span>
|
479
|
+
|
480
|
+
<code class="ruby">module Power</code>
|
481
|
+
</li>
|
482
|
+
|
483
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
484
|
+
<span class="hits">1</span>
|
485
|
+
|
486
|
+
<code class="ruby"> class Color</code>
|
487
|
+
</li>
|
488
|
+
|
489
|
+
<li class="never" data-hits="" data-linenumber="6">
|
490
|
+
|
491
|
+
|
492
|
+
<code class="ruby"></code>
|
493
|
+
</li>
|
494
|
+
|
495
|
+
<li class="covered" data-hits="1" data-linenumber="7">
|
496
|
+
<span class="hits">1</span>
|
497
|
+
|
498
|
+
<code class="ruby"> if ENV['RACK_ENV'] == 'test'</code>
|
499
|
+
</li>
|
500
|
+
|
501
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
502
|
+
<span class="hits">1</span>
|
503
|
+
|
504
|
+
<code class="ruby"> include TextPower # c extension module</code>
|
505
|
+
</li>
|
506
|
+
|
507
|
+
<li class="covered" data-hits="2" data-linenumber="9">
|
508
|
+
<span class="hits">2</span>
|
509
|
+
|
510
|
+
<code class="ruby"> def _test_c_extension_!; test1 end # test1 method is native c method</code>
|
511
|
+
</li>
|
512
|
+
|
513
|
+
<li class="never" data-hits="" data-linenumber="10">
|
514
|
+
|
515
|
+
|
516
|
+
<code class="ruby"> end</code>
|
517
|
+
</li>
|
518
|
+
|
519
|
+
<li class="never" data-hits="" data-linenumber="11">
|
520
|
+
|
521
|
+
|
522
|
+
<code class="ruby"></code>
|
523
|
+
</li>
|
524
|
+
|
525
|
+
<li class="never" data-hits="" data-linenumber="12">
|
526
|
+
|
527
|
+
|
528
|
+
<code class="ruby"> end</code>
|
529
|
+
</li>
|
530
|
+
|
531
|
+
<li class="never" data-hits="" data-linenumber="13">
|
532
|
+
|
533
|
+
|
534
|
+
<code class="ruby">end</code>
|
535
|
+
</li>
|
536
|
+
|
537
|
+
<li class="never" data-hits="" data-linenumber="14">
|
538
|
+
|
539
|
+
|
540
|
+
<code class="ruby"></code>
|
541
|
+
</li>
|
542
|
+
|
543
|
+
</ol>
|
544
|
+
</pre>
|
545
|
+
</div>
|
546
|
+
|
547
|
+
<div class="source_table" id="ad8442bb6ed99b6304e04a7aba14ef3c59ad9050">
|
548
|
+
<div class="header">
|
549
|
+
<h3>test/super/power_color_test.rb</h3>
|
550
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
551
|
+
<div>
|
552
|
+
<b>6</b> relevant lines.
|
553
|
+
<span class="green"><b>6</b> lines covered</span> and
|
554
|
+
<span class="red"><b>0</b> lines missed.</span>
|
555
|
+
</div>
|
556
|
+
</div>
|
557
|
+
|
558
|
+
<pre>
|
559
|
+
<ol>
|
560
|
+
|
561
|
+
<li class="covered" data-hits="1" data-linenumber="1">
|
562
|
+
<span class="hits">1</span>
|
563
|
+
|
564
|
+
<code class="ruby">require 'test_helper'</code>
|
565
|
+
</li>
|
566
|
+
|
567
|
+
<li class="never" data-hits="" data-linenumber="2">
|
568
|
+
|
569
|
+
|
570
|
+
<code class="ruby"></code>
|
571
|
+
</li>
|
572
|
+
|
573
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
574
|
+
<span class="hits">1</span>
|
575
|
+
|
576
|
+
<code class="ruby">class Power::ColorTest < Minitest::Test</code>
|
577
|
+
</li>
|
578
|
+
|
579
|
+
<li class="never" data-hits="" data-linenumber="4">
|
580
|
+
|
581
|
+
|
582
|
+
<code class="ruby"></code>
|
583
|
+
</li>
|
584
|
+
|
585
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
586
|
+
<span class="hits">1</span>
|
587
|
+
|
588
|
+
<code class="ruby"> def test_c_native_extension</code>
|
589
|
+
</li>
|
590
|
+
|
591
|
+
<li class="covered" data-hits="1" data-linenumber="6">
|
592
|
+
<span class="hits">1</span>
|
593
|
+
|
594
|
+
<code class="ruby"> power_color = ::Power::Color.new</code>
|
595
|
+
</li>
|
596
|
+
|
597
|
+
<li class="covered" data-hits="1" data-linenumber="7">
|
598
|
+
<span class="hits">1</span>
|
599
|
+
|
600
|
+
<code class="ruby"> assert defined? ::Power::Color.new._test_c_extension_!</code>
|
601
|
+
</li>
|
602
|
+
|
603
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
604
|
+
<span class="hits">1</span>
|
605
|
+
|
606
|
+
<code class="ruby"> assert(power_color._test_c_extension_! == 10)</code>
|
607
|
+
</li>
|
608
|
+
|
609
|
+
<li class="never" data-hits="" data-linenumber="9">
|
610
|
+
|
611
|
+
|
612
|
+
<code class="ruby"> end</code>
|
613
|
+
</li>
|
614
|
+
|
615
|
+
<li class="never" data-hits="" data-linenumber="10">
|
616
|
+
|
617
|
+
|
618
|
+
<code class="ruby"></code>
|
619
|
+
</li>
|
620
|
+
|
621
|
+
<li class="never" data-hits="" data-linenumber="11">
|
622
|
+
|
623
|
+
|
624
|
+
<code class="ruby">end</code>
|
625
|
+
</li>
|
626
|
+
|
627
|
+
</ol>
|
628
|
+
</pre>
|
629
|
+
</div>
|
630
|
+
|
631
|
+
</div>
|
632
|
+
</div>
|
633
|
+
</body>
|
634
|
+
</html>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#include "ruby.h"
|
2
|
+
|
3
|
+
VALUE TextPower = Qnil;
|
4
|
+
VALUE method_test1(VALUE self);
|
5
|
+
|
6
|
+
void Init_text_power();
|
7
|
+
|
8
|
+
void Init_text_power() {
|
9
|
+
TextPower = rb_define_module("TextPower");
|
10
|
+
rb_define_method(TextPower, "test1", method_test1, 0);
|
11
|
+
}
|
12
|
+
|
13
|
+
VALUE method_test1(VALUE self) {
|
14
|
+
int x = 10; // todo add rainbow of color
|
15
|
+
return INT2NUM(x);
|
16
|
+
}
|
17
|
+
|
data/lib/mixin/string.rb
ADDED
data/lib/super/color.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require "super/color/version"
|
2
|
+
require_relative "../mixin/string"
|
3
|
+
require_relative "../text_power"
|
4
|
+
|
5
|
+
module Super
|
6
|
+
module Color
|
7
|
+
|
8
|
+
def red
|
9
|
+
"\e[31m#{self}\e[0m"
|
10
|
+
end
|
11
|
+
|
12
|
+
def green
|
13
|
+
"\e[92m#{self}\e[0m"
|
14
|
+
end
|
15
|
+
|
16
|
+
def yellow
|
17
|
+
"\e[93m#{self}\e[0m"
|
18
|
+
end
|
19
|
+
|
20
|
+
def magenta
|
21
|
+
"\e[35m#{self}\e[0m"
|
22
|
+
end
|
23
|
+
|
24
|
+
alias color_warning yellow
|
25
|
+
alias color_error red
|
26
|
+
alias color_success green
|
27
|
+
|
28
|
+
def puts_warning
|
29
|
+
puts yellow
|
30
|
+
end
|
31
|
+
|
32
|
+
def puts_success
|
33
|
+
puts green
|
34
|
+
end
|
35
|
+
|
36
|
+
def puts_error
|
37
|
+
puts red
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "super/color/version"
|
2
|
+
# require "super/text_power"
|
3
|
+
|
4
|
+
require_relative "../text_power"
|
5
|
+
# require File.expand_path('../../text_power', __FILE__)
|
6
|
+
|
7
|
+
|
8
|
+
module Power
|
9
|
+
class Color
|
10
|
+
|
11
|
+
if ENV['RACK_ENV'] == 'test'
|
12
|
+
include TextPower # c extension module
|
13
|
+
def _test_c_extension_!; test1 end # test1 method is native c method
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
Binary file
|
data/super-color.gemspec
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'super/color/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "super-color"
|
8
|
+
spec.version = Super::Color::VERSION
|
9
|
+
spec.authors = ["MVV90"]
|
10
|
+
spec.email = ["vincekmatt@gmail.com"]
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
spec.summary = %q{Simple gem to add color ASCII characters to any string for terminal output.}
|
14
|
+
spec.description = %q{Simple gem to add color to your fancy terminal ASCII characters. Extends string class. As easy as: puts "hi, i'm the color".red \n Supports colors red, yellow, green, magenta, as well as colors for warning, success, and error.}
|
15
|
+
spec.homepage = "https://github.com/MVV90/super-color"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
=begin
|
20
|
+
if spec.respond_to?(:metadata)
|
21
|
+
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
22
|
+
else
|
23
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
"public gem pushes."
|
25
|
+
end
|
26
|
+
=end
|
27
|
+
|
28
|
+
spec.extensions << "ext/text_power/extconf.rb"
|
29
|
+
|
30
|
+
spec.files = Dir.glob("ext/**/*.{c,rb}")
|
31
|
+
|
32
|
+
spec.files += `git ls-files -z`.split("\x0").reject do |f|
|
33
|
+
f.match(%r{^(test|spec|features)/})
|
34
|
+
end
|
35
|
+
|
36
|
+
spec.bindir = "exe"
|
37
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
|
+
spec.require_paths = ["lib"]
|
39
|
+
|
40
|
+
spec.add_development_dependency "rake-compiler"
|
41
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
42
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
43
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
44
|
+
|
45
|
+
end
|
46
|
+
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: super-color
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- MVV90
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake-compiler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.13'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.13'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.0'
|
69
|
+
description: 'Simple gem to add color to your fancy terminal ASCII characters. Extends
|
70
|
+
string class. As easy as: puts "hi, i''m the color".red \n Supports colors red,
|
71
|
+
yellow, green, magenta, as well as colors for warning, success, and error.'
|
72
|
+
email:
|
73
|
+
- vincekmatt@gmail.com
|
74
|
+
executables: []
|
75
|
+
extensions:
|
76
|
+
- ext/text_power/extconf.rb
|
77
|
+
extra_rdoc_files: []
|
78
|
+
files:
|
79
|
+
- ".gitignore"
|
80
|
+
- ".travis.yml"
|
81
|
+
- Gemfile
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- coverage/index.html
|
87
|
+
- ext/text_power/extconf.rb
|
88
|
+
- ext/text_power/text_power.c
|
89
|
+
- lib/mixin/string.rb
|
90
|
+
- lib/super/color.rb
|
91
|
+
- lib/super/color/version.rb
|
92
|
+
- lib/super/power_color.rb
|
93
|
+
- lib/text_power.bundle
|
94
|
+
- super-color.gemspec
|
95
|
+
homepage: https://github.com/MVV90/super-color
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.4.8
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: Simple gem to add color ASCII characters to any string for terminal output.
|
119
|
+
test_files: []
|
120
|
+
has_rdoc:
|