Sha256: 8b1049f36bb33775e5a22910b643bf676e23256afe1c2406178b0dae37986165
Contents?: true
Size: 991 Bytes
Versions: 1
Compression:
Stored size: 991 Bytes
Contents
# encoding: utf-8 module GitCloner # Copier class Copier class << self def copy(copies) return if copies.nil? copies.each { |copy_dir|copy_target(copy_dir) } end private def copy_target(copy_dir) check_copy_dir_from(copy_dir[:from]) check_copy_dir_to(copy_dir[:to]) make_copy_dir_if_not_exists(copy_dir[:to]) copy_target_files(copy_dir[:from], copy_dir[:to]) end def check_copy_dir_from(from) return if from fail ArgumentError, 'invalid repos. copies must have from' end def check_copy_dir_to(to) return if to fail ArgumentError, 'invalid repos. copies must have from' end def make_copy_dir_if_not_exists(to) return if Dir.exist?(File.dirname(to)) FileUtils.mkdir_p(to) end def copy_target_files(from, to) FileUtils.cp_r(from, to) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git_cloner-0.0.4 | lib/copier.rb |