Sha256: d39d81a2031b89c852d906ed00a370f68ed592602a5cc7c3380079a0d0760c87
Contents?: true
Size: 891 Bytes
Versions: 3
Compression:
Stored size: 891 Bytes
Contents
# frozen_string_literal: true module Rake module Funnel module Support class Copier class << self def copy(files, target) raise 'Target not defined' unless target common_path = files.common_path files.each do |source| next if File.directory?(source) target_path = target_path(source, common_path, target) dir = File.dirname(target_path) RakeFileUtils.mkdir_p(dir) unless File.directory?(dir) RakeFileUtils.cp(source, target_path, preserve: true) end end private def target_path(file, common_path, target) target_relative = Pathname.new(file).relative_path_from(Pathname.new(common_path)).to_s File.join(target, target_relative) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rake-funnel-0.24.0 | lib/rake/funnel/support/copier.rb |
rake-funnel-0.23.0 | lib/rake/funnel/support/copier.rb |
rake-funnel-0.22.3 | lib/rake/funnel/support/copier.rb |