Class: Ruboty::Docker::Actions::Pull
- Defined in:
- lib/ruboty/docker/actions/pull.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Ruboty::Docker::Actions::Base
Instance Method Details
#call ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ruboty/docker/actions/pull.rb', line 5 def call image_name = [:image_name] .reply("Pulling from #{image_name}...") image = ::Docker::Image.create('fromImage' => image_name) .reply("Status: Downloaded newer image for #{image_name}") .reply(image.json, code: true) if [:debug] == ' -D ' rows = [] rows.push ['IMAGE NAME', image_name] rows.push ['IMAGE ID', image.json['Id']] rows.push ['VirtualSize', filesize_to_human(image.json['VirtualSize'])] rows.push ['OS', image.json['Os']] unless image.json['Config']['Env'].nil? image.json['Config']['Env'].each_index do |n| if n == 0 rows.push ['Env', image.json['Config']['Env'][n]] else rows.push ['', image.json['Config']['Env'][n]] end end end unless image.json['Config']['OnBuild'].nil? image.json['Config']['OnBuild'].each_index do |n| if n == 0 rows.push ['OnBuild', image.json['Config']['OnBuild'][n]] else rows.push ['', image.json['Config']['OnBuild'][n]] end end end rows.push ['Cmd', image.json['ContainerConfig']['Cmd']] rows.push ['WorkingDir', image.json['ContainerConfig']['WorkingDir']] rows.push ['Created', image.json['Created']] rows.push ['DockerVersion', image.json['DockerVersion']] table = ::Terminal::Table.new title: 'PULLED IMAGE INFO', rows: rows table.style = { :padding_left => 0, :border_x => '', :border_y => ' ', :border_i => '' } .reply(table, code: true) rescue => e value = [e.class.name, e., e.backtrace].join("\n") .reply value ensure end |