Method: PDK::Module::Build#stage_path
- Defined in:
- lib/pdk/module/build.rb
#stage_path(path) ⇒ Object
Stage a file or directory from the module into the build directory.
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/pdk/module/build.rb', line 114 def stage_path(path) require 'pathname' require 'fileutils' relative_path = Pathname.new(path).relative_path_from(Pathname.new(module_dir)) dest_path = File.join(build_dir, relative_path) if File.directory?(path) FileUtils.mkdir_p(dest_path, mode: File.stat(path).mode) elsif File.symlink?(path) warn_symlink(path) else validate_ustar_path!(relative_path.to_path) FileUtils.cp(path, dest_path, preserve: true) end rescue ArgumentError => e raise PDK::CLI::ExitWithError, _( '%{message} Rename the file or exclude it from the package ' \ 'by adding it to the .pdkignore file in your module.', ) % { message: e. } end |