From 2f8d236ee49e339eb5f27c75482ea0b09d2fcde1 Mon Sep 17 00:00:00 2001 From: Tom Vaughan Date: Sat, 21 Sep 2013 11:53:59 -0300 Subject: [PATCH] Make username optional for sftp deployment. Like rsync. --- lib/middleman-deploy/commands.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/middleman-deploy/commands.rb b/lib/middleman-deploy/commands.rb index 6f0c2b7..d543b7e 100644 --- a/lib/middleman-deploy/commands.rb +++ b/lib/middleman-deploy/commands.rb @@ -111,18 +111,14 @@ EOF end case options.method - when :rsync + when :rsync, :sftp if (!options.host || !options.path) - print_usage_and_die "The rsync deploy method requires host and path to be set." + print_usage_and_die "The #{options.method} method requires host and path to be set." end when :ftp if (!options.host || !options.user || !options.password || !options.path) print_usage_and_die "The ftp deploy method requires host, user, password, and path to be set." end - when :sftp - if (!options.host || !options.user || !options.path) - print_usage_and_die "The sftp deploy method requires host, user and path to be set." - end end options @@ -253,6 +249,7 @@ EOF puts "## Deploying via sftp to #{user}@#{host}:#{path}" + # `nil` is a valid value for user and/or pass. Net::SFTP.start(host, user, :password => pass) do |sftp| sftp.mkdir(path) Dir.chdir(self.inst.build_dir) do