lib/capistrano_extensions/files/remote.rb in joekhoobyar-capistrano-extensions-0.0.0 vs lib/capistrano_extensions/files/remote.rb in joekhoobyar-capistrano-extensions-0.0.1
- old
+ new
@@ -4,19 +4,21 @@
module Files
module Remote
def tail_f(file, n=10)
cmd = "tail -n #{n} -f #{_q file}"
- _via == :system ? system(cmd) : stream(cmd)
+ _via == :system ? system(cmd) : stream(cmd, :via => _via)
+ rescue Interrupt
+ logger.trace "interrupted (Ctrl-C)" if logger
end
def upload(*args)
- _via == :system ? cp(*args) : upload(*args)
+ _via == :system ? cp(*args) : @config.upload(*args.push(:via => _via))
end
def download(*args)
- _via == :system ? cp(*args) : download(*args)
+ _via == :system ? cp(*args) : @config.download(*args.push(:via => _via))
end
def cd(dir, options={})
if block_given?
dir, dir2 = pwd, dir
@@ -158,26 +160,24 @@
case (v = _via)
when :system
@quiet or $stderr.puts cmd
system cmd
- when :sudo
- sudo cmd, :as => @config.fetch(:runner, 'app')
else
invoke_command cmd, :via => v
end
end
def _q(*list)
list.map { |l| "'#{l.gsub("'", "\\'")}'" }.join ' '
end
def _via
- case (v = files_via)
+ case (v = @config.fetch(:files_via, nil))
when :local
:system
when :remote, NilClass
- :runner
+ @config.fetch(:run_method, nil)
else
v
end
end