colorlog 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/colorlog +25 -5
- metadata +39 -1
data/bin/colorlog
CHANGED
@@ -34,11 +34,11 @@ end
|
|
34
34
|
|
35
35
|
option_parser.parse!
|
36
36
|
|
37
|
-
|
38
|
-
warning_check = Regexp.new(options[:yellow], Regexp::IGNORECASE)
|
39
|
-
error_check = Regexp.new(options[:red])
|
37
|
+
def color_print(line, options)
|
40
38
|
|
41
|
-
|
39
|
+
success_check = Regexp.new(options[:green], Regexp::IGNORECASE)
|
40
|
+
warning_check = Regexp.new(options[:yellow], Regexp::IGNORECASE)
|
41
|
+
error_check = Regexp.new(options[:red])
|
42
42
|
|
43
43
|
color = :default
|
44
44
|
|
@@ -52,4 +52,24 @@ ARGF.each do |line|
|
|
52
52
|
color = :red
|
53
53
|
end
|
54
54
|
printf("%s".foreground(color), line)
|
55
|
-
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
filename = ARGV.shift
|
59
|
+
|
60
|
+
if (filename.nil?)
|
61
|
+
if STDIN.tty?
|
62
|
+
puts "You should provide a file"
|
63
|
+
exit 1
|
64
|
+
end
|
65
|
+
|
66
|
+
ARGF.each do |line|
|
67
|
+
color_print(line,options)
|
68
|
+
end
|
69
|
+
else
|
70
|
+
File.open(File.expand_path(filename), 'r') do |file|
|
71
|
+
file.readlines.each do |line|
|
72
|
+
color_print(line,options)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: colorlog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -27,6 +27,38 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.9.2
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.9.2
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rdoc
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.12'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.12'
|
30
62
|
description: colorlog allow you to read a file with sone lines colored in red, green
|
31
63
|
and yellow based on regexp
|
32
64
|
email:
|
@@ -49,12 +81,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
81
|
- - ! '>='
|
50
82
|
- !ruby/object:Gem::Version
|
51
83
|
version: '0'
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
hash: -2189919106220471362
|
52
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
88
|
none: false
|
54
89
|
requirements:
|
55
90
|
- - ! '>='
|
56
91
|
- !ruby/object:Gem::Version
|
57
92
|
version: '0'
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
hash: -2189919106220471362
|
58
96
|
requirements: []
|
59
97
|
rubyforge_project:
|
60
98
|
rubygems_version: 1.8.24
|