lib/fig/environment.rb in fig-0.1.18 vs lib/fig/environment.rb in fig-0.1.19

- old
+ new

@@ -129,10 +129,17 @@ # Replace @ symbol with the package's directory def expand_value(base_package, name, value) return value unless base_package && base_package.package_name file = value.gsub(/\@/, base_package.directory) if @retrieve_vars.member?(name) - target = File.join(@retrieve_vars[name].gsub(/\[package\]/, base_package.package_name), File.basename(file)) + # A '//' in the source file's path tells us to preserve path information + # after the '//' when doing a retrieve. + if file.split('//').size > 1 + preserved_path = file.split('//').last + target = File.join(@retrieve_vars[name].gsub(/\[package\]/, base_package.package_name), preserved_path) + else + target = File.join(@retrieve_vars[name].gsub(/\[package\]/, base_package.package_name), File.basename(file)) + end unless @os.exist?(target) && @os.mtime(target) >= @os.mtime(file) @os.log_info("retrieving #{target}") @os.copy(file, target) end file = target