seashell 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/seashell.rb +31 -10
- metadata +5 -5
data/lib/seashell.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
class Seashell
|
2
|
+
attr_writer :debug
|
3
|
+
|
2
4
|
def initialize
|
3
5
|
@indent = 0
|
4
6
|
end
|
5
7
|
|
6
|
-
def
|
8
|
+
def _indent
|
7
9
|
" " * @indent
|
8
10
|
end
|
9
11
|
|
@@ -15,13 +17,32 @@ class Seashell
|
|
15
17
|
@indent = (@indent - 1) unless @indent == 0
|
16
18
|
end
|
17
19
|
|
20
|
+
def _level(l, s)
|
21
|
+
l.upcase!
|
22
|
+
|
23
|
+
case l
|
24
|
+
when "ACTION"
|
25
|
+
l = _yellow(l)
|
26
|
+
when "INFO"
|
27
|
+
l = _pink(l)
|
28
|
+
when "DEBUG"
|
29
|
+
l = _cyan(l)
|
30
|
+
end
|
31
|
+
|
32
|
+
!@debug ? s : "#{l} #{s}"
|
33
|
+
end
|
34
|
+
|
18
35
|
def action(s)
|
19
|
-
print _level + s
|
36
|
+
print _level("action", _indent + s)
|
20
37
|
$stdout.flush
|
21
38
|
end
|
22
39
|
|
23
40
|
def msg(s)
|
24
|
-
puts _level + s
|
41
|
+
puts _level("info", _indent + s)
|
42
|
+
end
|
43
|
+
|
44
|
+
def debug(s)
|
45
|
+
puts _level("debug", _indent + s)
|
25
46
|
end
|
26
47
|
|
27
48
|
def tick
|
@@ -52,11 +73,11 @@ class Seashell
|
|
52
73
|
"\e[#{c}m#{s}\e[0m"
|
53
74
|
end
|
54
75
|
|
55
|
-
def _green(s)
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
def
|
60
|
-
|
61
|
-
end
|
76
|
+
def _green(s); _colorize(32, s); end
|
77
|
+
def _red(s); _colorize(31, s); end
|
78
|
+
def _cyan(s); _colorize(36, s); end
|
79
|
+
def _yellow(s); _colorize(33, s); end
|
80
|
+
def _blue(s); _colorize(34, s); end
|
81
|
+
def _pink(s); _colorize(35, s); end
|
82
|
+
def _white(s); _colorize(37, s); end
|
62
83
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Toby Lawrence
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2013-09-
|
17
|
+
date: 2013-09-04 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -29,7 +29,7 @@ extra_rdoc_files: []
|
|
29
29
|
files:
|
30
30
|
- lib/seashell.rb
|
31
31
|
has_rdoc: true
|
32
|
-
homepage: http://
|
32
|
+
homepage: http://github.com/tobz/seashell
|
33
33
|
licenses:
|
34
34
|
- MIT
|
35
35
|
post_install_message:
|
@@ -59,6 +59,6 @@ rubyforge_project:
|
|
59
59
|
rubygems_version: 1.3.7
|
60
60
|
signing_key:
|
61
61
|
specification_version: 3
|
62
|
-
summary:
|
62
|
+
summary: A library for making your Ruby scripts/programs look like run-of-the-mill init scripts... with a beautiful twist.
|
63
63
|
test_files: []
|
64
64
|
|