class UpgradeMacOS
Public Instance Methods
reboot_required?()
click to toggle source
# File lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb, line 15 def reboot_required? @output.downcase.include? "restart" end
run()
click to toggle source
# File lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb, line 6 def run find_software_upgrades return unless upgrade_available? return if reboot_required_and_not_agreed_to? execute_upgrade end
Private Instance Methods
agree_for_reboot?()
click to toggle source
# File lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb, line 36 def agree_for_reboot? agree "\nYour Mac needs to be rebooted, Still continue?".red.to_s end
execute_upgrade()
click to toggle source
# File lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb, line 40 def execute_upgrade run_command "softwareupdate --install --all" reboot if reboot_required? end
find_software_upgrades()
click to toggle source
# File lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb, line 21 def find_software_upgrades say "\nUpdating macOS.\nFinding available software (this may take a while)".yellow @output = `softwareupdate --list 2>&1` say @output end
reboot()
click to toggle source
# File lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb, line 45 def reboot say "Rebooting Now".white.on_red say `osascript -e 'tell app "System Events" to restart'` end
reboot_required_and_not_agreed_to?()
click to toggle source
# File lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb, line 32 def reboot_required_and_not_agreed_to? reboot_required? && !agree_for_reboot? end
upgrade_available?()
click to toggle source
# File lib/renuo/cli/app/upgrade_laptop/upgrade_mac_os.rb, line 28 def upgrade_available? @output.include? "Software Update found" end