summaryrefslogtreecommitdiff
path: root/Rakefile
diff options
context:
space:
mode:
authordavidtsadler <davidtsadler@googlemail.com>2012-03-31 18:42:15 +0100
committerdavidtsadler <davidtsadler@googlemail.com>2012-03-31 18:42:15 +0100
commit17f53ef0628ace4c63909331243bf3a01a7c1944 (patch)
tree6f01044b82b3210db9c44d9576093049e3436ed8 /Rakefile
parent1d1b282f2d3b08340e84ab48805a7c74c732537c (diff)
Allow site to be deployed via rsync.
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile12
1 files changed, 10 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index afe81da..025d65d 100644
--- a/Rakefile
+++ b/Rakefile
@@ -9,8 +9,16 @@ namespace :site do
desc 'Builds the site and deploys it locally using the built in server.'
task :development => [:'env:development', :'build:development']
- desc 'Builds the site and deploys it to a remote server.'
- task :production => [:'env:production', :'build:production']
+ desc 'Builds the site and deploys it to a remote server using rsync over ssh.'
+ task :production => [:'env:production', :'build:production'] do
+ config = @config['deployment'] || {}
+ host = config['host'] || ask('Host?', nil, lambda { |answer| !answer.empty? }, 'You must enter a host')
+ user = config['user'] || ask('User?', nil, lambda { |answer| !answer.empty? }, 'You must enter a user')
+ port = config['port'] || ask('Port?', '22', lambda { |answer| !answer.empty? }, 'You must enter a port number')
+ dir = config['directory'] || ask('Directory?', nil, lambda { |answer| !answer.empty? }, 'You must enter a directory')
+
+ system("rsync -avz --delete --rsh='ssh -p#{port}' #{@config['destination']}/ #{user}@#{host}:#{dir}")
+ end
end
namespace :build do