Skip to content

Instantly share code, notes, and snippets.

@aantix
Created January 19, 2011 21:38
Show Gist options
  • Save aantix/786917 to your computer and use it in GitHub Desktop.
Save aantix/786917 to your computer and use it in GitHub Desktop.
RSyncs all svn changed files to a remote VM volume. Useful when you want to test changes on a remote VM, but not necessarily commit them to the SVN trunk.
#!/usr/bin/env ruby
ignore_patterns = ["db/","test","log","reports","server","vendor/","Gemfile","tmp",".idea","config/",".DS_Store", ".xml", '.zip']
ignore_statuses = ['!','D','?']
changed_files = (`svn status`).split("\n").collect do |e|
p = e.split(/\s+/)
ignore_statuses.include?(p[0]) ? nil : p[p.size - 1]
end.compact
filtered_files = changed_files.select {|cf| !(ignore_patterns.any?{|ip| (cf =~ /#{Regexp.escape(ip)}/)})}
puts "Syncing..."
filtered_files.each do |ff|
puts " #{ff}"
`rsync #{ff} <username>@<server address>:/remote/server/volume/#{ff}`
end
puts "Done syncing."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment