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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c2b6c91279292d5f7b9eedf22c7f45e09311cf3
4
- data.tar.gz: e66d24c3cace23c0bd65d3bc1761cd611d51e409
3
+ metadata.gz: f3b0590b35fe55408c29d06199d38a4cee093be1
4
+ data.tar.gz: 9e132792deecf5dfd8889c1906bb4e4d449842dc
5
5
  SHA512:
6
- metadata.gz: 16522be239637ea35788146691c56bdbdf67800f06e2affebf11218b903303552bbd6524e5ecdafc135b7ce69a93735ec1a3b24209c793f53cbb915813f4d178
7
- data.tar.gz: e62846b1f7692904b970591f5ccb8a9db290243e426733054cc9a9b5d85a15b8b081da55a6fbf68ff6c3bc56f94eca390e6660afcb5986c16f60fbf0e40a24fa
6
+ metadata.gz: 3b8659776fcc95c960715137f7811084ff760b4775d6bc21cddb9fda8c1f1bc32fc3ded7afc89e7714e22048bd5f7793b7533a56927e00b9900e6ffb36e835ce
7
+ data.tar.gz: e2870e89472fcd6414626e3acd3d7c16f3d5ebc5fb47abb47dd3ea4e0be7ffd2e167b42cd515900e8ce900dc320c334770c2014126d01f7ce23dae15dc2d1408
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.1.8
2
+ * Add `Ui#debug` output method
3
+ * Add `Ui#verbose` output method
4
+
1
5
  ## v0.1.6
2
6
  * Include `Ui#fatal` output method
3
7
  * Add helper into `Ui` directly for building new tables
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
- args.fetch(:yes, false)
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
- self.send(output_method, "#{color("[#{application_name}]:", :green)} #{string}")
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]
@@ -1,6 +1,6 @@
1
1
  module Bogo
2
2
  class Ui
3
3
  # Current library version
4
- VERSION = Gem::Version.new('0.1.6')
4
+ VERSION = Gem::Version.new('0.1.8')
5
5
  end
6
6
  end
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.6
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-02-12 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo