Class: Picobox::Commands::InstallDocker
Instance Method Summary
collapse
#visit, #visit_unsupported, #visit_windows
#publish_event
Instance Method Details
#visit_darwin(subject) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/picobox/commands/install_docker.rb', line 4
def visit_darwin subject
unless os.docker_installed?
commands = [
"/usr/bin/hdiutil attach -noidme -nobrowse -quiet #{subject.os.docker_installer}",
"cp -R /Volumes/Docker/Docker.app /Applications",
"open -a Docker",
"/usr/bin/hdiutil unmount -quiet /Volumes/Docker"
]
publish_event :install_docker_start
commands.each do |command|
system(command)
end
publish_event :install_docker_complete
else
publish_event :docker_present, os.docker_version?
end
end
|
#visit_linux(subject) ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/picobox/commands/install_docker.rb', line 26
def visit_linux subject
unless os.docker_installed?
publish_event :install_docker_start
stream = open('https://get.docker.com')
IO.copy_stream( stream, 'get-docker.sh' )
commands = [
"sh get-docker.sh #{Picobox.output}",
"rm get-docker.sh",
"#{os.su} 'usermod -aG docker #{os.user}'"
]
commands.each do |command|
system(command)
end
publish_event :add_post_install_message, "If you would like to use Docker as a non-root user\nyou will have to log out and back in for this to take effect!"
publish_event :install_docker_complete
else
publish_event :docker_present, os.docker_version?
end
end
|