bogo-ui 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/bogo-ui/ui.rb +30 -7
- data/lib/bogo-ui/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3b0590b35fe55408c29d06199d38a4cee093be1
|
4
|
+
data.tar.gz: 9e132792deecf5dfd8889c1906bb4e4d449842dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b8659776fcc95c960715137f7811084ff760b4775d6bc21cddb9fda8c1f1bc32fc3ded7afc89e7714e22048bd5f7793b7533a56927e00b9900e6ffb36e835ce
|
7
|
+
data.tar.gz: e2870e89472fcd6414626e3acd3d7c16f3d5ebc5fb47abb47dd3ea4e0be7ffd2e167b42cd515900e8ce900dc320c334770c2014126d01f7ce23dae15dc2d1408
|
data/CHANGELOG.md
CHANGED
data/lib/bogo-ui/ui.rb
CHANGED
@@ -17,6 +17,8 @@ module Bogo
|
|
17
17
|
attr_reader :auto_confirm
|
18
18
|
# @return [Truthy, Falsey]
|
19
19
|
attr_reader :auto_default
|
20
|
+
# @return [Smash] options
|
21
|
+
attr_reader :options
|
20
22
|
|
21
23
|
# Build new UI instance
|
22
24
|
#
|
@@ -29,12 +31,9 @@ module Bogo
|
|
29
31
|
@application_name = args.fetch(:app_name, 'App')
|
30
32
|
@colorize = args.fetch(:colors, true)
|
31
33
|
@output_to = args.fetch(:output_to, $stdout)
|
32
|
-
@auto_confirm = args.fetch(:auto_confirm,
|
33
|
-
|
34
|
-
|
35
|
-
@auto_default = args.fetch(:auto_default,
|
36
|
-
args.fetch(:defaults, false)
|
37
|
-
)
|
34
|
+
@auto_confirm = args.fetch(:auto_confirm, args.fetch(:yes, false))
|
35
|
+
@auto_default = args.fetch(:auto_default, args.fetch(:defaults, false))
|
36
|
+
@options = args.to_smash
|
38
37
|
end
|
39
38
|
|
40
39
|
# Output directly
|
@@ -61,7 +60,8 @@ module Bogo
|
|
61
60
|
# @return [String]
|
62
61
|
def info(string, *args)
|
63
62
|
output_method = args.include?(:nonewline) ? :print : :puts
|
64
|
-
|
63
|
+
o_color = args.include?(:verbose) ? :yellow : :green
|
64
|
+
self.send(output_method, "#{color("[#{application_name}]:", o_color)} #{string}")
|
65
65
|
string
|
66
66
|
end
|
67
67
|
|
@@ -95,6 +95,29 @@ module Bogo
|
|
95
95
|
string
|
96
96
|
end
|
97
97
|
|
98
|
+
# Output info if verbose flag is set
|
99
|
+
#
|
100
|
+
# @param string [String]
|
101
|
+
# @return [String, NilClass]
|
102
|
+
def verbose(string, *args)
|
103
|
+
if(options[:verbose])
|
104
|
+
info(string, :verbose, *args)
|
105
|
+
string
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
# Format debug string and output only if debug is set
|
110
|
+
#
|
111
|
+
# @param string [String]
|
112
|
+
# @return [String, NilClass]
|
113
|
+
def debug(string, *args)
|
114
|
+
if(options[:debug])
|
115
|
+
output_method = args.include?(:nonewline) ? :print : :puts
|
116
|
+
self.send(output_method, "#{color('[DEBUG]:', :white, :bold)} #{string}")
|
117
|
+
string
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
98
121
|
# Colorize string
|
99
122
|
#
|
100
123
|
# @param string [String]
|
data/lib/bogo-ui/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bogo-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Roberts
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bogo
|