simple-cli 0.2.13 → 0.2.14

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
  SHA256:
3
- metadata.gz: 7a8b7f49b5bfb594b43af462b51ab40dc04b48a9b265fd670d3f69dbeb8bdc97
4
- data.tar.gz: a6299e4c3c7013ccf417e07e41daaecf140b959f14d22bc6cffc6bf4124b423f
3
+ metadata.gz: 5d714d999f8069077ef849bff674186ce9193c87eefe58ff16353e3bf4954d4b
4
+ data.tar.gz: 15a25e1c5a82904ca2a0dbf745ab5bf52e236e5994129a061f4c643048da7fc7
5
5
  SHA512:
6
- metadata.gz: 36db778e0f49116b86397138d86c743177a90365239000c425898c4856fcb4a03a7518752533005a5f8313aa4fbd825917e32b6d731a061b3173859d551c6f07
7
- data.tar.gz: 75ff1cd2e94085eea76beff0f4dc60cc175ada62c3cc1e9d0936e20f92cccbbb655fcfff543e8d01ae9087695145bba888eb4234db66e2e01835d278000f4dae
6
+ metadata.gz: a872e36574bd2f953a9f52454c7819f83def3423e73a9a4275b1dd86b79494cd78e4daf4ef1a18b45788bddb0e438a192c1afc7ae333f6f4454d0733488916a7
7
+ data.tar.gz: 4df8a912dd4006b0151ccef5d38151823007f567f34b546e2ccbb87226845803a5a657196d6705c2b0cce7f6070e7a30d983cd68161bd8c18997fa3ae2fc66e3
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
1
  coverage
2
2
  rdoc
3
3
  pkg
4
- log/test.logGemfile.lock
4
+ log/*log
5
+ Gemfile.lock
6
+ simple-cli*gem
@@ -38,24 +38,24 @@ module Simple::CLI::Logger::ColoredLogger
38
38
  success: :green,
39
39
  }
40
40
 
41
- def debug(msg, *args)
42
- log :debug, msg, *args
41
+ def debug(msg = nil, *args, &block)
42
+ log :debug, msg, *args, &block
43
43
  end
44
44
 
45
- def info(msg, *args)
46
- log :info, msg, *args
45
+ def info(msg, *args, &block)
46
+ log :info, msg, *args, &block
47
47
  end
48
48
 
49
- def warn(msg, *args)
50
- log :warn, msg, *args
49
+ def warn(msg, *args, &block)
50
+ log :warn, msg, *args, &block
51
51
  end
52
52
 
53
- def error(msg, *args)
54
- log :error, msg, *args
53
+ def error(msg, *args, &block)
54
+ log :error, msg, *args, &block
55
55
  end
56
56
 
57
- def success(msg, *args)
58
- log :success, msg, *args
57
+ def success(msg, *args, &block)
58
+ log :success, msg, *args, &block
59
59
  end
60
60
 
61
61
  private
@@ -68,11 +68,16 @@ module Simple::CLI::Logger::ColoredLogger
68
68
  success: ::Logger::INFO
69
69
  }
70
70
 
71
- def log(sym, msg, *args)
71
+ def log(sym, msg, *args, &block)
72
72
  log_level = level
73
73
  required_log_level = REQUIRED_LOG_LEVELS.fetch(sym)
74
74
  return if required_log_level < log_level
75
75
 
76
+ if msg.nil? && args.empty? && block
77
+ msg = yield
78
+ return if msg.nil?
79
+ end
80
+
76
81
  formatted_runtime = "%.3f secs" % (Time.now - @@started_at)
77
82
  msg = "[#{formatted_runtime}] #{msg}"
78
83
  unless args.empty?
@@ -1,5 +1,5 @@
1
1
  module Simple
2
2
  module CLI
3
- VERSION = "0.2.13"
3
+ VERSION = "0.2.14"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-12-18 00:00:00.000000000 Z
12
+ date: 2018-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake