From d6c4dc0fcdfa92b29737457fc69a855ad381754f Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Wed, 22 Aug 2012 14:12:03 -0400 Subject: [PATCH] Add buildpack --- .buildpack.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .buildpack.rb diff --git a/.buildpack.rb b/.buildpack.rb new file mode 100644 index 0000000..2cbc058 --- /dev/null +++ b/.buildpack.rb @@ -0,0 +1,29 @@ +require 'fileutils' + +class LanguagePack::Custom < LanguagePack::Rack + def self.use? + true + end + + def name + "Nanoc" + end + + # hack to hook into ruby pack + def run_assets_precompile_rake_task + require 'benchmark' + topic "Compiling nanoc site" + + cache_clear 'output' if ENV['CLEAR_CACHE'] + + puts "Found cached output directory." if cache_load 'output' + time = Benchmark.realtime { pipe("env PATH=$PATH:vendor/pygments:bin bundle exec nanoc compile") } + + if $?.success? + cache_store 'output' + puts "Nanoc compilation completed (#{"%.2f" % time}s)" + else + exit $?.to_i + end + end +end