Sha256: ead8b9b15664d46bf90c8632aecf3856548f14de31d8f4df9388b3c1c9c950dd

Contents?: true

Size: 1.15 KB

Versions: 225

Compression:

Stored size: 1.15 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 PCAWG)
excludes = %w(.save .crap .source tmp filecache open-remote)
excludes += (options[:exclude] || "").split(/,\s*/)
excludes_str = excludes.collect{|s| "--exclude '#{s}'" } * " "

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

source, target, _sep, *other = ARGV

cmd = "rsync -avztAXHP --copy-unsafe-links #{test_str} #{excludes_str} #{source} #{target} #{other * " "}"

if options[:print]
  puts cmd 
  exit 0
else
  CMD.cmd_log(cmd)
end

Version data entries

225 entries across 225 versions & 1 rubygems

Version Path
rbbt-util-5.43.0 share/rbbt_commands/rsync
rbbt-util-5.42.0 share/rbbt_commands/rsync
rbbt-util-5.41.1 share/rbbt_commands/rsync
rbbt-util-5.41.0 share/rbbt_commands/rsync
rbbt-util-5.40.5 share/rbbt_commands/rsync
rbbt-util-5.40.4 share/rbbt_commands/rsync
rbbt-util-5.40.3 share/rbbt_commands/rsync
rbbt-util-5.40.0 share/rbbt_commands/rsync
rbbt-util-5.39.0 share/rbbt_commands/rsync
rbbt-util-5.38.1 share/rbbt_commands/rsync
rbbt-util-5.38.0 share/rbbt_commands/rsync
rbbt-util-5.37.16 share/rbbt_commands/rsync
rbbt-util-5.37.15 share/rbbt_commands/rsync
rbbt-util-5.37.14 share/rbbt_commands/rsync
rbbt-util-5.37.13 share/rbbt_commands/rsync
rbbt-util-5.37.12 share/rbbt_commands/rsync
rbbt-util-5.37.11 share/rbbt_commands/rsync
rbbt-util-5.37.10 share/rbbt_commands/rsync
rbbt-util-5.37.9 share/rbbt_commands/rsync
rbbt-util-5.37.8 share/rbbt_commands/rsync