Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 58 lines (49 sloc) 1.588 kb
2c981d5 Martin Rehfeld add convenience Rake tasks
authored
1 require 'nanoc3/tasks'
2
3 desc "Compile /content to /output"
4 task :compile => :clean do
5 sh 'bundle exec nanoc compile'
6 end
7
8 desc "Preview (compile once) site on http://localhost:3000"
9 task :preview => :compile do
10 sh 'bundle exec nanoc view'
11 end
12
13 desc "Watch (auto-compile) site on http://localhost:3000"
14 task :watch => :compile do
15 sh 'bundle exec nanoc autocompile'
16 end
17
18 desc "Run validations (fails when errors are found)"
19 task :validate => :compile do
de521bd Martin Rehfeld only validate internal links mandatory
authored
20 output = `rake validate:links:internal`; puts output
2c981d5 Martin Rehfeld add convenience Rake tasks
authored
21 if output =~ /^Broken link/
22 $stderr.puts 'Validation errors where found! ' +
23 'Task ABORTED!'
24 exit 1
25 end
26 end
27
28 desc "Commit and tag changes to git repo"
29 task :commit do
30 sh 'git add .'
31 sh 'git commit' unless `git status` =~ /^nothing to commit/
32 end
33
34 desc "Publish /output (commit, sync, tag and push)"
8c4278d Martin Rehfeld deployment task for heroku
authored
35 task :publish => [:compile, :commit, :'deploy:heroku'] do
2c981d5 Martin Rehfeld add convenience Rake tasks
authored
36 sh 'git tag -f "live"'
37 sh 'git push'
38 end
39
40 namespace :deploy do
8c4278d Martin Rehfeld deployment task for heroku
authored
41 desc "Push inside.glnetworks.de-live to heroku"
42 task :heroku do
2c981d5 Martin Rehfeld add convenience Rake tasks
authored
43 site = Nanoc3::Site.new('.')
44 if site.nil?
45 $stderr.puts 'The current working directory does not seem to be a ' +
46 'valid/complete nanoc site directory; aborting.'
47 exit 1
48 end
6fc820a Martin Rehfeld fix heroku deployment
authored
49 live_dir = File.expand_path("../#{site.config[:deploy]['default']['live_project']}")
2c981d5 Martin Rehfeld add convenience Rake tasks
authored
50
6fc820a Martin Rehfeld fix heroku deployment
authored
51 sh "cd '#{live_dir}' && git add ."
52 unless `cd '#{live_dir}' && git status` =~ /^nothing to commit/
53 sh "cd '#{live_dir}' && git commit -m 'content build #{Time.now}'"
54 sh "cd '#{live_dir}' && git push heroku"
8c4278d Martin Rehfeld deployment task for heroku
authored
55 end
2c981d5 Martin Rehfeld add convenience Rake tasks
authored
56 end
57 end
Something went wrong with that request. Please try again.