2012-05-07 22:21:03 +00:00
|
|
|
module Unison
|
|
|
|
class Bridge
|
|
|
|
def self.run(*args, &block)
|
|
|
|
new(*args).run(&block)
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(profiles, log)
|
|
|
|
@profiles, @log = profiles, log
|
|
|
|
end
|
|
|
|
|
|
|
|
def run(&block)
|
|
|
|
Thread.new do
|
|
|
|
begin
|
|
|
|
@profiles.each do |profile|
|
2012-05-08 10:46:10 +00:00
|
|
|
#system %{bash -c 'unison -log -logfile #{@log} -batch #{profile} 2>>#{@log}.stderr >>#{@log}.stdout'}
|
|
|
|
system %{bash -c 'unison -log -logfile #{@log} -batch #{profile}'}
|
2012-05-07 22:21:03 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
block.call
|
|
|
|
rescue => e
|
|
|
|
puts e.message
|
|
|
|
puts e.backtrace.join("\n")
|
2012-05-08 10:46:10 +00:00
|
|
|
exit 1
|
2012-05-07 22:21:03 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|