From 7e2bdfec6dea6caf368ef67bcbd9cc807a46cdd5 Mon Sep 17 00:00:00 2001 From: Radek 'Goblin' Pieczonka Date: Mon, 28 Jul 2014 13:52:51 +0200 Subject: [PATCH] on :push check if file exists on remote server and skip if it does --- lib/capistrano/tasks/upload-config.rake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/capistrano/tasks/upload-config.rake b/lib/capistrano/tasks/upload-config.rake index 868c8e4..0ad5d09 100644 --- a/lib/capistrano/tasks/upload-config.rake +++ b/lib/capistrano/tasks/upload-config.rake @@ -42,8 +42,12 @@ namespace :config do fetch(:config_files).each do |config| local_path = CapistranoUploadConfig::Helpers.get_local_config_name(config, fetch(:stage).to_s) if File.exists?(local_path) - info "Uploading config #{local_path} as #{config}" - upload! StringIO.new(IO.read(local_path)), File.join(shared_path, config) + if test("[ ! -f " + File.join(shared_path, config) + " ]") + info "Uploading config #{local_path} as #{config}" + upload! StringIO.new(IO.read(local_path)), File.join(shared_path, config) + else + info File.join(shared_path, config) + " alredy exists on server, skipping upload" + end else fail "#{local_path} doesn't exist" end