Class: Grifork::Config::Rsync
- Inherits:
-
Object
- Object
- Grifork::Config::Rsync
- Defined in:
- lib/grifork/config.rb
Instance Method Summary collapse
-
#initialize(args = %w(-az --delete))) ⇒ Rsync
constructor
A new instance of Rsync.
- #options ⇒ Object
Constructor Details
#initialize(args = %w(-az --delete))) ⇒ Rsync
Returns a new instance of Rsync.
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/grifork/config.rb', line 73 def initialize(args = %w(-az --delete)) case args when Array @options = args when Hash @delete = args[:delete] || true @verbose = args[:verbose] || false @bwlimit = args[:bwlimit] || nil @excludes = args[:excludes] || [] @rsh = args[:rsh] || nil @dry_run = args[:dry_run] || false end end |
Instance Method Details
#options ⇒ Object
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/grifork/config.rb', line 87 def @options ||= -> { opts = [] opts << ( @verbose ? '-avz' : '-az' ) opts << '--dry-run' if @dry_run opts << '--delete' if @delete opts.concat(['--rsh', @rsh]) if @rsh opts << "--bwlimit=#{@bwlimit}" if @bwlimit if @excludes.size > 0 @excludes.each { |ex| opts << "--exclude=#{ex}" } end opts }.call end |