Skip to content

Instantly share code, notes, and snippets.

@dz0ny
Created May 5, 2012 19:29
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dz0ny/2604933 to your computer and use it in GitHub Desktop.
Save dz0ny/2604933 to your computer and use it in GitHub Desktop.
FTP Sync for Capistrano
load 'config/deploy'
desc "FTP Sync"
namespace :deploy do
desc "Sync and compile to remote by default"
task :default do
#assets.sprite
#assets.compile
remote.default
end
namespace :assets do
desc "Compile sprites for production"
task :sprite do
`cd assets && sprightly --json sprites.json --sprite ../app/public/css/app.png --css vendor/sprites.css`
end
desc "Compile assets for production"
task :compile do
`cd assets && brunch b -m`
end
end
namespace :remote do
desc "Mount to remote to local #{application}"
task :mount do
`mkdir ./mnt/#{application} -p`
`curlftpfs ftp://#{login}:#{password}@#{url} ./mnt/#{application}`
end
desc "Unmount #{application}"
task :umount do
`fusermount -u ./mnt/#{application}`
end
desc "clean #{application}"
task :clean do
self.umount
self.mount
`rm -rf ./mnt/#{application}#{deploy_to}/*`
self.umount
end
desc "Sync to remote server using rsync"
task :sync do
`lftp -c "set ftp:list-options -a; open ftp://#{login}:#{password}@#{url}; lcd #{app_path}; cd #{deploy_to}; mirror --reverse --delete --use-cache --verbose --allow-chown --allow-suid --no-umask --parallel=2 --exclude-glob .git"`
#{}`rsync -ruv --temp-dir=/tmp/#{application} --exclude '.git' --stats --progress --delete #{app_path} ./mnt/#{application}`
end
desc "Sync app to remote server"
task :default do
self.umount
self.mount
self.sync
self.umount
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment