Method: Lono::Utils::Rsync#rsync
- Defined in:
- lib/lono/utils/rsync.rb
#rsync(src, dest) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lono/utils/rsync.rb', line 14 def rsync(src, dest) # Using FileUtils.cp_r doesnt work if there are special files like socket files in the src dir. # Instead of using this hack https://bugs.ruby-lang.org/issues/10104 # Using rsync to perform the copy. src.chop! if src.ends_with?('/') dest.chop! if dest.ends_with?('/') check_rsync_installed! # Ensures required trailing slashes FileUtils.mkdir_p(File.dirname(dest)) sh "rsync -a --links --no-specials --no-devices #{Shellwords.escape(src)}/ #{Shellwords.escape(dest)}/" end |