Class: LintTrap::Container::Docker
- Inherits:
-
Base
- Object
- Base
- LintTrap::Container::Docker
show all
- Defined in:
- lib/lint_trap/container/docker.rb
Overview
Acts like a container, without actually requiring a container.
Constant Summary
collapse
- CONFIG_PATH =
Pathname.new('/config')
- CODE_PATH =
Pathname.new('/src')
Constants inherited
from Base
Base::ImagePullError, Base::LOCAL_CONFIG_PATH
Instance Attribute Summary
Attributes inherited from Base
#image
Instance Method Summary
collapse
Methods inherited from Base
#file_path, #initialize
Instance Method Details
#config_path(path) ⇒ Object
27
28
29
|
# File 'lib/lint_trap/container/docker.rb', line 27
def config_path(path)
CONFIG_PATH.join(path).to_s
end
|
#container_path(path) ⇒ Object
37
38
39
40
41
|
# File 'lib/lint_trap/container/docker.rb', line 37
def container_path(path)
relative_path = Pathname.new(path).relative_path_from(repo_path)
CODE_PATH.join(relative_path).to_s
end
|
#local_path(path) ⇒ Object
31
32
33
34
35
|
# File 'lib/lint_trap/container/docker.rb', line 31
def local_path(path)
relative_path = Pathname.new(path).relative_path_from(CODE_PATH)
repo_path.join(relative_path).to_s
end
|
#pull ⇒ Object
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/lint_trap/container/docker.rb', line 12
def pull
command = "docker pull #{image}"
Open3.popen2e(command) do |_, stdout, thread|
if thread.value.success?
true
else
raise ImagePullError.new(command, stdout.read)
end
end
end
|
#wrap(command) ⇒ Object
23
24
25
|
# File 'lib/lint_trap/container/docker.rb', line 23
def wrap(command)
"docker run #{flags} #{image} #{command}"
end
|