hackmac 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0919dce412f314296c00fc6f8bf87bf142b90cef6a437c1a25839fffd58bfee2'
4
- data.tar.gz: cb3447775d1e0bc7da5e9f3bf0792dbd0428cba875124a3ae9da8c0006daa0f3
3
+ metadata.gz: e9e7cfe2bc42ae2f7aee8ac43d49c52814629c99c119eb96ac20a5e932cd3831
4
+ data.tar.gz: 9f85ee573b12bca903db7bfa12e090d5fab5d5037a81f76fb29269ff908ca5a6
5
5
  SHA512:
6
- metadata.gz: f45f0701f57c0f7ff66c2d221275291645236d0f5591cfb569f37be457d3da85de796c0a75d4dfd23b76fbc5f3c3d707dcdc8d9ff6b5a008a06c3353aa590043
7
- data.tar.gz: c343b4b6a791cfa69718a717a41b84c9fdd48e4c31d1562187511b0a450c6a4e41a3320a55e9adf16514a5f8e1ed8afd7df2753b732bf7b4fcbfc46d28bcc152
6
+ metadata.gz: a3ff124867aec02b6b9270d80471773be1a7af032caf4262935e1241a1d7b49d6c1c6d2952902c70a690ed16a28fb56a75349ca54b10f518c396bde537e37e56
7
+ data.tar.gz: e133326410563546d46235ceca5d1519e05cd3fc983386679460b95fbda59b6dcdc802d06558e00812815b2d76b854c5890ca25c66fedef9977822fbf8158ac2
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright 2019-2023 Florian Frank
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
data/README.md CHANGED
@@ -0,0 +1,55 @@
1
+ # HackMac
2
+
3
+ ## Description
4
+
5
+ Some ruby tools for working with a Hackintosh, which also might be (partially)
6
+ useful an a regular Mac.
7
+
8
+ ## Tools
9
+
10
+ - `efi` is a tool to work with OpenCore EFI partitions, that is upgrading
11
+ OpenCore and Kexts and commiting to its git repository.
12
+ - `usb` can be used to create a bootable USB containing a MacOs release and
13
+ uses an EFI partition cloned from a git repository.
14
+ - `gfxmon` dispays performance statistics for your AMD GPU in the terminal,
15
+ that is temperature, clock rate, fan rotations, memory and power usage as
16
+ provided by MacOS, see the screenshot:
17
+ ![gfxmon Screenshot](./img/gfxmon.png "gfxmon Screenshot")
18
+
19
+
20
+ ## Installation
21
+
22
+ You can use rubygems to fetch the gem and install it for you:
23
+
24
+ # gem install hackmac
25
+
26
+ You can also put this line into your Gemfile
27
+
28
+ gem 'hackmac'
29
+
30
+ # Configuration
31
+
32
+ First start `efi` without arguments this will display the available commands,
33
+ but also initializes a default configuration file in
34
+ `~/.config/hackmac/hackmac.yml` to get you started. If you want work with
35
+ multiple configuration files you can change the path by setting
36
+
37
+ ```
38
+ $ export HACKMAC_CONFIG=~/config/hackmac/other.yml
39
+ ```
40
+
41
+ in your shell.
42
+
43
+ ## Download
44
+
45
+ The homepage of this library is located at
46
+
47
+ * https://github.com/flori/complex_config
48
+
49
+ ## Author
50
+
51
+ [Florian Frank](mailto:flori@ping.de)
52
+
53
+ ## License
54
+
55
+ This software is licensed under the MIT license.
data/Rakefile CHANGED
@@ -23,5 +23,6 @@ GemHadar do
23
23
  dependency 'plist'
24
24
  dependency 'tabulo'
25
25
  dependency 'search_ui'
26
+ dependency 'hashie'
26
27
  development_dependency 'debug'
27
28
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.0
1
+ 1.6.0
data/bin/efi CHANGED
@@ -25,7 +25,7 @@ def usage
25
25
 
26
26
  Usage #{File.basename($0)} [command] [arguments]
27
27
 
