systeminfo/lib/first_run.rb

46 lines
3.2 KiB
Ruby
Raw Normal View History

2023-09-21 18:03:25 -06:00
require 'yaml'
require 'tty-prompt'
class FirstRun
def self.setup(config_path)
prompt = TTY::Prompt.new
puts "Welcome to SystemInfo! Let's set up your configuration."
config = {
'cpu' => prompt.yes?('Do you want to display CPU information, including Cores, Threads, Model, Clock Speed,
and L3 cache?'),
'ram' => prompt.yes?('Do you want to display RAM amount, usage at idle, and usage under load?'),
'gpu' => prompt.yes?('Do you want to display GPU Model, Video RAM amount, and driver version?'),
'nic_model' => prompt.yes?('Do you want to display NIC Model number, manufacturer, and max speed?'),
'network_speed' => prompt.yes?('Do you want to display current network upload and download speed?'),
'os_name' => prompt.yes?('Do you want to display the Operating System name?'),
'kernel_name_version' => prompt.yes?('Do you want to display the Kernel version?'),
'system_uptime' => prompt.yes?('Do you want to display how long the system has been on without restarting?'),
'disks' => prompt.yes?('Do you want to display disk information?'),
'display_resolution' => prompt.yes?('Do you want to display the current display resolution of each monitor?'),
'theme' => prompt.yes?('Do you want to display the current theme the system is using, if any?'),
'desktop_environment' => prompt.yes?('Do you want to display the current desktop environment the system
is using?'),
'window_manager' => prompt.yes?('Do you want to display the current window manager the system is using?'),
'terminal' => prompt.yes?('Do you want to display the current terminal emulator that the system is using?'),
'shell' => prompt.yes?('Do you want to display the current shell the terminal is using?'),
'hostname' => prompt.yes?('Do you want to display the current host name of the system?'),
'board_model' => prompt.yes?('Do you want to display the system\'s motherboard model name from DMIDecode?'),
'chipset' => prompt.yes?('Do you want to display the current chipset the system is using from DMIDecode?'),
'amount_of_monitors' => prompt.yes?('Do you want to display the amount of monitors the system currently is
using?'),
'sound_drivers' => prompt.yes?('Do you want to display which sound driver the system is using right now?'),
'sound_card' => prompt.yes?('Do you want to display the current sound card that the system is using?'),
'display_technology' => prompt.yes?('Do you want to display what display tech the monitors are using?'),
'color_bit_depth' => prompt.yes?('Do you want to display the color bit depth of the monitors the system is
using?'),
'package_managers' => prompt.yes?('Do you want to display the package manager or managers that the system is using
and how many packages are installed from each?'),
'file_systems' => prompt.yes?('Do you want to display which file systems the drives are using?')
}
2023-09-22 14:10:28 -06:00
File.puts(config_path, config.to_yaml)
2023-09-21 18:03:25 -06:00
puts 'Configuration saved!'
end
end