lib/capsaicin/files/remote.rb in capsaicin-0.1.2 vs lib/capsaicin/files/remote.rb in capsaicin-0.1.3
- old
+ new
@@ -15,10 +15,29 @@
end
EODEF
end
end
+ def chmod(mode, list, options={})
+ _r 'chmod', Array(list).unshift(mode.to_s(8))
+ end
+
+ def chmod_R(mode, list, options={})
+ _r 'chmod -R', Array(list).unshift(mode.to_s(8))
+ end
+
+ def install(src, dest, options={})
+ src = Array(src)
+ case options[:mode]
+ when Fixnum
+ src << '-m' << options[:mode].to_s(8)
+ when String
+ src << '-m' << options[:mode]
+ end
+ _r 'install', src.push(dest)
+ end
+
FILE_TESTS.each do |m,t|
class_eval <<-EODEF
def #{m}(a, options={})
_t "test #{t}", a
end
@@ -66,10 +85,25 @@
def pwd
capture 'pwd', :via => _via
end
+ def tar_c(dest, src, options={}, &filter)
+ filter and abort "tar_c: remote mode does not support a filtering proc"
+ _r 'tar -cf', Array(src).unshift(dest)
+ end
+
+ def tar_cz(dest, src, options={}, &filter)
+ filter and abort "tar_cz: remote mode does not support a filtering proc"
+ _r 'tar -czf', Array(src).unshift(dest)
+ end
+
+ def tar_cj(dest, src, options={}, &filter)
+ filter and abort "tar_cj: remote mode does not support a filtering proc"
+ _r 'tar -cjf', Array(src).unshift(dest)
+ end
+
private
def _t(cmd, args=nil, min=nil)
cmd = _a cmd, args, min
if _via == :system then
@@ -101,10 +135,10 @@
cmd = "#{cmd} #{_q args}"
end
end
def _q(*list)
- list.map { |l| "'#{l.gsub("'", "\\'")}'" }.join ' '
+ list.map { |l| "'#{l.to_s.gsub("'", "\\'")}'" }.join ' '
end
def _via
@config.fetch(:run_method, nil)
end