hackmac 1.10.0 → 1.11.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: 5d8b91e07ca88dc28f574608697201338b76a9c33bce86c6c92e49bfea49716b
4
- data.tar.gz: 38fbeec1739607ce09da13ce4f200a7c484479d0ed859bd5db2e8d4fb06b52ff
3
+ metadata.gz: f08f36e8e85de7ebec84d0e2f98334ae3f644ef48411852c0299c6b439d19702
4
+ data.tar.gz: f2659f7f42f980013730bf9efc6830ee98c3a99d7d1f3a92da5d3505aabf7312
5
5
  SHA512:
6
- metadata.gz: c2c4528dbf84320e01fdc90380bcb7eec65f38b28e885c499c2c7594eca0ddabe53a7ea70d47e983195d660936fb2c638f0203a2f23054b132e10dcf0c955395
7
- data.tar.gz: 2499348bd0baa5d217a77f6c4959f2a78a6693e52d93975cf305713203dc4c647c9d9c286b0f2a01bab75f8694d298d8ecbdd165ca87e126ff984ea9037b6c97
6
+ metadata.gz: 8fbb05e777bcf29ef66888ee69eb84bbdcc6f741400038e80b20eeff98d54bc6b41e8ab5360619535ac82f3ad58e06568cfb6fae879576c7d00a6e839a9f95f4
7
+ data.tar.gz: 143eda42ce454475b6d1f3e3a4a1e0fca43b220ddab12ad029d3a916261913ce4731da9c5ad48bde29de814b4a44a925764ead523b8b12c1d27f54638acf4056
data/CHANGES.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-10-26 v1.11.0
4
+
5
+ - Reduced minimum sleep duration in gfxmon from **1** second to **0.01**
6
+ seconds
7
+ - Changed sleep duration calculation in gfxmon to use `.to_f` instead of
8
+ `.to_i` for sub-second precision
9
+ - Updated `Hackmac::Graph` parameter handling:
10
+ - Clarified documentation for `color` and `color_secondary` parameters to
11
+ indicate `nil` values derive colors from the title
12
+ - Set default value for `sleep` parameter to **5** seconds
13
+ - Added `@raise [TypeError]` documentation for `sleep` parameter
14
+ - Converted `sleep` parameter to `Float` and validated it's non-negative
15
+ - Added validation and normalization for graph constructor parameters:
16
+ - Validated `adjust_brightness` to be either `:lighten` or `:darken`
17
+ - Converted `adjust_brightness` to symbol using `to_sym`
18
+ - Ensured `adjust_brightness_percentage` is a `Float`
19
+ - Fixed typo in error message for `resolution` parameter
20
+ - Added `-f` and `-b` command-line options to `gfxmon` for foreground and
21
+ background colors
22
+ - Default foreground color is `:white` and background color is `:black`
23
+ - Updated `Hackmac::Graph` class to accept `foreground_color` and
24
+ `background_color` parameters
25
+ - Modified rendering logic to use `@background_color` instead of hardcoded
26
+ `0` for background color
27
+ - Updated help text to document the new `-f` and `-b` options
28
+ - Added `-r` command-line option to `gfxmon` with values `single` or `double`
29
+ - Default resolution is `:double`
30
+ - Updated `Hackmac::Graph` class to accept and validate `resolution`
31
+ parameter
32
+ - Used spaces (`' '`) for `:single` resolution to display lower resolution
33
+ - Added `ArgumentError` validation for invalid resolution values
34
+ - Updated help text to document the new `-r` option
35
+ - Removed redundant `@return` tags from documentation
36
+
3
37
  ## 2025-10-25 v1.10.0
4
38
 
5
39
  - Added `-C` command line option to specify secondary color for terminal
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.10.0
1
+ 1.11.0
data/bin/gfxmon CHANGED
@@ -32,7 +32,13 @@ require 'amatch'
32
32
  require 'search_ui'
33
33
  include SearchUI
34
34
 
35
- $opts = go 'c:C:m:n:jlh', defaults: { ?s => true, ?n => 5 }
35
+ $opts = go 'c:C:m:n:f:b:r:jlh', defaults: {
36
+ ?s => true,
37
+ ?n => 5,
38
+ ?r => :double,
39
+ ?f => :white,
40
+ ?b => :black,
41
+ }
36
42
 
37
43
  # The usage method displays command-line usage information and options
38
44
  #
@@ -47,13 +53,16 @@ def usage
47
53
 
48
54
  OPTIONS are
49
55
 