28
- Set CONFIG_PATH to the config file, e. g. ~/.config/hackmac/foobar.yml
28
+ Set HACKMAC_CONFIG to the config file, e. g. ~/.config/hackmac/foobar.yml
29
29
 
30
30
  Commands are
31
31
 
data/bin/gfxmon CHANGED
@@ -33,23 +33,15 @@ def usage
33
33
  end
34
34
 
35
35
  def ps
36
- `ioreg -l`.lines.find { |l|
37
- if l =~ /"PerformanceStatistics" = {([^}]+)}/
38
- break Hash[
39
- $1.split(?,).map { |a|
40
- a = a.split(?=)
41
- [ a[0][1..-2], (Integer(a[1]) rescue a[1]) ]
42
- }.sort_by { |name, _| name.downcase }
43
- ]
44
- end
45
- }
36
+ Hackmac::IOReg.new(key: 'PerformanceStatistics').as_hash
46
37
  end
47
38
 
48
39
  def list(ps)
49
40
  max = ps.keys.max_by(&:size)&.size&.to_i
50
41
  include Hackmac::Graph::Formatters
51
- puts ps.map { |n, v|
52
- ("%-#{max}s" % n) + " " + ("%s" % send(derive_formatter(n), v)).bold
42
+ puts ps.sort_by(&:first).map { |n, v|
43
+ c = derive_color_from_string(n)
44
+ ("%-#{max}s" % n).color(15).on_color(c) + " " + ("%12s" % send(derive_formatter(n), v)).bold
53
45
  }
54
46
  end
55
47
 
data/hackmac.gemspec CHANGED
@@ -1,19 +1,19 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: hackmac 1.5.0 ruby lib
2
+ # stub: hackmac 1.6.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "hackmac".freeze
6
- s.version = "1.5.0"
6
+ s.version = "1.6.0"
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]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2023-05-28"
11
+ s.date = "2023-05-29"
12
12
  s.description = "This ruby gem provides some useful tools for working with a Hackintosh.".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["efi".freeze, "gfxmon".freeze, "usb".freeze]
