lib/rbackup.rb in rbackup-0.1.5 vs lib/rbackup.rb in rbackup-0.1.6

- old
+ new

@@ -1,5 +1,7 @@ +require 'yaml' + class RBackup @@usage = <<-USAGE Usage: @@ -52,20 +54,20 @@ puts "\n Error:\n #{e}\n#{@@usage}" exit end def esc(paths) - paths = paths.to_a + paths = [ paths ].flatten paths.collect! { |path| path.gsub('SPEC', SPEC) } if $TESTING paths.collect { |path| path.gsub(' ', '\ ') }.join(' ') end def rsync(profile) inc1ude = [] exclude = [] destination = profile['destination'] - source = profile['source'].to_a + source = [ profile['source'] ].flatten options = "--delete --numeric-ids --safe-links -axzSvL" # --delete delete extraneous files from dest dirs # --numeric-ids don't map uid/gid values by user/group name # --safe-links ignore symlinks that point outside the tree @@ -84,14 +86,14 @@ FileUtils.mkdir_p destination end if profile['include'] exclude = %w(*) unless profile['exclude'] - inc1ude = profile['include'].to_a + inc1ude = [ profile['include'] ].flatten end if profile['exclude'] - exclude += profile['exclude'].to_a + exclude += [ profile['exclude'] ].flatten end inc1ude = inc1ude.collect { |i| "--include='#{i}'" }.join(' ') exclude = exclude.collect { |e| "--exclude='#{e}'" }.join(' ') # --exclude=PATTERN use one of these for each file you want to exclude \ No newline at end of file