Skip to content

Commit

Permalink
add convenience Rake tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Rehfeld committed Feb 8, 2011
1 parent 31634d5 commit 2c981d5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
53 changes: 52 additions & 1 deletion Rakefile
@@ -1 +1,52 @@
require 'nanoc3/tasks'
require 'nanoc3/tasks'

desc "Compile /content to /output"
task :compile => :clean do
sh 'bundle exec nanoc compile'
end

desc "Preview (compile once) site on http://localhost:3000"
task :preview => :compile do
sh 'bundle exec nanoc view'
end

desc "Watch (auto-compile) site on http://localhost:3000"
task :watch => :compile do
sh 'bundle exec nanoc autocompile'
end

desc "Run validations (fails when errors are found)"
task :validate => :compile do
output = `rake validate:links`; puts output
if output =~ /^Broken link/
$stderr.puts 'Validation errors where found! ' +
'Task ABORTED!'
exit 1
end
end

desc "Commit and tag changes to git repo"
task :commit do
sh 'git add .'
sh 'git commit' unless `git status` =~ /^nothing to commit/
end

desc "Publish /output (commit, sync, tag and push)"
task :publish => [:compile, :validate, :commit, :'deploy:s3']do
sh 'git tag -f "live"'
sh 'git push'
end

namespace :deploy do
desc "Sync compiled /output to S3"
task :s3 do
site = Nanoc3::Site.new('.')
if site.nil?
$stderr.puts 'The current working directory does not seem to be a ' +
'valid/complete nanoc site directory; aborting.'
exit 1
end

sh "s3cmd --verbose --force --progress --no-encrypt --exclude='**.swp' --delete-removed sync output/ s3://#{site.config[:deploy][:default][:bucket]}"
end
end
4 changes: 4 additions & 0 deletions config.yaml
Expand Up @@ -40,6 +40,10 @@ data_sources:
# same as the items root, but applies to layouts rather than items.
layouts_root: /

deploy:
default:
bucket: inside.glnetworks.de

# TODO: change to live URL in production
base_url: http://localhost:3000
# base_url: http://www.glnetworks.de
Expand Down

0 comments on commit 2c981d5

Please sign in to comment.