yummi 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/bin/colorize +47 -0
- data/examples/license_box.rb +13 -3
- data/lib/yummi.rb +1 -1
- data/lib/yummi/table.rb +2 -2
- data/lib/yummi/version.rb +1 -1
- metadata +6 -4
data/.gitignore
CHANGED
data/bin/colorize
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# The MIT License
|
4
|
+
#
|
5
|
+
# Copyright (c) 2011 Marcelo Guimarães <ataxexe@gmail.com>
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
24
|
+
|
25
|
+
require_relative '../lib/yummi'
|
26
|
+
require 'optparse'
|
27
|
+
|
28
|
+
opt = OptionParser::new
|
29
|
+
opt.on '-c COLOR', '--color=COLOR', 'Colorize using the given color' do |color|
|
30
|
+
@color = color
|
31
|
+
end
|
32
|
+
opt.on '-t TEXT', '--text=TEXT', 'Colorize the given text' do |text|
|
33
|
+
@text = text
|
34
|
+
end
|
35
|
+
opt.on '-h', '--help', 'Display this help message' do
|
36
|
+
puts opt
|
37
|
+
exit 0
|
38
|
+
end
|
39
|
+
opt.parse! ARGV
|
40
|
+
|
41
|
+
if @color
|
42
|
+
if @text
|
43
|
+
puts Yummi::colorize @text, @color
|
44
|
+
end
|
45
|
+
else
|
46
|
+
abort 'Please give a color.'
|
47
|
+
end
|
data/examples/license_box.rb
CHANGED
@@ -48,10 +48,20 @@ opt.parse! ARGV
|
|
48
48
|
@box.line_break
|
49
49
|
@box.add 'Copyright (c) 2012 Marcelo Guimaraes <ataxexe@gmail.com>', :color => :green, :align => :center
|
50
50
|
@box.separator
|
51
|
-
@box.add 'Permission is hereby granted, free of charge, to any person obtaining a copy of
|
51
|
+
@box.add 'Permission is hereby granted, free of charge, to any person obtaining a copy of
|
52
|
+
this software and associated documentation files (the "Software"), to deal in the Software
|
53
|
+
without restriction, including without limitation the rights to use, copy, modify, merge,
|
54
|
+
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
55
|
+
to whom the Software is furnished to do so, subject to the following conditions:'
|
52
56
|
@box.line_break
|
53
|
-
@box.add 'The above copyright notice and this permission notice shall be included in all
|
57
|
+
@box.add 'The above copyright notice and this permission notice shall be included in all
|
58
|
+
copies or substantial portions of the Software.'
|
54
59
|
@box.separator :width => @box.width / 3, :align => :center
|
55
|
-
@box.add 'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
60
|
+
@box.add 'THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
61
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
62
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
63
|
+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
64
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
65
|
+
OTHER DEALINGS IN THE SOFTWARE.',
|
56
66
|
:color => :red
|
57
67
|
@box.print
|
data/lib/yummi.rb
CHANGED
data/lib/yummi/table.rb
CHANGED
@@ -313,9 +313,9 @@ module Yummi
|
|
313
313
|
row = @data[row_index]
|
314
314
|
_colors = []
|
315
315
|
_data = []
|
316
|
-
|
316
|
+
row = row.to_a if row.is_a? Range
|
317
317
|
row.each_index do |col_index|
|
318
|
-
next if @header and @header[0].size < col_index + 1
|
318
|
+
next if not @header.empty? and @header[0].size < col_index + 1
|
319
319
|
column = row[col_index]
|
320
320
|
colorizers = @colorizers[col_index]
|
321
321
|
if colorizers
|
data/lib/yummi/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yummi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,13 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05
|
12
|
+
date: 2012-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A tool to colorize your console application.
|
15
15
|
email:
|
16
16
|
- ataxexe@gmail.com
|
17
|
-
executables:
|
17
|
+
executables:
|
18
|
+
- colorize
|
18
19
|
extensions: []
|
19
20
|
extra_rdoc_files: []
|
20
21
|
files:
|
@@ -24,6 +25,7 @@ files:
|
|
24
25
|
- LICENSE
|
25
26
|
- README.md
|
26
27
|
- Rakefile
|
28
|
+
- bin/colorize
|
27
29
|
- examples/cash_flow_table.rb
|
28
30
|
- examples/license_box.rb
|
29
31
|
- examples/list_files.rb
|
@@ -56,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
58
|
version: '0'
|
57
59
|
requirements: []
|
58
60
|
rubyforge_project:
|
59
|
-
rubygems_version: 1.8.
|
61
|
+
rubygems_version: 1.8.24
|
60
62
|
signing_key:
|
61
63
|
specification_version: 3
|
62
64
|
summary: A tool to colorize your console application.
|