-
Notifications
You must be signed in to change notification settings - Fork 25
/
Rakefile
36 lines (29 loc) · 879 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
##### General configuration #####
require 'ostruct'
SITE = OpenStruct.new
SITE.output_dir = File.expand_path(File.join(File.dirname(__FILE__), *%w[build]))
SITE.rsync_args = %w[-av]
SITE.user = 'geeksam'
SITE.host = 'think-like-a-git.net'
SITE.remote_dir = '/home/geeksam/think-like-a-git.net/'
##### Site building #####
desc 'Build the site'
task :build do
sh 'middleman build'
end
task :clear_build_dir do
sh "rm -rf #{SITE.output_dir}"
end
desc 'Completely rebuild the site'
task :rebuild => ['clear_build_dir', 'build']
##### Deployment #####
namespace :deploy do
desc 'Deploy to the server using rsync'
task :rsync do
cmd = "rsync #{SITE.rsync_args.join(' ')} "
cmd << "#{SITE.output_dir}/ #{SITE.user}@#{SITE.host}:#{SITE.remote_dir}"
sh cmd
end
end
desc 'deploy the site to the webserver'
task :deploy => ['build', 'deploy:rsync']