class Megam::CmdVerb

Public Class Methods

cp(opts={}) click to toggle source

cp -r -s <from directory> <to directory>

   # File lib/megam/cmd_verb.rb
24  def self.cp(opts={}) 
25    cp =""
26    cp << "sudo " if opts[:sudo]
27    cp << "cp"
28    cp << " -r " if opts[:recursive]
29 #   cp << " -u " if opts[:copy_on_new] #copy  only  when  the  SOURCE file is newer than
30    cp << opts[:from_dir] if opts[:from_dir] or raise Megam::Exceptions::FileNotFound
31    cp << " "
32    cp << opts[:to_dir] if opts[:to_dir] or raise Megam::Exceptions::FileNotFound
33    cp
34  end
new() click to toggle source
   # File lib/megam/cmd_verb.rb
20 def initialize
21 end
untar(opts={}) click to toggle source

gunzip -c foo.tar.gz | tar xvf -

   # File lib/megam/cmd_verb.rb
37 def self.untar(opts={})
38   untar = "gunzip -c "
39   untar << opts[:tar_file] if opts[:tar_file] 
40   untar << " | tar xvf - -C "
41   untar << opts[:to_dir] if opts[:to_dir]
42   untar    
43 end

Public Instance Methods

to_s() click to toggle source
   # File lib/megam/cmd_verb.rb
45 def to_s
46   "cmdverb -> [supports cp, untar *only]"
47 end