Class: Pixiebox::System

Inherits:
Object
  • Object
show all
Includes:
Utils::Output, Utils::Visitable
Defined in:
lib/pixiebox/system.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils::Output

#display_error, #display_info, #display_line, #display_status

Methods included from Utils::Visitable

#accept

Constructor Details

#initialize(os) ⇒ System

Returns a new instance of System.



8
9
10
# File 'lib/pixiebox/system.rb', line 8

def initialize(os)
  @os = os
end

Instance Attribute Details

#osObject (readonly)

Returns the value of attribute os.



6
7
8
# File 'lib/pixiebox/system.rb', line 6

def os
  @os
end

Instance Method Details

#installObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pixiebox/system.rb', line 12

def install
  accept(Commands::StartInstall.new)
  accept(Commands::GetRootPermission.new)
  accept(Commands::DownloadDocker.new)
  accept(Commands::InstallDocker.new)
  accept(Commands::InstallConfig.new)
  accept(Commands::UpdatePackages.new)
  accept(Commands::SetupShell.new)
  accept(Commands::FinishInstall.new)
  accept(Commands::ReloadShell.new)
rescue StandardError => e
  display_error e
  exit 1
end

#restartObject



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

def restart
  accept(Commands::Restart.new)
rescue StandardError => e
  display_error e
  exit 1
end

#ssh(service) ⇒ Object



62
63
64
65
66
67
# File 'lib/pixiebox/system.rb', line 62

def ssh(service)
  accept(Commands::SshInstance.new(service))
rescue StandardError => e
  display_error e
  exit 1
end

#startObject



38
39
40
41
42
43
# File 'lib/pixiebox/system.rb', line 38

def start
  accept(Commands::Start.new)
rescue StandardError => e
  display_error e
  exit 1
end

#stopObject



46
47
48
49
50
51
# File 'lib/pixiebox/system.rb', line 46

def stop
  accept(Commands::Stop.new)
rescue StandardError => e
  display_error e
  exit 1
end

#uninstallObject



28
29
30
31
32
33
34
35
# File 'lib/pixiebox/system.rb', line 28

def uninstall
  accept(Commands::StartUninstall.new)
  accept(Commands::RemoveSetupShell.new)
  accept(Commands::FinishUninstall.new)
rescue StandardError => e
  display_error e
  exit 1
end