Module: Dapp::Dimg::Dapp::Command::BuildContext::Export
- Included in:
- Dapp
- Defined in:
- lib/dapp/dimg/dapp/command/build_context/export.rb
Instance Method Summary collapse
- #build_context_export ⇒ Object
- #export_build_context_build_tar ⇒ Object
- #export_build_context_image_tar ⇒ Object
Instance Method Details
#build_context_export ⇒ Object
7 8 9 10 11 12 |
# File 'lib/dapp/dimg/dapp/command/build_context/export.rb', line 7 def build_context_export log_process(:'export context') do export_build_context_image_tar export_build_context_build_tar end end |
#export_build_context_build_tar ⇒ 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 |
# File 'lib/dapp/dimg/dapp/command/build_context/export.rb', line 26 def export_build_context_build_tar log_secondary_process(:build_dir, short: true) do if !![:use_system_tar] shellout!("tar -C #{build_path} -cf #{build_context_build_tar} .") else tar_write(build_context_build_tar) do |tar| Dir.glob(File.join(build_path, '**/*'), File::FNM_DOTMATCH).each do |path| archive_file_path = path .reverse .chomp(build_path.to_s.reverse) .chomp('/') .reverse if File.directory?(path) tar.mkdir archive_file_path, File.stat(path).mode else tar.add_file archive_file_path, File.stat(path).mode do |tf| tf.write File.read(path) end end end end end unless dry_run? end end |
#export_build_context_image_tar ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dapp/dimg/dapp/command/build_context/export.rb', line 14 def export_build_context_image_tar lock("#{name}.images", readonly: true) do context_images_names = build_configs.map do |config| dimg(config: config).all_tagged_images.map(&:name) end.flatten log_secondary_process(:images, short: true) do Image::Stage.save!(self, context_images_names, build_context_images_tar, verbose: true, quiet: log_quiet?) unless dry_run? end unless context_images_names.empty? end end |