Class: System

Inherits:
Object
  • Object
show all
Defined in:
lib/utils/prompts/system.rb

Overview

Simple User Prompts

Instance Method Summary collapse

Constructor Details

#initializeSystem

Returns a new instance of System.



11
12
13
# File 'lib/utils/prompts/system.rb', line 11

def initialize
  @prompt = TTY::Prompt.new
end

Instance Method Details

#bootObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/utils/prompts/system.rb', line 21

def boot
  Activity.new.boot_warning
  if @prompt.yes?('Would you like to boot up your work machine?')
    Reporter.new.timed_success('Booted Up!', 3)
    true
  else
    Activity.new.choose
    boot
  end
end

#ide_distractionsObject



53
54
55
56
57
58
59
# File 'lib/utils/prompts/system.rb', line 53

def ide_distractions
  Activity.new.choose
  Activity.new.warning
  vpn_expired
  Notifications.new.reddit
  Notifications.new.warning
end

#ide_updateObject



47
48
49
50
51
# File 'lib/utils/prompts/system.rb', line 47

def ide_update
  @prompt.warn("\nThere is an IDE update")
  ide_distractions until @prompt.yes?('Do you update your IDE now?')
  updating
end

#stress_vpnObject



32
33
34
35
36
37
38
39
# File 'lib/utils/prompts/system.rb', line 32

def stress_vpn
  Timeout.timeout(1) do
    vpn
  end
rescue Timeout::Error
  @prompt.warn('The 2FA timed out, TYPE FASTER')
  vpn
end

#updatingObject



61
62
63
64
# File 'lib/utils/prompts/system.rb', line 61

def updating
  puts 'Updating IDE'
  Terminal.new.amazing_update
end

#vpnObject



15
16
17
18
19
# File 'lib/utils/prompts/system.rb', line 15

def vpn
  Terminal.new.two_factor
  Terminal.new.r_progress(100)
  Reporter.new.success('Jacked into the network.')
end

#vpn_expiredObject



41
42
43
44
45
# File 'lib/utils/prompts/system.rb', line 41

def vpn_expired
  @prompt.error("\nYou return to your machine to find your VPN session has expired!")
  Terminal.new.two_factor
  Terminal.new.r_progress(100)
end