class GitCloner::Copier

Copier

Public Class Methods

copy(copies) click to toggle source
# File lib/copier.rb, line 7
def copy(copies)
  return if copies.nil?
  copies.each { |copy_dir|copy_target(copy_dir) }
end

Private Class Methods

check_copy_dir_from(from) click to toggle source
# File lib/copier.rb, line 21
def check_copy_dir_from(from)
  return if from
  fail ArgumentError, 'invalid repos. copies must have from'
end
check_copy_dir_to(to) click to toggle source
# File lib/copier.rb, line 26
def check_copy_dir_to(to)
  return if to
  fail ArgumentError, 'invalid repos. copies must have from'
end
copy_target(copy_dir) click to toggle source
# File lib/copier.rb, line 14
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
copy_target_files(from, to) click to toggle source
# File lib/copier.rb, line 36
def copy_target_files(from, to)
  FileUtils.cp_r(from, to)
end
make_copy_dir_if_not_exists(to) click to toggle source
# File lib/copier.rb, line 31
def make_copy_dir_if_not_exists(to)
  return if Dir.exist?(File.dirname(to))
  FileUtils.mkdir_p(to)
end