module Dapp::Dimg::Build::Stage::Mod::Logging
Public Instance Methods
ignore_log_commands?()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 75 def ignore_log_commands? false end
image_should_be_introspected?()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 83 def image_should_be_introspected? image_should_be_introspected_after_build? || image_should_be_introspected_before_build? end
image_should_be_introspected_after_build?()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 91 def image_should_be_introspected_after_build? dimg.stage_should_be_introspected_after_build?(name) && !dimg.dapp.dry_run? end
image_should_be_introspected_before_build?()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 87 def image_should_be_introspected_before_build? dimg.stage_should_be_introspected_before_build?(name) && !dimg.dapp.dry_run? end
log_build()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 19 def log_build dimg.dapp.with_log_indent do dimg.dapp.log_info dimg.dapp.t(code: 'image.signature', data: { signature: image_name }) log_image_details unless empty? end end
log_image_build() { || ... }
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 7 def log_image_build case when dimg.dapp.dry_run? && image_should_be_untagged? then log_state(:rebuild, styles: { status: :success }) when image.built? then log_state(:using_cache) when should_be_not_present? then log_state(:not_present) when dimg.dapp.dry_run? then log_state(:build, styles: { status: :success }) else yield end ensure log_build end
log_image_commands()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 57 def log_image_commands return if (bash_commands = image.send(:bash_commands)).empty? dimg.dapp.log_info dimg.dapp.t(code: 'image.commands') dimg.dapp.with_log_indent { dimg.dapp.log_info bash_commands.join("\n") } end
log_image_created_at()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 41 def log_image_created_at dimg.dapp.log_info dimg.dapp.t(code: 'image.info.created_at', data: { value: Time.parse(image.created_at).localtime }) end
log_image_details()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 26 def log_image_details if image.tagged? log_image_created_at log_image_size end log_image_commands unless ignore_log_commands? log_image_instructions end
log_image_instructions()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 35 def log_image_instructions return if (instructions = image.prepare_instructions(image.send(:change_options))).empty? dimg.dapp.log_info dimg.dapp.t(code: 'image.instructions') dimg.dapp.with_log_indent { dimg.dapp.log_info instructions.join("\n") } end
log_image_size()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 46 def log_image_size if !prev_stage.nil? && from_image.tagged? bytes = image.size - from_image.size code = 'image.info.difference' else bytes = image.size code = 'image.info.mb_size' end dimg.dapp.log_info dimg.dapp.t(code: code, data: { mb: (bytes / 1000 / 1000).round(3) }) end
log_name()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 63 def log_name dimg.dapp.t(code: name, context: log_name_context) end
log_name_context()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 67 def log_name_context :stage end
log_state(state_code, styles: {})
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 71 def log_state(state_code, styles: {}) dimg.dapp.log_state(log_name, state: dimg.dapp.t(code: state_code, context: 'state'), styles: styles) end
should_not_be_detailed?()
click to toggle source
# File lib/dapp/dimg/build/stage/mod/logging.rb, line 79 def should_not_be_detailed? image.send(:bash_commands).empty? end