50
- -h this help
51
- -l output GPU performance data as list
52
- -j output GPU performance data as json
53
- -n SECONDS measure every SECONDS
54
- -m METRIC output graph for performance METRIC
55
- -c COLOR output graph in this terminal COLOR (between 0 - 255)
56
- -C COLOR output graph using secondary color COLOR
56
+ -h this help
57
+ -l output GPU performance data as list
58
+ -j output GPU performance data as json
59
+ -n SECONDS measure every SECONDS
60
+ -m METRIC output graph for performance METRIC
61
+ -c COLOR output graph in this terminal COLOR (between 0 - 255)
62
+ -C COLOR output graph using secondary color COLOR
63
+ -f COLOR foreground color (used for text)
64
+ -b COLOR background color (used for background)
65
+ -r RESOLUTION is either single or double (uses half blocks)
57
66
 
58
67
  EOT
59
68
  0
@@ -174,14 +183,17 @@ end
174
183
  # @see derive_formatter
175
184
  def display_graph
176
185
  if metric = choose_metric(ps)
177
- sleep_duration = [ 1, ($opts[?n] || 10).to_i ].max
186
+ sleep_duration = [ 0.01, ($opts[?n] || 10).to_f ].max
178
187
  format_value = derive_formatter(metric)
179
188
  graph = Hackmac::Graph.new(
180
- title: metric,
181
- sleep: sleep_duration,
182
- value: -> _ { ps[metric] || 0 },
183
- color: $opts[?c],
184
- color_secondary: $opts[?C],
189
+ title: metric,
190
+ sleep: sleep_duration,
191
+ value: -> _ { ps[metric] || 0 },
192
+ color: $opts[?c],
193
+ color_secondary: $opts[?C],
194
+ foreground_color: $opts[?f],
195
+ background_color: $opts[?b],
196
+ resolution: $opts[?r],
185
197
  format_value:
186
198
  )
187
199
  graph.start
data/hackmac.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: hackmac 1.10.0 ruby lib
2
+ # stub: hackmac 1.11.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "hackmac".freeze
6
- s.version = "1.10.0".freeze
6
+ s.version = "1.11.0".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]
@@ -48,8 +48,6 @@ module Hackmac
48
48
  #
49
49
  # @param name [ String ] the path to the compressed file to be decompressed
50
50
  #
51
- # @return [ void ] Returns nothing, but performs system decompression operations
52
- #
53
51
  # @raise [ RuntimeError ] raised when the file extension is not supported or
54
52
  # decompression commands fail
55
53
  def decompress(name)
data/lib/hackmac/graph.rb CHANGED
@@ -40,8 +40,7 @@ class Hackmac::Graph
40
40
  include Term::ANSIColor
41
41
  include Hackmac::Graph::Formatters
42
42
 
43
- # The initialize method sets up a Graph instance by configuring its display
44
- # parameters and internal state.
43
+ # The initialize method sets up a Graph instance by configuring its display parameters and internal state.
45
44
  #
46
45
  # This method configures the graph visualization with title, value provider,
47
46
  # formatting options, update interval, and color settings. It initializes
@@ -54,44 +53,61 @@ class Hackmac::Graph
54
53
  # @param format_value [ Proc, Symbol, nil ] formatting strategy for
55
54
  # displaying values
56
55
  # @param sleep [ Numeric ] time in seconds between updates
57
- # @param color [ Integer, Proc, nil ] color index or proc to determine color
58
- # dynamically
59
- # @param color_secondary [ Integer, Proc, nil ] secondary color index or proc
60
- # for enhanced visuals
56
+ # @param color [ Object, Proc, nil ] color or proc or nil. nil
57
+ # determineicolor dynamically from the title
58
+ # @param color_secondary [ Object, nil ] secondary color or nil
59
+ # for enhanced visuals, nil derives secondary color from (primary) color
61
60
  # @param adjust_brightness [ Symbol ] the method to call on the color for
62
- # brightness adjustment
63
- # @param adjust_brightness_percentage [ Integer ] the percentage value to use
61
+ # brightness adjustment (:lighten or :darken), defaults to :lighten
62
+ # @param adjust_brightness_percentage [ Float ] the percentage value to use
64
63
  # for the brightness adjustment
65
64
  # @param foreground_color [ Symbol ] the default text color for the display
66
65
  # @param background_color [ Symbol ] the default background color for the
67
66
  # display
67
+ # @param resolution [ Symbol ] the resolution mode (:single or :double) for
68
+ # the graph display, defaults to :double.
68
69
  #
69
70
  # @raise [ ArgumentError ] if the sleep parameter is negative
71
+ # @raise [ TypeError ] if the sleep parameter is not numeric
72
+ # @raise [ ArgumentError ] if the resolution parameter is not :single or :double
70
73
  def initialize(
71
74
  title:,
72
75
  value: -> i { 0 },
73
76
  format_value: nil,
74
- sleep: nil,
77
+ sleep: 5,
75
78
  color: nil,
76
79
  color_secondary: nil,
77
80
  adjust_brightness: :lighten,
78
81
  adjust_brightness_percentage: 15,
79
82
  foreground_color: :white,
80
- background_color: :black
83
+ background_color: :black,
84
+ resolution: :double
81
85
  )
