class Grifork::Executor::Carrier

Public Class Methods

new(type, &task) click to toggle source

Initialize with task @param &task [Proc] task to execute

# File lib/grifork/executor/carrier.rb, line 6
def initialize(type, &task)
  @type = type
  @task = task
end

Public Instance Methods

run(src, dst) click to toggle source

Run the task @param src [String] Source hostname @param dst [String] Target hostname

# File lib/grifork/executor/carrier.rb, line 14
def run(src, dst)
  Thread.current[:src] = src
  Thread.current[:dst] = dst
  instance_eval(&@task)
end

Private Instance Methods

dst() click to toggle source
# File lib/grifork/executor/carrier.rb, line 26
def dst
  Thread.current[:dst]
end
rsync(from, to = nil) click to toggle source

Wrapper for {Grifork::Executable#rsync}

Calls superclass method Grifork::Executable#rsync
# File lib/grifork/executor/carrier.rb, line 31
def rsync(from, to = nil)
  super(dst, from, to)
end
rsync_remote(from, to = nil) click to toggle source

Wrapper for {Grifork::Executable#rsync_remote} @note This is for remote task on :standalone mode

Calls superclass method Grifork::Executable#rsync_remote
# File lib/grifork/executor/carrier.rb, line 37
def rsync_remote(from, to = nil)
  super(src, dst, from, to)
end
src() click to toggle source
# File lib/grifork/executor/carrier.rb, line 22
def src
  Thread.current[:src]
end