lib/capistrano_extensions/files/remote.rb in joekhoobyar-capistrano-extensions-0.0.3 vs lib/capistrano_extensions/files/remote.rb in joekhoobyar-capistrano-extensions-0.0.5
- old
+ new
@@ -7,25 +7,25 @@
COMMANDS = [ %w(mkdir mkdir_p rmdir cp cp_r rm rm_r rm_rf
chmod chmod_R chown chown_R touch),
%w(ln ln_s ln_sf mv install) ]
COMMANDS.each_with_index do |l,n|
- l.each do |k|
- k, f = k.split('_')
+ l.each do |m|
+ k, f = m.split('_')
f = ' -' + f if f
- class_eval <<-EODEF
- def #{k}(a, options={})
+ class_eval <<-EODEF, __FILE__, __LINE__
+ def #{m}(*args)
options = args.pop if Hash === args.last
_r '#{k}#{f}', args#{', ' + (n+1).to_s if n > 0}
end
EODEF
end
end
def tail_f(file, n=10)
cmd = "tail -n #{n} -f #{_q file}"
- _via == :system ? system(cmd) : stream(cmd, :via => _via)
+ _via == :system ? local_run(cmd) : stream(cmd, :via => _via)
rescue Interrupt
logger.trace "interrupted (Ctrl-C)" if logger
end
def upload(*args)
@@ -60,22 +60,21 @@
private
def _t(cmd, args=nil, min=nil)
cmd = _a cmd, args, min
if _via == :system then
- system(cmd)
+ local_run(cmd)
else
capture("#{cmd}; echo $?", :via => _via).strip == '0'
end
end
def _r(cmd, args=nil, min=nil)
cmd = _a cmd, args, min
if _via != :system then
- invoke_command(cmd, :via => _via)
+ invoke_command cmd, :via => _via
else
- $stdout.puts cmd
- system cmd
+ local_run cmd
end
end
def _a(cmd, args=nil, min=nil)
case args