testdata/mybook/lib/tasks/review.rake in review-retrovert-0.9.7 vs testdata/mybook/lib/tasks/review.rake in review-retrovert-0.9.8
- old
+ new
@@ -21,10 +21,22 @@
conf = ENV['config']
conf = CONFIG_FILE if conf.nil? || conf.empty?
return conf
end
+def setup_envvars()
+ {
+ 'c' => 'STARTER_CHAPTER',
+ 't' => 'STARTER_TARGET',
+ 'n' => 'STARTER_COMPILETIMES',
+ 'd' => 'STARTER_DRAFT',
+ }.each do |char, name|
+ v = ENV.delete(char)
+ ENV[name] = v if v && !v.empty?
+ end
+end
+
task default: :html_all
desc 'build html (Usage: rake build re=target.re)'
task :html => :prepare do
if ENV['re'].nil?
@@ -52,9 +64,11 @@
desc 'generate PDF file'
task :pdf => :prepare do
require 'review'
#require 'review/pdfmaker'
require './lib/ruby/review-pdfmaker'
+ #
+ setup_envvars() # ex: `c=01-install` => ENV['STARTER_CHAPTER']='01-install'
#
FileUtils.rm_rf [BOOK_PDF, BOOK, BOOK + '-pdf']
begin
ReVIEW::PDFMaker.execute(config_file())
rescue RuntimeError => ex