Skip to content

Instantly share code, notes, and snippets.

@jdcantrell
Created December 8, 2011 18:53
Show Gist options
  • Save jdcantrell/1448036 to your computer and use it in GitHub Desktop.
Save jdcantrell/1448036 to your computer and use it in GitHub Desktop.
Base Guardfile for local dev on FeDev
# Add files and commands to this file, like the example:
# watch('file/path') { `command(s)` }
#
#
$username = 'jcantrell';
guard 'shell' do
def sync(from, to)
system("rsync -avz ./#{from}/ #{$username}@fedev.utah.trulia.com:#{to}/ --exclude '.svn'")
Notifier.notify("#{from} is up to date.", {title: "Sync Complete"})
end
def sync_common(from, to, file)
#todo move this if check to regex
if file.index(".svn") == nil
sync(from, "/home/#{$username}/svn/#{to}")
end
end
def sync_www(from, to, file)
if file.index(".svn") == nil
sync(from, "/home/#{$username}/public_html/#{to}")
end
end
#common repos
watch( %r{^common/.*} ) { |m| sync_common('common', 'common', m[0]) }
#playground and others
watch( %r{^playground} ) { |m| sync_www('playground', 'playground', m[0]) }
#current working branches
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment