Class: Runison

Inherits:
Object
  • Object
show all
Defined in:
lib/runison.rb

Constant Summary collapse

VERSION =
'0.0.1'

Instance Method Summary collapse

Instance Method Details

#synchro(folder1, folder2, logfilename, ignore_list = {}) ⇒ Object

synchronize 2 folders with minimum messages



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/runison.rb', line 5

def synchro(folder1, folder2, logfilename, ignore_list={})
  mkdir(folder1) unless(folder1.exists?)
  mkdir(folder2) unless(folder2.exists?)

  options = ' -auto -batch -terse '
  log = '-log -logfile #{logfilename}.log'
  ignore = ""
  ignore_list.each do |filename|
    ignore <<  "-ignore \"Name #{filename}\" "
  end

  command = "unison #{folder1} #{folder2} #{options} #{log} #{ignore}"
  cmd(command)
end