Sha256: f5b8ceda25c4f5aea8e433341d1a6de2d0a70d71ade4e71b3e1935d2bfb633af

Contents?: true

Size: 1.14 KB

Versions: 106

Compression:

Stored size: 1.14 KB

Contents

#!/usr/bin/env ruby

require 'rbbt-util'
require 'rbbt/util/simpleopt'

$0 = "rbbt #{$previous_commands*""} #{ File.basename(__FILE__) }" if $previous_commands

options = SOPT.setup <<EOF

RSync a directory, commonly ~/.rbbt/ 

$ rbbt rsync [options] <source_location> <target_location> -- [rsync_options]

You can specify extra rsync options after --

-h--help Print this help
-e--exclude* Additional excludes separated by ','
-es--excludes* Replace exlude list with these; separated by ','
-t--test Do a verbose dry run
-p--print Print command
EOF
if options[:help]
  if defined? rbbt_usage
    rbbt_usage 
  else
    puts SOPT.doc
  end
  exit 0
end

excludes = %w(.save .crap .source tmp filecache  open-remote workflows apps software jobs sinatra PCAWG)
excludes += (options[:exclude] || "").split(/,\s*/)
excludes_str = excludes.collect{|s| "--exclude '#{s}'" } * " "

test_str = options[:test] ? '-nv' : ''

source, target, _sep, *other = ARGV

cmd = "rsync -a #{test_str} #{excludes_str} #{source} #{target} #{other * " "}"

if options[:print]
  puts cmd 
  exit 0
else
  io = CMD.cmd(cmd, :log => true, :pipe => true)
  Misc.consume_stream(io, false, STDOUT)
end

Version data entries

106 entries across 106 versions & 1 rubygems

Version Path
rbbt-util-5.21.107 share/rbbt_commands/rsync
rbbt-util-5.21.106 share/rbbt_commands/rsync
rbbt-util-5.21.104 share/rbbt_commands/rsync
rbbt-util-5.21.103 share/rbbt_commands/rsync
rbbt-util-5.21.102 share/rbbt_commands/rsync
rbbt-util-5.21.101 share/rbbt_commands/rsync
rbbt-util-5.21.100 share/rbbt_commands/rsync
rbbt-util-5.21.99 share/rbbt_commands/rsync
rbbt-util-5.21.98 share/rbbt_commands/rsync
rbbt-util-5.21.97 share/rbbt_commands/rsync
rbbt-util-5.21.96 share/rbbt_commands/rsync
rbbt-util-5.21.95 share/rbbt_commands/rsync
rbbt-util-5.21.94 share/rbbt_commands/rsync
rbbt-util-5.21.93 share/rbbt_commands/rsync
rbbt-util-5.21.92 share/rbbt_commands/rsync
rbbt-util-5.21.91 share/rbbt_commands/rsync
rbbt-util-5.21.90 share/rbbt_commands/rsync
rbbt-util-5.21.89 share/rbbt_commands/rsync
rbbt-util-5.21.87 share/rbbt_commands/rsync
rbbt-util-5.21.86 share/rbbt_commands/rsync