Sha256: a5790cc828927cd857306fa23ec89e02a0976f7cb042c238b481d445176ddd29

Contents?: true

Size: 1.18 KB

Versions: 22

Compression:

Stored size: 1.18 KB

Contents

class Knj::Cmd_gen
  def self.rsync(args)
    cmd = ""
    
    if args[:bin]
      cmd << args[:bin]
    else
      cmd << "rsync"
    end
    
    cmd << " -az"
    
    if args[:verbose]
      1.upto(args[:verbose]) do
        cmd << "v"
      end
    end
    
    if args[:ssh]
      cmd << " -e ssh"
      
      if args[:port]
        cmd << " --rsh='ssh -p #{args[:port]}'"
      end
    end
    
    if args[:delete]
      cmd << " --delete"
    end
    
    if args[:exclude]
      args[:exclude].each do |dir|
        cmd << " --exclude \"#{dir}\""
      end
    end
    
    cmd << " \"#{args[:user]}@#{args[:host]}:#{args[:dir_host]}\" \"#{args[:dir_local]}\""
    
    return cmd
  end
  
  def self.tar(args)
    cmd = ""
    
    if args[:bin]
      cmd << args[:bin]
    else
      cmd << "tar"
    end
    
    cmd << " "
    cmd << "z"if args[:gzip]
    cmd << "x" if args[:extract]
    cmd << "f" if args[:file]
    cmd << "c" if args[:create]
    
    if args[:verbose]
      1.upto(args[:verbose]) do
        cmd << "v"
      end
    end
    
    cmd << " \"#{args[:archive_path]}\""
    
    args[:paths].each do |path|
      cmd << " \"#{path}\""
    end
    
    return cmd
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
knjrbfw-0.0.30 lib/knj/cmd_gen.rb
knjrbfw-0.0.29 lib/knj/cmd_gen.rb
knjrbfw-0.0.28 lib/knj/cmd_gen.rb
knjrbfw-0.0.27 lib/knj/cmd_gen.rb
knjrbfw-0.0.26 lib/knj/cmd_gen.rb
knjrbfw-0.0.25 lib/knj/cmd_gen.rb
knjrbfw-0.0.24 lib/knj/cmd_gen.rb
knjrbfw-0.0.23 lib/knj/cmd_gen.rb
knjrbfw-0.0.22 lib/knj/cmd_gen.rb
knjrbfw-0.0.21 lib/knj/cmd_gen.rb
knjrbfw-0.0.20 lib/knj/cmd_gen.rb
knjrbfw-0.0.19 lib/knj/cmd_gen.rb
knjrbfw-0.0.18 lib/knj/cmd_gen.rb
knjrbfw-0.0.17 lib/knj/cmd_gen.rb
knjrbfw-0.0.16 lib/knj/cmd_gen.rb
knjrbfw-0.0.15 lib/knj/cmd_gen.rb
knjrbfw-0.0.14 lib/knj/cmd_gen.rb
knjrbfw-0.0.13 lib/knj/cmd_gen.rb
knjrbfw-0.0.12 lib/knj/cmd_gen.rb
knjrbfw-0.0.11 lib/knj/cmd_gen.rb