-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
43 lines (32 loc) · 927 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
37
38
39
40
41
42
43
namespace :deploy do
desc "Deploy if Travis environment variables are set correctly"
task :travis do
branch = ENV['TRAVIS_BRANCH']
pull_request = ENV['TRAVIS_PULL_REQUEST']
abort 'Must be run on Travis' unless branch
if pull_request != 'false'
puts 'Skipping deploy for pull request; can only be deployed from master branch.'
exit 0
end
if branch != 'master'
puts "Skipping deploy for #{ branch }; can only be deployed from master branch."
exit 0
end
sh 'bundle exec middleman s3_sync'
end
end
desc "Build site locally"
task :build do
sh 'bundle exec middleman build --verbose'
end
desc "Start middleman server"
task :server do
puts "Starting Middleman server"
middleman = Process.spawn("bundle exec middleman")
trap("INT") {
Process.kill(9, middleman) rescue Errno::ESRCH
exit 0
}
Process.wait(middleman)
end
task :default => :server