Class: Pinject::Docker
- Inherits:
-
Object
- Object
- Pinject::Docker
- Defined in:
- lib/pinject/docker.rb
Instance Attribute Summary collapse
-
#log ⇒ Object
readonly
Returns the value of attribute log.
Instance Method Summary collapse
-
#initialize(image_name, log: false) ⇒ Docker
constructor
A new instance of Docker.
- #inject_build(repo) ⇒ Object
Constructor Details
#initialize(image_name, log: false) ⇒ Docker
Returns a new instance of Docker.
18 19 20 21 |
# File 'lib/pinject/docker.rb', line 18 def initialize(image_name, log: false) @image_name = image_name @log = log end |
Instance Attribute Details
#log ⇒ Object (readonly)
Returns the value of attribute log.
8 9 10 |
# File 'lib/pinject/docker.rb', line 8 def log @log end |
Instance Method Details
#inject_build(repo) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pinject/docker.rb', line 23 def inject_build(repo) if r = detect_os Pinject.log.info "detect os #{r.inspect}" if log upd = update_cmd(r[:dist], r[:version]) if upd df = docker_file(@image_name, upd, r[:user]) ::Docker::Image.build( df, 't' => repo ) do |v| Pinject.log.info v if log end else raise UnsupportedDistError, "unsupport os dist:#{r[:dist]} version:#{r[:version]}" end end end |