Skip to content

Instantly share code, notes, and snippets.

@doritostains
Forked from Packetslave/gist:191209
Last active December 11, 2015 00:28
Show Gist options
  • Save doritostains/4516545 to your computer and use it in GitHub Desktop.
Save doritostains/4516545 to your computer and use it in GitHub Desktop.
# Deployment uses SFTP by default when you use deploy_via :copy, and there
# doesn't seem to be any way to configure it. Unfortunately, we don't run
# SFTP on our servers, so it fails. This forces it to use SCP instead.
# http://www.capify.org/index.php/OverridingTaskCommands
#
module UseScpForDeployment
def self.included(base)
base.send(:alias_method, :old_upload, :upload)
base.send(:alias_method, :upload, :new_upload)
end
def new_upload(from, to, options={}, &block)
options[:via] = :scp
old_upload(from, to, options, &block)
end
end
Capistrano::Configuration.send(:include, UseScpForDeployment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment