color-output 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/color-output.rb +36 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4db30ed1d95919d4a989d2235260a847fa83507b
|
4
|
+
data.tar.gz: 321b7358cce239091321ba6ece62b37acae3e0c1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bf047338b905dfd22efc1cccc684f0da303816a517beec8d3a6b6f642a076fc75f0149351db301e2c4dfc15e45b4b9381d8d742172c2847839300b3cfa9b2c83
|
7
|
+
data.tar.gz: 13cc1b63fbbb3dd2277c3f063b9bc64c72026b5258cbf106d856ffde2a28b7ce26d7cf23334ba1ada89f99158a3d2ee68f5ae58575914d4cb3c347fbdd86f81c
|
data/lib/color-output.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
##
|
2
|
+
# Generate colorized output
|
3
|
+
class ColorOutput
|
4
|
+
##
|
5
|
+
# Define colors for text output
|
6
|
+
RED = '0;31'
|
7
|
+
GREEN = '0;32'
|
8
|
+
YELLOW = '0;33'
|
9
|
+
LINE_RULE = '=' * 70
|
10
|
+
|
11
|
+
WARNING = YELLOW
|
12
|
+
ERROR = YELLOW
|
13
|
+
SUCCESS = GREEN
|
14
|
+
|
15
|
+
##
|
16
|
+
# Display colorized output
|
17
|
+
def self.string(color, text)
|
18
|
+
"\e[#{color}m#{text}\e[0m"
|
19
|
+
end
|
20
|
+
|
21
|
+
##
|
22
|
+
# Display a colorized horizontal rule
|
23
|
+
def self.rule(color)
|
24
|
+
string(color, LINE_RULE)
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# Colorize specific words within a message
|
29
|
+
def self.message(msg)
|
30
|
+
msg.gsub!(/WARNING/, string(WARNING, 'WARNING'))
|
31
|
+
msg.gsub!(/NOTE/, string(WARNING, 'NOTE'))
|
32
|
+
msg.gsub!(/ERROR/, string(ERROR, 'ERROR'))
|
33
|
+
msg.gsub!(/SUCCESS/, string(SUCCESS, 'SUCCESS'))
|
34
|
+
msg
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: color-output
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Danny Knapp
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: dknapp@salesforce.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/color-output.rb
|
20
|
+
homepage: http://rubygems.org/gems/color-output
|
21
|
+
licenses:
|
22
|
+
- MIT
|
23
|
+
metadata: {}
|
24
|
+
post_install_message:
|
25
|
+
rdoc_options: []
|
26
|
+
require_paths:
|
27
|
+
- lib
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
requirements: []
|
39
|
+
rubyforge_project:
|
40
|
+
rubygems_version: 2.2.0
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Generate colorized console output
|
44
|
+
test_files: []
|