rsmp 0.42.6 → 0.42.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 258499bd592ac1a1f89d61b2a1456388f2874f163e76af9f5aa79dacac17f23b
4
- data.tar.gz: 9e04e8accdf3572136b0395c5fa33514c9191a2ce8241b3d13a22273ca8033c1
3
+ metadata.gz: f3ffec19f82ace8cc9b32f72199bcf56e9c57932186338e32769ae4d0dd45c92
4
+ data.tar.gz: 8365a49dc68cde741e5145c50a221a4c6fc95b17662bf267409e310aaf52e67e
5
5
  SHA512:
6
- metadata.gz: 53153b249a914a0f150b622462cd273068db9762a8e4aefbd998224f073cc71e99775cf10485464339121528aa624fe4b2a33a120e2769c599cc109b58358901
7
- data.tar.gz: 8d73ca04955d671b66194a23c9f6006e9a18b0c86e339d3648ddeb2e70271d3a168fe7e234bbbffe4897ae5cdf804463a902eaf62ea9999218f2e897216c79b8
6
+ metadata.gz: 4688a936549b44f9b1ba67ecb4c8ec53a9a544e2e106c62c479871606f29be9e09af4daafe9a6dbac4bc7b0ddacdd375ea39a2e39ec279fa01c3d4619bdbe669
7
+ data.tar.gz: b02bf6cdb3ff10113d84f194641793dd08bcef269e45ae61201787f09e78ebdb9acdf65139d89155b52a016da617def34e739efc5dce36c35216294638c0b54c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rsmp (0.42.6)
4
+ rsmp (0.42.8)
5
5
  async (~> 2.32)
6
6
  colorize (~> 1.1)
7
7
  io-endpoint (~> 0.15)
@@ -7,11 +7,3 @@ default:
7
7
  timeouts:
8
8
  watchdog: 0.2
9
9
  acknowledgement: 0.2
10
- log:
11
- port: true
12
- site_id: 9
13
- component: 2
14
- direction: false
15
- level: false
16
- debug: true
17
- json: true
@@ -4,36 +4,47 @@ module RSMP
4
4
  module Colorization
5
5
  def default_colors
6
6
  {
7
- 'info' => 'white',
8
- 'log' => 'light_blue',
9
- 'statistics' => 'light_black',
10
- 'warning' => 'light_yellow',
11
- 'error' => 'red',
12
- 'debug' => 'light_black',
13
- 'collect' => 'light_black'
7
+ 'error' => { 'color' => 'red' },
8
+ 'warning' => { 'color' => 'yellow' },
9
+ 'info' => { 'color' => 'white' },
10
+ 'log' => { 'color' => 'white', 'mode' => 'dim' },
11
+ 'statistics' => { 'color' => 'grey', 'mode' => 'dim' },
12
+ 'debug' => { 'color' => 'grey', 'mode' => 'dim' },
13
+ 'collect' => { 'color' => 'grey', 'mode' => 'dim' }
14
14
  }
15
15
  end
16
16
 
17
17
  def colorize_with_map(level, str, colors)
18
18
  color = colors[level.to_s]
19
- color ? str.colorize(color.to_sym) : str
19
+ return str unless color
20
+
21
+ if color.is_a?(Hash)
22
+ opts = {}
23
+ opts[:color] = color['color'].to_sym if color['color']
24
+ opts[:mode] = color['mode'].to_sym if color['mode']
25
+ str.colorize(opts)
26
+ else
27
+ str.colorize(color.to_sym)
28
+ end
20
29
  end
21
30
 
22
31
  def apply_hash_colors(level, str)
23
32
  colors = default_colors
24
- colors.merge! @settings['color'] if @settings['color'].is_a?(Hash)
33
+ style = @settings['style']
34
+ colors.merge!(style) if style.is_a?(Hash)
25
35
  colorize_with_map(level, str, colors)
26
36
  end
27
37
 
28
38
  def colorize(level, str)
29
- return str if @settings['color'] == false || @settings['color'].nil?
39
+ style = @settings['style']
40
+ return str if style == false || style.nil?
30
41
 
31
- if @settings['color'] == true || @settings['color'].is_a?(Hash)
42
+ if style == true || style.is_a?(Hash)
32
43
  apply_hash_colors(level, str)
33
44
  elsif %i[nack warning error].include?(level)
34
- str.colorize(@settings['color']).bold
45
+ str.colorize(style).bold
35
46
  else
36
- str.colorize @settings['color']
47
+ str.colorize style
37
48
  end
38
49
  end
39
50
  end
@@ -6,7 +6,6 @@ module RSMP
6
6
  return false if @settings['info'] == false && item[:level] == :info
7
7
  return false if @settings['debug'] != true && item[:level] == :debug
8
8
  return false if @settings['statistics'] != true && item[:level] == :statistics
9
- return false if @settings['test'] != true && item[:level] == :test
10
9
 
11
10
  true
12
11
  end
@@ -11,7 +11,7 @@ module RSMP
11
11
  'active' => true,
12
12
  'path' => nil,
13
13
  'stream' => nil,
14
- 'color' => true,
14
+ 'style' => true,
15
15
  'debug' => false,
16
16
  'statistics' => false,
17
17
  'hide_ip_and_port' => false,
@@ -115,15 +115,6 @@ module RSMP
115
115
  item[:ip] && item[:port] && @muted["#{item[:ip]}:#{item[:port]}"]
116
116
  end
117
117
 
118
- def level_enabled?(item)
119
- return false if @settings['info'] == false && item[:level] == :info
120
- return false if @settings['debug'] != true && item[:level] == :debug
121
- return false if @settings['statistics'] != true && item[:level] == :statistics
122
- return false if @settings['test'] != true && item[:level] == :test
123
-
124
- true
125
- end
126
-
127
118
  def output(level, str)
128
119
  return if str.empty? || /^\s+$/.match(str)
129
120
 
@@ -138,7 +138,7 @@ module RSMP
138
138
 
139
139
  def check_status_subscription(subscription, component, code, name, now)
140
140
  current, should_send = check_on_change_update(subscription, component, code, name)
141
- should_send ||= interval_update_due?(subscription, now)
141
+ should_send ||= interval_update_due?(subscription, now) if subscription[:interval].positive?
142
142
  return [nil, false] unless should_send
143
143
 
144
144
  subscription[:last_sent_at] = now
data/lib/rsmp/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module RSMP
2
- VERSION = '0.42.6'.freeze
2
+ VERSION = '0.42.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.42.6
4
+ version: 0.42.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Tin