Module: Hackmac::Config

Extended by:
ComplexConfig::Provider::Shortcuts, FileUtils
Defined in:
lib/hackmac/config.rb

Constant Summary collapse

DEFAULT =
"---\nefi:\n  source: 'storage.gate.ping.de:/git/EFI-hacmaxi.git'\nusb:\n  os: '/Applications/Install macOS Monterey.app'\ndevices:\n  main:\n    name: 'EFI'\n  backup:\n    name: 'BACKUP_EFI'\ngithub:\n  user: null\n  access_token: null\noc:\n  efi_path: 'EFI'\n  source:\n    github: 'acidanthera/OpenCorePkg'\n    debug: true\n  install_path: 'X64/EFI'\n  files:\n    - 'BOOT/BOOTx64.efi'\n    - 'OC/OpenCore.efi'\n    - 'OC/Drivers/OpenHfsPlus.efi'\n    - 'OC/Drivers/OpenRuntime.efi'\n    - 'OC/Tools/OpenShell.efi'\nkext:\n  efi_path: 'EFI/OC/Kexts'\n  sources:\n    AppleALC:\n      github: 'acidanthera/AppleALC'\n    IntelMausi:\n      github: 'acidanthera/IntelMausi'\n    Lilu:\n      github: 'acidanthera/Lilu'\n    #USBInjectAll:\n    #  github: 'Sniki/OS-X-USB-Inject-All'\n    VirtualSMC:\n      github: 'acidanthera/VirtualSMC'\n      debug: false\n      plugins:\n        - SMCProcessor\n        - SMCSuperIO\n    BrcmPatchRAM2:\n      github: 'acidanthera/BrcmPatchRAM'\n      plugins:\n        - BrcmFirmwareData\n    WhateverGreen:\n      github: 'acidanthera/WhateverGreen'\n    LucyRTL8125Ethernet:\n      github: 'Mieze/LucyRTL8125Ethernet'\n"

Class Method Summary collapse

Class Method Details

.load(path: ENV.fetch('CONFIG_PATH', '~/.config/hackmac/hackmac.yml')) ⇒ Object



64
65
66
67
68
69
70
71
72
73
# File 'lib/hackmac/config.rb', line 64

def self.load(path: ENV.fetch('CONFIG_PATH', '~/.config/hackmac/hackmac.yml'))
  path = Pathname.new(path).expand_path
  mkdir_p path.dirname
  ComplexConfig::Provider.config_dir = path.dirname
  unless path.exist?
    File.secure_write(path.to_s, DEFAULT)
  end
  puts "Loading config from #{path.to_s.inspect}."
  ComplexConfig::Provider[path.basename.to_s.sub(/\..*?\z/, '')]
end