hackmac 1.9.0 → 1.9.1

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: a3965cb839d08ac229629f87ffe259ff8b0ac39a084b25ce2530b2a0eedfab10
4
- data.tar.gz: ff2e1a574431fc027ae09fabf3c31eb41b0c16df1f9f5825995cca48123c8b6e
3
+ metadata.gz: 6a8737823bd35d4307645c94d45e0232b29e9bd174a173959d083bddf20635e8
4
+ data.tar.gz: eb8e1c697851e2c55b48dd568f222e9b6355c6d3ca957456239b0721999b8351
5
5
  SHA512:
6
- metadata.gz: '018e26bd422ca4405ff37e00719f1238251bb993dbd323cb34351cee6397f378ce3f4972596b26e3987f01ac5fa199f1e8381a2cb24f2fb6cfc29a87254830af'
7
- data.tar.gz: d805a9175d7667ff349883b55d120e1d78f0b039af493afd829906e2cc15ac65e0fc153df4eb1454c0d1745f20ce0f05eaa91246a9dcfbe21dec3089555309f6
6
+ metadata.gz: bb1c5bee6a66eaba86b7cf8bc085bd46c46b19aca8e87590f2e8741d3c41d24f8b18a8d539473cc0f2ce359a79d58ad9456f1b68a2ba803b1c4ce07cacd031c3
7
+ data.tar.gz: a17a0d413c60c1dfd82535c4a179902f80fb4f5e860e46fb60750d89b139694d962b2af07fbe8d1986a331701e16929b91a0586283fa521d6a0a6a4c00094dc4
data/CHANGES.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-10-25 v1.9.1
4
+
5
+ - Addresses display issues in tmux panes where background colors bled through
6
+ due to changed character rendering
7
+ - Updated `ps` method to return an empty hash `{}` instead of raising an error
8
+ when `PerformanceStatistics` key doesn't exist in IORegistry
9
+ - Added `exist?` method to the `Hackmac` module to check if plist data is
10
+ loaded, returning `@plist` instance variable or `nil` if no data is available
11
+ - Ensured the returned value is always a hash in the `ps` method
12
+ - Modified `ps` method to handle nil values from `ps[metric]` by defaulting to
13
+ **0** to prevent potential errors when metric data is missing from the
14
+ process snapshot
15
+
16
+ ## 2025-10-23 v1.9.0
17
+
18
+ - Added `draw_graph` method to render data using Unicode block characters (`▀`)
19
+ - Introduced `data_range` helper to calculate data value range as `Float`
20
+ - Refactored `start_loop` to use `draw_graph` instead of inline rendering logic
21
+ - Moved color calculation and `y_width` logic into `draw_graph` method
22
+ - Replaced direct graph drawing in `start_loop` with call to `draw_graph`
23
+ - Implemented `data_range.zero?` check to handle flat data scenarios
24
+ - Added fractional pixel blending for visual appeal
25
+ - Used `color.to_rgb_triple.to_hsl_triple.lighten(15)` for background shading
26
+ - Added fallback handling for color conversion errors with `rescue color`
27
+ - Supported terminal graphics with 2px vertical resolution using Unicode characters
28
+ - Updated `@display.at(iy, x)` calls with color styling for graph rendering
29
+ - Removed duplicate `pick_color` method
30
+ - Added YARD documentation for `Hackmac::Config::DEFAULT`, `Hackmac::GithubSource::GITHUB_API_URL`, and `Hackmac::Graph::Display::ANSI` constants
31
+ - Updated module documentation with project description and features
32
+ - Refactored Graph formatters into separate `Hackmac::Graph::Formatters` module
33
+ - Refactored `Hackmac::Graph::Display::Cell` class into separate file `lib/hackmac/graph/display/cell.rb`
34
+
3
35
  ## 2025-10-15 v1.8.8
4
36
 
