From 08875eebeca0777779e4bf71e1f68c20cb5db318 Mon Sep 17 00:00:00 2001 From: WhiteTrefoil Date: Sat, 18 Jan 2014 21:55:50 +0800 Subject: [PATCH] Supporting port config of SFTP --- README.md | 1 + USAGE | 1 + lib/middleman-deploy/methods/ftp.rb | 1 + lib/middleman-deploy/methods/sftp.rb | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b669d5b..a3e4233 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ Activate the extension by adding the following to `config.rb`: activate :deploy do |deploy| deploy.method = :sftp deploy.host = "sftp.example.com" + deploy.port = 22 deploy.path = "/srv/www/site" # Optional Settings # deploy.user = "tvaughan" # no default diff --git a/USAGE b/USAGE index 0e31012..c2f49ab 100644 --- a/USAGE +++ b/USAGE @@ -47,6 +47,7 @@ activate :deploy do |deploy| deploy.method = :sftp # host, user, passwword and path *must* be set deploy.host = "sftp.example.com" + deploy.port = 22 deploy.path = "/srv/www/site" # user is optional (no default) deploy.user = "tvaughan" diff --git a/lib/middleman-deploy/methods/ftp.rb b/lib/middleman-deploy/methods/ftp.rb index 633302e..09e21d8 100644 --- a/lib/middleman-deploy/methods/ftp.rb +++ b/lib/middleman-deploy/methods/ftp.rb @@ -15,6 +15,7 @@ module Middleman @user = self.options.user @pass = self.options.password @path = self.options.path + @port = self.options.port end def process diff --git a/lib/middleman-deploy/methods/sftp.rb b/lib/middleman-deploy/methods/sftp.rb index 8cd0b4c..1783e4a 100644 --- a/lib/middleman-deploy/methods/sftp.rb +++ b/lib/middleman-deploy/methods/sftp.rb @@ -10,7 +10,7 @@ module Middleman puts "## Deploying via sftp to #{self.user}@#{self.host}:#{path}" # `nil` is a valid value for user and/or pass. - Net::SFTP.start(self.host, self.user, :password => self.pass) do |sftp| + Net::SFTP.start(self.host, self.user, :password => self.pass, :port => self.port) do |sftp| sftp.mkdir(self.path) Dir.chdir(self.server_instance.build_dir) do