15
- s.extra_rdoc_files = ["README.md".freeze, "lib/hackmac.rb".freeze, "lib/hackmac/asset_tools.rb".freeze, "lib/hackmac/config.rb".freeze, "lib/hackmac/disks.rb".freeze, "lib/hackmac/github_source.rb".freeze, "lib/hackmac/graph.rb".freeze, "lib/hackmac/graph/display.rb".freeze, "lib/hackmac/kext.rb".freeze, "lib/hackmac/kext_upgrader.rb".freeze, "lib/hackmac/oc.rb".freeze, "lib/hackmac/oc_upgrader.rb".freeze, "lib/hackmac/oc_validator.rb".freeze, "lib/hackmac/plist.rb".freeze, "lib/hackmac/url_download.rb".freeze, "lib/hackmac/utils.rb".freeze, "lib/hackmac/version.rb".freeze]
16
- s.files = [".gitignore".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/efi".freeze, "bin/gfxmon".freeze, "bin/usb".freeze, "hackmac.gemspec".freeze, "lib/hackmac.rb".freeze, "lib/hackmac/asset_tools.rb".freeze, "lib/hackmac/config.rb".freeze, "lib/hackmac/disks.rb".freeze, "lib/hackmac/github_source.rb".freeze, "lib/hackmac/graph.rb".freeze, "lib/hackmac/graph/display.rb".freeze, "lib/hackmac/hackmac.yml".freeze, "lib/hackmac/kext.rb".freeze, "lib/hackmac/kext_upgrader.rb".freeze, "lib/hackmac/oc.rb".freeze, "lib/hackmac/oc_upgrader.rb".freeze, "lib/hackmac/oc_validator.rb".freeze, "lib/hackmac/plist.rb".freeze, "lib/hackmac/url_download.rb".freeze, "lib/hackmac/utils.rb".freeze, "lib/hackmac/version.rb".freeze]
15
+ s.extra_rdoc_files = ["README.md".freeze, "lib/hackmac.rb".freeze, "lib/hackmac/asset_tools.rb".freeze, "lib/hackmac/config.rb".freeze, "lib/hackmac/disks.rb".freeze, "lib/hackmac/github_source.rb".freeze, "lib/hackmac/graph.rb".freeze, "lib/hackmac/graph/display.rb".freeze, "lib/hackmac/ioreg.rb".freeze, "lib/hackmac/kext.rb".freeze, "lib/hackmac/kext_upgrader.rb".freeze, "lib/hackmac/oc.rb".freeze, "lib/hackmac/oc_upgrader.rb".freeze, "lib/hackmac/oc_validator.rb".freeze, "lib/hackmac/plist.rb".freeze, "lib/hackmac/url_download.rb".freeze, "lib/hackmac/utils.rb".freeze, "lib/hackmac/version.rb".freeze]
16
+ s.files = [".gitignore".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/efi".freeze, "bin/gfxmon".freeze, "bin/usb".freeze, "hackmac.gemspec".freeze, "img/gfxmon.png".freeze, "lib/hackmac.rb".freeze, "lib/hackmac/asset_tools.rb".freeze, "lib/hackmac/config.rb".freeze, "lib/hackmac/disks.rb".freeze, "lib/hackmac/github_source.rb".freeze, "lib/hackmac/graph.rb".freeze, "lib/hackmac/graph/display.rb".freeze, "lib/hackmac/hackmac.yml".freeze, "lib/hackmac/ioreg.rb".freeze, "lib/hackmac/kext.rb".freeze, "lib/hackmac/kext_upgrader.rb".freeze, "lib/hackmac/oc.rb".freeze, "lib/hackmac/oc_upgrader.rb".freeze, "lib/hackmac/oc_validator.rb".freeze, "lib/hackmac/plist.rb".freeze, "lib/hackmac/url_download.rb".freeze, "lib/hackmac/utils.rb".freeze, "lib/hackmac/version.rb".freeze]
17
17
  s.homepage = "http://github.com/flori/hackmac".freeze
18
18
  s.rdoc_options = ["--title".freeze, "Hackmac - Some useful tools for working with a Hackintosh".freeze, "--main".freeze, "README.md".freeze]
19
19
  s.rubygems_version = "3.3.26".freeze
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.add_runtime_dependency(%q<plist>.freeze, [">= 0"])
34
34
  s.add_runtime_dependency(%q<tabulo>.freeze, [">= 0"])
35
35
  s.add_runtime_dependency(%q<search_ui>.freeze, [">= 0"])
36
+ s.add_runtime_dependency(%q<hashie>.freeze, [">= 0"])
36
37
  else
37
38
  s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.12.0"])
38
39
  s.add_dependency(%q<debug>.freeze, [">= 0"])
@@ -43,5 +44,6 @@ Gem::Specification.new do |s|
43
44
  s.add_dependency(%q<plist>.freeze, [">= 0"])
44
45
  s.add_dependency(%q<tabulo>.freeze, [">= 0"])
45
46
  s.add_dependency(%q<search_ui>.freeze, [">= 0"])
47
+ s.add_dependency(%q<hashie>.freeze, [">= 0"])
46
48
  end
47
49
  end
data/img/gfxmon.png ADDED
Binary file
data/lib/hackmac/graph.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'term/ansicolor'
2
2
  require 'tins'
3
+ require 'digest/md5'
3
4
 
4
5
  class Hackmac::Graph
5
6
  include Term::ANSIColor
@@ -26,6 +27,15 @@ class Hackmac::Graph
26
27
  value.to_s
27
28
  end
28
29
 
30
+ def derive_color_from_string(string)
31
+ cs = (21..226).select { |d|
32
+ Term::ANSIColor::Attribute[d].to_rgb_triple.to_hsl_triple.
33
+ lightness < 40
34
+ }
35
+ s = Digest::MD5.digest(string).unpack('Q*')
36
+ cs[ (s.first ^ s.last) % cs.size ]
37
+ end
38
+
29
39
  self
30
40
  end
31
41
 
@@ -144,11 +154,7 @@ class Hackmac::Graph
144
154
  when Proc
145
155
  @color.(@title)
146
156
  when nil
147
- cs = (21..226).select { |d|
148
- Term::ANSIColor::Attribute[d].to_rgb_triple.to_hsl_triple.
149
- lightness < 40
150
- }
151
- cs[ @title.bytes.reduce(0, :+) % cs.size ]
157
+ derive_color_from_string(@title)
152
158
  else
153
159
  @color
154
160
  end
@@ -2,7 +2,7 @@
2
2
  efi:
3
3
  source: 'storage.gate.ping.de:/git/EFI-hacmaxi.git'
4
4
  usb:
5
- os: '/Volumes/Install macOS Monterey/Install macOS Monterey.app'
5
+ os: '/Volumes/Install macOS Ventura/Install macOS Ventura.app'
6
6
  mp: '/Volumes/USB'
7
7
  devices:
8
8
  main:
@@ -53,4 +53,3 @@ kext:
53
53
  # github: 'Mieze/LucyRTL8125Ethernet'
54
54
  USBToolBox:
55
55
  github: 'USBToolBox/kext'
56
-
@@ -0,0 +1,13 @@
1
+ require 'hashie'
2
+
3
+ module Hackmac
4
+ class IOReg
5
+ include Hackmac::Plist
6
+
7
+ def initialize(key:)
8
+ plist *(%w[ioreg -a -p IOService -r -k ] << key)
9
+ @plist.extend Hashie::Extensions::DeepFind
10
+ @plist = @plist.deep_find_all(key).max_by(&:size)
11
+ end
12
+ end
13
+ end
@@ -1,6 +1,6 @@
1
1
  module Hackmac
2
2
  # Hackmac version
3
- VERSION = '1.5.0'
3
+ VERSION = '1.6.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:
data/lib/hackmac.rb CHANGED
@@ -7,6 +7,7 @@ require 'tins/xt'
7
7
  require 'hackmac/version'
8
8
  require 'hackmac/plist'
9
9
  require 'hackmac/disks'
10
+ require 'hackmac/ioreg'
10
11
  require 'hackmac/asset_tools'
11
12
  require 'hackmac/github_source'
12
13
  require 'hackmac/url_download'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackmac
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-28 00:00:00.000000000 Z
11
+ date: 2023-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -136,6 +136,20 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: hashie
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
139
153
  description: This ruby gem provides some useful tools for working with a Hackintosh.
140
154
  email: flori@ping.de
141
155
  executables:
@@ -152,6 +166,7 @@ extra_rdoc_files:
152
166
  - lib/hackmac/github_source.rb
153
167
  - lib/hackmac/graph.rb
154
168
  - lib/hackmac/graph/display.rb
169
+ - lib/hackmac/ioreg.rb
155
170
  - lib/hackmac/kext.rb
156
171
  - lib/hackmac/kext_upgrader.rb
157
172
  - lib/hackmac/oc.rb
@@ -164,6 +179,7 @@ extra_rdoc_files:
164
179
  files:
165
180
  - ".gitignore"
166
181
  - Gemfile
182
+ - LICENSE
167
183
  - README.md
168
184
  - Rakefile
169
185
  - VERSION
@@ -171,6 +187,7 @@ files:
171
187
  - bin/gfxmon
172
188
  - bin/usb
173
189
  - hackmac.gemspec
190
+ - img/gfxmon.png
174
191
  - lib/hackmac.rb
175
192
  - lib/hackmac/asset_tools.rb
176
193
  - lib/hackmac/config.rb
@@ -179,6 +196,7 @@ files:
179
196
  - lib/hackmac/graph.rb
180
197
  - lib/hackmac/graph/display.rb
181
198
  - lib/hackmac/hackmac.yml
199
+ - lib/hackmac/ioreg.rb
182
200
  - lib/hackmac/kext.rb
183
201
  - lib/hackmac/kext_upgrader.rb
184
202
  - lib/hackmac/oc.rb