lib/capsaicin/files/remote.rb in joekhoobyar-capsaicin-0.1.2 vs lib/capsaicin/files/remote.rb in joekhoobyar-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 @@ -101,10 +120,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