Add buildpack
This commit is contained in:
parent
45a9fc0ad3
commit
d6c4dc0fcd
1 changed files with 29 additions and 0 deletions
29
.buildpack.rb
Normal file
29
.buildpack.rb
Normal file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue