namespace :guides do desc 'Generate guides (for authors), use ONLY=foo to process just "foo.md"' task generate: "generate:html" namespace :generate do desc "Generate HTML guides" task :html do ENV["WARNINGS"] = "1" # authors can't disable this ruby "rails_guides.rb" end desc "Generate .mobi file. The kindlegen executable must be in your PATH. You can get it for free from http://www.amazon.com/gp/feature.html?docId=1000765211" task :kindle do require "kindlerb" unless Kindlerb.kindlegen_available? abort "Please run `setupkindlerb` to install kindlegen" end unless `convert` =~ /convert/ abort "Please install ImageMagick" end ENV["KINDLE"] = "1" Rake::Task["guides:generate:html"].invoke end end # Validate guides ------------------------------------------------------------------------- desc 'Validate guides, use ONLY=foo to process just "foo.html"' task :validate do ruby "w3c_validator.rb" end desc "Show help" task :help do puts < folder (such as source/es) Examples: $ rake guides:generate ALL=1 RAILS_VERSION=v5.1.0 $ rake guides:generate ONLY=migrations $ rake guides:generate:kindle $ rake guides:generate GUIDES_LANGUAGE=es HELP end end task default: "guides:help"