From 61182c9190d2add2adbca1c5a3bee2bccfa120d0 Mon Sep 17 00:00:00 2001 From: Matt Soucy Date: Wed, 25 May 2022 18:47:44 -0400 Subject: [PATCH] Pandoc rakefile --- 2022/05-gencant/Rakefile | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/2022/05-gencant/Rakefile b/2022/05-gencant/Rakefile index 8085388..d6eafb8 100644 --- a/2022/05-gencant/Rakefile +++ b/2022/05-gencant/Rakefile @@ -1,7 +1,38 @@ require 'squib' -task default: [:deck] +module OS + def OS.windows? + (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil + end + + def OS.mac? + (/darwin/ =~ RUBY_PLATFORM) != nil + end + + def OS.unix? + !OS.windows? + end + + def OS.linux? + OS.unix? and not OS.mac? + end + + def OS.jruby? + RUBY_ENGINE == 'jruby' + end +end + +task default: [:deck, :rules] task :deck do load 'deck.rb' end + +desc 'Build the rules PDF' +task rules: "_output/RULES.pdf" + +file "_output/RULES.pdf" => ["Rules.md", "_output"] do |t| + respaths = [".", "docs/"] + if OS.windows? then sep = ";" else sep = ":" end + sh "pandoc", "-o", t.name, t.source, "--resource-path=#{respaths.join(sep)}" +end \ No newline at end of file