5
37
  ### Features
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.9.0
1
+ 1.9.1
data/bin/gfxmon CHANGED
@@ -19,8 +19,6 @@
19
19
  # gfxmon -n 3 # Update every 3 seconds
20
20
  # gfxmon -m "Temperature(C)" # Show specific metric
21
21
 
22
- require 'tins'
23
- include Tins::GO
24
22
  require 'term/ansicolor'
25
23
  Term::ANSIColor.true_coloring = ENV['COLORTERM'] =~ /\A(truecolor|24bit)\z/
26
24
  include Term::ANSIColor
@@ -29,6 +27,7 @@ class String
29
27
  end
30
28
  require 'hackmac'
31
29
  include Hackmac
30
+ include Tins::GO
32
31
  require 'amatch'
33
32
  require 'search_ui'
34
33
  include SearchUI
@@ -67,7 +66,12 @@ end
67
66
  # @return [ Hash ] a hash containing the performance statistics data from the
68
67
  # IORegistry
69
68
  def ps
70
- Hackmac::IOReg.new(key: 'PerformanceStatistics').as_hash
69
+ ioreg = Hackmac::IOReg.new(key: 'PerformanceStatistics')
70
+ if ioreg.exist?
71
+ ioreg.as_hash
72
+ else
73
+ {}
74
+ end
71
75
  end
72
76
 
73
77
  # The list method displays a formatted key-value pair listing with colored
@@ -174,7 +178,7 @@ def display_graph
174
178
  graph = Hackmac::Graph.new(
175
179
  title: metric,
176
180
  sleep: sleep_duration,
177
- value: -> _ { ps[metric] },
181
+ value: -> _ { ps[metric] || 0 },
178
182
  color: $opts[?c],
179
183
  format_value:
180
184
  )
data/hackmac.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: hackmac 1.9.0 ruby lib
2
+ # stub: hackmac 1.9.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "hackmac".freeze
6
- s.version = "1.9.0".freeze
6
+ s.version = "1.9.1".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
data/lib/hackmac/graph.rb CHANGED
@@ -122,9 +122,9 @@ class Hackmac::Graph
122
122
  fract = 1 - (y0 - y0.floor).abs
123
123
  case
124
124
  when (0...0.5) === fract
125
- @display.at(iy, x).color(0).on_color(color).write(?▀)
125
+ @display.at(iy, x).on_color(0).color(color).write(?▄)
126
126
  else
127
- @display.at(iy, x).color(color).on_color(color_light).write(?▀)
127
+ @display.at(iy, x).on_color(color).color(color_light).write(?▄)
128
128
  end
129
129
  end
130
130
  end
data/lib/hackmac/plist.rb CHANGED
@@ -32,6 +32,17 @@ module Hackmac
32
32
  @plist = ::Plist.parse_xml(`#{Shellwords.join(cmd)}`)
33
33
  end
34
34
 
35
+ # The exist? method checks whether plist data has been loaded
36
+ #
37
+ # This method returns a truthy value if plist data has been successfully
38
+ # parsed and stored in the instance variable, or nil if no plist data is
39
+ # available.
40
+ #
41
+ # @return [ Object, nil ] returns the plist data if present, nil otherwise
42
+ def exist?
43
+ @plist
44
+ end
45
+
35
46
  # Returns a duplicate of the internal plist hash
36
47
  #
37
48
  # This method provides access to the parsed plist data by returning a shallow copy
@@ -40,7 +51,7 @@ module Hackmac
40
51
  #
41
52
  # @return [ Hash ] a duplicate of the plist hash containing the parsed XML data
42
53
  def as_hash(*a)
43
- @plist.dup
54
+ @plist.dup.to_h
44
55
  end
45
56
 
46
57
  # The each method iterates over the parsed plist data
@@ -1,6 +1,6 @@
1
1
  module Hackmac
2
2
  # Hackmac version
3
- VERSION = '1.9.0'
3
+ VERSION = '1.9.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackmac
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank