rbbt-util 5.26.141 → 5.26.142
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/util/config.rb +5 -1
- data/lib/rbbt/util/log/progress.rb +11 -1
- data/lib/rbbt/util/log/progress/report.rb +1 -1
- data/test/rbbt/util/test_config.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fddb36a8c680b822b0282e4de2e9742b892376fb2b10d9af36be70aa5ec466f9
|
4
|
+
data.tar.gz: c22a9b145937dc65edf98f7e6e5c97bb7441a73fed8df39437a402193df0b080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ed646c095003525fb0b91b8e81ebcfadcd51b730f3f273452565234e57f428ee6b93b3c8e83406673b70d8ed62e28deffc4c8300e30c0f460c4409fc07801de
|
7
|
+
data.tar.gz: 312a01dc5c7351b0838eebf93d0741f101fcea01760832a05ec47456b3d1d4501310cccd86f92aefb8b5e74d5ed3d2523c637601d6f5421d710c1d6dee0ff853
|
data/lib/rbbt/util/config.rb
CHANGED
@@ -69,6 +69,7 @@ module Rbbt::Config
|
|
69
69
|
priorities = {}
|
70
70
|
entries.each do |tokens, value|
|
71
71
|
best_prio = nil
|
72
|
+
tokens = [tokens] unless Array === tokens
|
72
73
|
tokens.each do |tok|
|
73
74
|
tok, prio = token_priority tok
|
74
75
|
best_prio = prio if best_prio.nil? or best_prio > prio
|
@@ -120,7 +121,10 @@ module Rbbt::Config
|
|
120
121
|
end
|
121
122
|
|
122
123
|
def self.with_config
|
123
|
-
saved_config =
|
124
|
+
saved_config = {}
|
125
|
+
CACHE.each do |k,v|
|
126
|
+
saved_config[k] = v.dup
|
127
|
+
end
|
124
128
|
saved_got_keys = GOT_KEYS.dup
|
125
129
|
begin
|
126
130
|
yield
|
@@ -2,6 +2,16 @@ require 'rbbt/util/log'
|
|
2
2
|
require 'rbbt/util/log/progress/util'
|
3
3
|
require 'rbbt/util/log/progress/report'
|
4
4
|
module Log
|
5
|
+
|
6
|
+
def self.no_bar=(value)
|
7
|
+
@@no_bar = value
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.no_bar
|
11
|
+
@@no_bar = false unless defined?(@@no_bar)
|
12
|
+
@@no_bar || ENV["RBBT_NO_PROGRESS"] == "true"
|
13
|
+
end
|
14
|
+
|
5
15
|
class ProgressBar
|
6
16
|
|
7
17
|
attr_accessor :max, :ticks, :frequency, :depth, :desc, :file, :bytes
|
@@ -34,7 +44,7 @@ module Log
|
|
34
44
|
end
|
35
45
|
|
36
46
|
def tick(step = 1)
|
37
|
-
return if
|
47
|
+
return if Log.no_bar
|
38
48
|
@ticks += step
|
39
49
|
|
40
50
|
time = Time.now
|
@@ -14,5 +14,21 @@ class TestConfig < Test::Unit::TestCase
|
|
14
14
|
def test_prio
|
15
15
|
assert_equal 5, Rbbt::Config.get(:cpus, :slow, :test)
|
16
16
|
end
|
17
|
+
|
18
|
+
def test_with_config
|
19
|
+
Rbbt::Config.add_entry 'key', 'valueA', 'token'
|
20
|
+
assert_equal "valueA", Rbbt::Config.get('key', 'token')
|
21
|
+
assert_equal "default", Rbbt::Config.get('key2', 'token', :default => 'default')
|
22
|
+
|
23
|
+
Rbbt::Config.with_config do
|
24
|
+
Rbbt::Config.add_entry 'key', 'valueB', 'token'
|
25
|
+
Rbbt::Config.add_entry 'key2', 'valueB2', 'token'
|
26
|
+
assert_equal "valueB", Rbbt::Config.get('key', 'token')
|
27
|
+
assert_equal "valueB2", Rbbt::Config.get('key2', 'token', :default => 'default')
|
28
|
+
end
|
29
|
+
|
30
|
+
assert_equal "valueA", Rbbt::Config.get('key', 'token')
|
31
|
+
assert_equal "default", Rbbt::Config.get('key2', 'token', :default => 'default')
|
32
|
+
end
|
17
33
|
end
|
18
34
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.26.
|
4
|
+
version: 5.26.142
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|