82
- sleep >= 0 or raise ArgumentError, 'sleep has to be >= 0'
83
86
  @title = title
84
87
  @value = value
85
88
  @format_value = format_value
89
+ sleep = Float(sleep)
90
+ sleep >= 0 or raise ArgumentError, 'sleep has to be >= 0'
86
91
  @sleep = sleep
87
92
  @continue = false
88
93
  @data = []
89
94
  @color = color
90
95
  @color_secondary = color_secondary
91
- @adjust_brightness = adjust_brightness
92
- @adjust_brightness_percentage = adjust_brightness_percentage
96
+ adjust_brightness = adjust_brightness.to_sym
97
+ if %i[ lighten darken ].include? adjust_brightness
98
+ @adjust_brightness = adjust_brightness
99
+ else
100
+ raise ArgumentError, 'adjust_brightness required to be either :lighten or :darken'
101
+ end
102
+ @adjust_brightness_percentage = Float(adjust_brightness_percentage)
93
103
  @foreground_color = foreground_color
94
104
  @background_color = background_color
105
+ resolution = resolution.to_sym
106
+ if %i[ single double ].include? resolution
107
+ @resolution = resolution
108
+ else
109
+ raise ArgumentError, 'resolution required to be either :single or :double'
110
+ end
95
111
  @mutex = Mutex.new
96
112
  end
97
113
 
@@ -145,12 +161,17 @@ class Hackmac::Graph
145
161
  if iy > y
146
162
  @display.at(iy, x).on_color(color_secondary).write(' ')
147
163
  else
148
- fract = 1 - (y0 - y0.floor).abs
149
- case
150
- when (0...0.5) === fract
151
- @display.at(iy, x).on_color(0).color(color).write(?▄)
164
+ case @resolution
165
+ when :double
166
+ fract = 1 - (y0 - y0.floor).abs
167
+ case
168
+ when (0...0.5) === fract
169
+ @display.at(iy, x).on_color(@background_color).color(color).write(?▄)
170
+ else
171
+ @display.at(iy, x).on_color(color).color(color_secondary).write(?▄)
172
+ end
152
173
  else
153
- @display.at(iy, x).on_color(color).color(color_secondary).write(?▄)
174
+ @display.at(iy, x).on_color(color).color(color_secondary).write(' ')
154
175
  end
155
176
  end
156
177
  end
@@ -352,9 +373,6 @@ class Hackmac::Graph
352
373
  # When the DEBUG_BYTESIZE environment variable is set, it also outputs
353
374
  # debugging information about the size of the diff and the time elapsed since
354
375
  # the last debug output
355
- #
356
- # @return [ void ] Returns nothing but performs terminal output operations
357
- # and updates internal display state
358
376
  def perform_display_diff
359
377
  @mutex.synchronize do
360
378
  unless @old_display && @old_display.dimensions == @display.dimensions
@@ -47,8 +47,6 @@ module Hackmac
47
47
  # installation paths, and performing the actual file replacement after user
48
48
  # confirmation
49
49
  #
50
- # @return [ void ] Returns nothing but performs file system operations and
51
- # user interaction
52
50
  # @raise [ RuntimeError ] raised when a remote download fails or when no
53
51
  # source is defined for the kext
54
52
  def perform
@@ -28,8 +28,6 @@ module Hackmac
28
28
  #
29
29
  # @param mdev [ String ] the mount device identifier for the EFI partition
30
30
  # @param config [ Object ] the configuration object containing OpenCore settings including the EFI path
31
- #
32
- # @return [ void ] Returns nothing but initializes instance variables for the upgrade process
33
31
  def initialize(mdev:, config:)
34
32
  @config = config
35
33
  mount_path = Pathname.new('/Volumes').join(mdev)
@@ -45,8 +43,6 @@ module Hackmac
45
43
  # operations to replace existing EFI files after ensuring
46
44
  # the installation directory is properly configured
47
45
  #
48
- # @return [ void ] Returns nothing but performs file system operations and
49
- # user interaction
50
46
  # @raise [ RuntimeError ] raised when a remote download fails or when no
51
47
  # source is defined for the OpenCore upgrade
52
48
  def perform
data/lib/hackmac/plist.rb CHANGED
@@ -26,8 +26,6 @@ module Hackmac
26
26
  # \@plist instance variable for later access through other methods.
27
27
  #
28
28
  # @param cmd [Array<String>] command and arguments to execute
29
- #
30
- # @return [void] Returns nothing, but sets the @plist instance variable
31
29
  def plist(*cmd)
32
30
  @plist = ::Plist.parse_xml(`#{Shellwords.join(cmd)}`)
33
31
  end
@@ -1,6 +1,6 @@
1
1
  module Hackmac
2
2
  # Hackmac version
3
- VERSION = '1.10.0'
3
+ VERSION = '1.11.0'
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.10.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank