Method: Puppet::Modulebuilder::Builder#stage_path
- Defined in:
- lib/puppet/modulebuilder/builder.rb
#stage_path(path) ⇒ Object
Stage a file or directory from the module into the build directory.
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/puppet/modulebuilder/builder.rb', line 108 def stage_path(path) require 'pathname' relative_path = Pathname.new(path).relative_path_from(Pathname.new(source)) dest_path = File.join(build_dir, relative_path) validate_path_encoding!(relative_path.to_path) begin 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 format( '%<message>s Rename the file or exclude it from the package by adding it to the .pdkignore file in your module.', message: e. ) end end |