Class: Pixiebox::Services::Installer

Inherits:
Object
  • Object
show all
Includes:
Utils::Output
Defined in:
lib/pixiebox/services/installer.rb

Instance Method Summary collapse

Methods included from Utils::Output

#display_error, #display_info, #display_line, #display_status

Constructor Details

#initialize(os) ⇒ Installer

Returns a new instance of Installer.



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

def initialize(os)
  @os = os
end

Instance Method Details

#install(type) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pixiebox/services/installer.rb', line 11

def install(type)
  @manifest = Manifest.new(os, type)
  @manifest.check! # raises an exception if we can't find the type in the manifest

  config = DockerCompose::Config.new manifest.docker_compose_file
  config.add_service manifest.service, manifest.service_links

  config.save
  display_status 'modify', manifest.docker_compose_file
  display_status 'info',   "hostname '#{manifest.service_name}' is visible to other services", :yellow
  display_status 'info',   manifest.post_install_instructions, :yellow
end

#uninstall(type) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/pixiebox/services/installer.rb', line 25

def uninstall(type)
  @manifest = Manifest.new(os, type)

  config = DockerCompose::Config.new manifest.docker_compose_file
  config.check!(type)  # raises an exception if we can't find the type currently installed

  config.remove_service manifest.service

  config.save
  display_status 'modify', manifest.docker_compose_file
end