1
Fork 0
blog/Rakefile

41 lines
1,018 B
Ruby
Raw Normal View History

2011-08-25 10:20:25 +00:00
#!/usr/bin/env ruby
# encoding: utf-8
PRODUCTION = {
:url => "http://fnordig.de",
2011-08-25 10:25:59 +00:00
:log => "/home/badboy/git/fnordig.de/deploy.log",
2011-08-25 10:36:59 +00:00
:dest => "/var/www/sites/fnordig.de",
2011-08-25 10:25:59 +00:00
:source => "/home/badboy/git/fnordig.de/_site",
2011-08-25 10:20:25 +00:00
}
desc 'Generate page using jekyll'
task :generate do
sh "jekyll"
end
desc 'Serve the page on http://localhost:4000'
task :serve do
sh "jekyll --serve --auto"
end
namespace :deploy do
desc 'Deploy the page on the production machine (executed on production)'
task :production do
verbose(true) {
sh <<-EOF
2011-08-25 10:25:12 +00:00
(
2011-08-25 10:31:52 +00:00
echo -n "Production deployment: "; date;
echo "Resetting git & fetching from origin..."
2011-08-25 10:25:12 +00:00
git reset --hard HEAD &&
git pull origin master &&
2011-08-25 10:31:52 +00:00
echo "generating page..."
2011-08-25 10:25:12 +00:00
rake generate &&
2011-08-25 10:31:52 +00:00
echo "copy to webserver directory..."
2011-08-25 10:25:12 +00:00
cp -ar #{PRODUCTION[:source]}/* #{PRODUCTION[:dest]}
2011-08-25 10:31:52 +00:00
echo "deployment done"
) | tee #{PRODUCTION[:log]}
2011-08-25 10:20:25 +00:00
EOF
}
end
end