blink_tm 2.0.0 → 2.1.0

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: 941ae55ced42e5243dd9a489783f1b02da24fcd9c29a9cf4e3f310ea26080fbc
4
- data.tar.gz: bf0c03acd5b71bddd03e0e717b8c1f12acd824668eb6e2e56948db9f055a9a67
3
+ metadata.gz: 290de1234088715cb8d957462afdd3a8f54c1c876f2b49ae35de7546cb352da8
4
+ data.tar.gz: e4a103649d1c326c86eb74931ca4a4796e150c186e9f6ef05926410d33ab31b2
5
5
  SHA512:
6
- metadata.gz: 00543e80f694b6a711f55aeacd7ab7175675273b513af336b3e3307c73a07ea21f9960a41a81bd285cd6023ff35fa2a2979552f0a7725d1580328808989ac2e6
7
- data.tar.gz: 03f51e941ee7531fd2dd29500383abe4d0d88af40b25208d2b2d5991fccae3a3b67954e2efa7aa6eacbb5ca1690230037220cde6d66ef3c5281385fc4ef1d8bb
6
+ metadata.gz: 7641d9d08838db8707dd75a327a417090ef0c0ecdddf0f458f34c5caeffb1406dde99272db73ad30d5e3ef288b348534b5834e09365ead845b4db34efa598c5d
7
+ data.tar.gz: 119773e1b395a46910267f6bee5f6c284a7bb3208953c40649c1d3981f31f6508f39b202d983a658ffedb7988b3dc4082be86c162df01b0063a0bf373352d4c9
data/exe/blink-tm CHANGED
@@ -64,5 +64,23 @@ rescue Interrupt, SystemExit, SignalException
64
64
  file &.close
65
65
  File.delete(BlinkTM::LOCKFILE)
66
66
  rescue Exception
67
+
68
+ mesg = <<~EOF
69
+ :: Time: #{Time.now.strftime("%A %d %B %Y, %H:%M:%S:%5N %p")}:
70
+ #{$!.full_message}
71
+
72
+ Please notify these bugs to the issue tracker.
73
+ #{'-' * 70}
74
+ EOF
75
+
76
+ if File.writable?(BlinkTM::LOGFILE)
77
+ log = File.open(BlinkTM::LOGFILE, 'a')
78
+ log.write(mesg)
79
+ log.close
80
+ else
81
+ puts "Logs aren't writable\n\nHere's a detailed message of what has happened:"
82
+ puts mesg
83
+ end
84
+ ensure
67
85
  File.delete(BlinkTM::LOCKFILE)
68
86
  end
@@ -83,7 +83,7 @@ module BlinkTM
83
83
  Thread.new {
84
84
  while true
85
85
  _cpu_u = LS::CPU.total_usage(POLLING).to_f
86
- cpu_u = _cpu_u.nan? ? 0 : _cpu_u.to_i
86
+ cpu_u = _cpu_u.nan? ? 255 : _cpu_u.to_i
87
87
  end
88
88
  }
89
89
 
@@ -150,10 +150,12 @@ module BlinkTM
150
150
  # disktotal(999990) diskused(999990)
151
151
 
152
152
  memstat = LS::Memory.stat
153
- mem_u = memstat[:used].to_i.*(1024).*(100).fdiv(memstat[:total].to_i * 1024).round
153
+ _mem_u = memstat[:used].to_i.*(1024).*(100).fdiv(memstat[:total].to_i * 1024)
154
+ mem_u = _mem_u.nan? ? 255 : _mem_u.round
154
155
 
155
156
  swapstat = LS::Swap.stat
156
- swap_u = swapstat[:used].to_i.*(1024).*(100).fdiv(swapstat[:total].to_i * 1024).round
157
+ _swap_u = swapstat[:used].to_i.*(1024).*(100).fdiv(swapstat[:total].to_i * 1024)
158
+ swap_u = _swap_u.nan? ? 255 : _swap_u.round
157
159
 
158
160
  # Output has to be exactly this long. If not, blink-taskmanager shows invalid result.
159
161
  # No string is split inside blink-task manager, it just depends on the string length.
@@ -163,9 +165,9 @@ module BlinkTM
163
165
  # ioWrite(9991) ioRead(9991)
164
166
 
165
167
  # Debugging string
166
- str = "#{"%03d" % cpu_u} #{"%03d" % mem_u} #{"%03d" % swap_u} "\
167
- "#{convert_bytes(net_u)} #{convert_bytes(net_d)} "\
168
- "#{convert_bytes(io_r)} #{convert_bytes(io_w)}"
168
+ # str = "#{"%03d" % cpu_u} #{"%03d" % mem_u} #{"%03d" % swap_u} "\
169
+ # "#{convert_bytes(net_u)} #{convert_bytes(net_d)} "\
170
+ # "#{convert_bytes(io_r)} #{convert_bytes(io_w)}"
169
171
 
170
172
  str = "!##{"%03d" % cpu_u}#{"%03d" % mem_u}#{"%03d" % swap_u}"\
171
173
  "#{convert_bytes(net_u)}#{convert_bytes(net_d)}"\
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlinkTM
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
data/lib/blink_tm.rb CHANGED
@@ -35,6 +35,7 @@ module BlinkTM
35
35
  BOLD = "\e[1m"
36
36
  RESET = "\e[0m"
37
37
  LOCKFILE = '/tmp/blinktaskmanager.pid'
38
+ LOGFILE = '/tmp/blinktaskmanager.err.log'
38
39
 
39
40
  # Other constants
40
41
  ROOT_DEV = ::LinuxStat::Mounts.root
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blink_tm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sourav Goswami
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-24 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: linux_stat
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  requirements: []
64
- rubygems_version: 3.2.29
64
+ rubygems_version: 3.3.8
65
65
  signing_key:
66
66
  specification_version: 4
67
67
  summary: A controller for Arduino OLED System Monitor, Blink Task Manager