some ftp/sftp related clean-ups

This commit is contained in:
Tom Vaughan 2013-07-16 22:25:06 -04:00
parent c0a974d6a0
commit 9c925ff0e5
2 changed files with 18 additions and 9 deletions

View file

@ -109,7 +109,7 @@ Edit `config.rb`, and add:
activate :deploy do |deploy| activate :deploy do |deploy|
deploy.method = :sftp deploy.method = :sftp
deploy.host = "ftp.example.com" deploy.host = "sftp.example.com"
deploy.user = "tvaughan" deploy.user = "tvaughan"
deploy.password = "secret" deploy.password = "secret"
deploy.path = "/srv/www/site" deploy.path = "/srv/www/site"

View file

@ -47,7 +47,7 @@ module Middleman
def print_usage_and_die(message) def print_usage_and_die(message)
raise Error, "ERROR: " + message + "\n" + <<EOF raise Error, "ERROR: " + message + "\n" + <<EOF
You should follow one of the three examples below to setup the deploy You should follow one of the four examples below to setup the deploy
extension in config.rb. extension in config.rb.
# To deploy the build directory to a remote host via rsync: # To deploy the build directory to a remote host via rsync:
@ -72,15 +72,25 @@ activate :deploy do |deploy|
deploy.branch = "some-other-branch-name" deploy.branch = "some-other-branch-name"
end end
# To deploy the build directory to a remote host via ftp or sftp: # To deploy the build directory to a remote host via ftp:
activate :deploy do |deploy| activate :deploy do |deploy|
deploy.method = :ftp or :sftp deploy.method = :ftp
# host, user, passwword and path *must* be set # host, user, passwword and path *must* be set
deploy.host = "ftp.example.com" deploy.host = "ftp.example.com"
deploy.user = "tvaughan" deploy.user = "tvaughan"
deploy.password = "secret" deploy.password = "secret"
deploy.path = "/srv/www/site" deploy.path = "/srv/www/site"
end end
# To deploy the build directory to a remote host via sftp:
activate :deploy do |deploy|
deploy.method = :sftp
# host, user, passwword and path *must* be set
deploy.host = "sftp.example.com"
deploy.user = "tvaughan"
deploy.password = "secret"
deploy.path = "/srv/www/site"
end
EOF EOF
end end
@ -101,15 +111,14 @@ EOF
print_usage_and_die "The deploy extension requires you to set a method." print_usage_and_die "The deploy extension requires you to set a method."
end end
if (options.method == :rsync) case options.method
when :rsync
if (!options.host || !options.user || !options.path) if (!options.host || !options.user || !options.path)
print_usage_and_die "The rsync deploy method requires host, user, and path to be set." print_usage_and_die "The rsync deploy method requires host, user, and path to be set."
end end
end when :ftp, :sftp
if (options.method == :ftp || options.method == :sftp)
if (!options.host || !options.user || !options.password || !options.path) if (!options.host || !options.user || !options.password || !options.path)
print_usage_and_die "The ftp and sftp deploy methods requires host, user, password, and path to be set." print_usage_and_die "The #{options.method} method requires host, user, password, and path to be set."
end end
end end