From 2d9b8f6f298ee37c9568998271da8997945aa13b Mon Sep 17 00:00:00 2001 From: Matthew Kanwisher Date: Mon, 15 Jun 2015 15:17:06 +0700 Subject: [PATCH 01/10] add cover image --- docbook-xsl/fo.xsl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docbook-xsl/fo.xsl b/docbook-xsl/fo.xsl index 99fa754..8cadcef 100644 --- a/docbook-xsl/fo.xsl +++ b/docbook-xsl/fo.xsl @@ -49,6 +49,18 @@ + + + + my-titlepage + + + + + + + + From 661e5a3b76614207f8a9caa981991a75ca9010b0 Mon Sep 17 00:00:00 2001 From: Matthew Kanwisher Date: Mon, 15 Jun 2015 15:22:22 +0700 Subject: [PATCH 02/10] add cover image --- docbook-xsl/fo.xsl | 60 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/docbook-xsl/fo.xsl b/docbook-xsl/fo.xsl index 8cadcef..e9a2f6f 100644 --- a/docbook-xsl/fo.xsl +++ b/docbook-xsl/fo.xsl @@ -61,6 +61,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + my-titlepage + + + + + + + + + + + + + + + + + + + + + + + + From ad21f2d75f07c020bdfe353cd2bd11ccf54094df Mon Sep 17 00:00:00 2001 From: Matthew Kanwisher Date: Mon, 22 Jun 2015 15:41:35 +0700 Subject: [PATCH 03/10] allow multiple versions books to be built, passing in different environment variables --- lib/git-scribe.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/git-scribe.rb b/lib/git-scribe.rb index 627c8aa..9ce1f8c 100644 --- a/lib/git-scribe.rb +++ b/lib/git-scribe.rb @@ -20,15 +20,21 @@ class GitScribe attr_accessor :subcommand, :args, :options attr_reader :info - BOOK_FILE = 'book.asc' - OUTPUT_TYPES = ['docbook', 'html', 'pdf', 'epub', 'mobi', 'site'] + #Allow overrides of the config files so we let the user have multiple versions of the book + #maybe multiple languages or different formats + BOOK_FILE = ENV["GITSCRIBE_BOOK_FILE"] + BOOK_FILE ||= 'book.asc' + OUTPUT_TYPES = ['docbook', 'html', 'pdf', 'epub', 'mobi', 'site', 'ebook'] SCRIBE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) def initialize @subcommand = nil @args = [] @options = {} - @config = YAML::parse(File.open(local('.gitscribe'))).transform rescue {} + configfilename = ENV["GITSCRIBE_CONFIG_FILE"] + configfilename ||= '.gitscribe' + @config = YAML::parse(File.open(local(configfilename))).transform rescue {} + @decorate = Decorator.new end ## COMMANDS ## From 2b44e2f9c37b8767efde4048f08f2b9fb1eee83e Mon Sep 17 00:00:00 2001 From: Matthew Kanwisher Date: Mon, 22 Jun 2015 15:44:51 +0700 Subject: [PATCH 04/10] cleanup code --- lib/git-scribe.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/git-scribe.rb b/lib/git-scribe.rb index 9ce1f8c..cc070cd 100644 --- a/lib/git-scribe.rb +++ b/lib/git-scribe.rb @@ -22,8 +22,9 @@ class GitScribe #Allow overrides of the config files so we let the user have multiple versions of the book #maybe multiple languages or different formats - BOOK_FILE = ENV["GITSCRIBE_BOOK_FILE"] - BOOK_FILE ||= 'book.asc' + book_file = ENV["GITSCRIBE_BOOK_FILE"] + book_file ||= 'book.asc' + BOOK_FILE = book_file OUTPUT_TYPES = ['docbook', 'html', 'pdf', 'epub', 'mobi', 'site', 'ebook'] SCRIBE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) @@ -34,7 +35,6 @@ def initialize configfilename = ENV["GITSCRIBE_CONFIG_FILE"] configfilename ||= '.gitscribe' @config = YAML::parse(File.open(local(configfilename))).transform rescue {} - @decorate = Decorator.new end ## COMMANDS ## From 64b9301ea2497dce7dc20dba158a7593fe4740a2 Mon Sep 17 00:00:00 2001 From: Matthew Kanwisher Date: Mon, 22 Jun 2015 15:58:45 +0700 Subject: [PATCH 05/10] fix override code --- lib/git-scribe.rb | 5 ++--- lib/git-scribe/generate.rb | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/git-scribe.rb b/lib/git-scribe.rb index cc070cd..a33f2bc 100644 --- a/lib/git-scribe.rb +++ b/lib/git-scribe.rb @@ -22,9 +22,8 @@ class GitScribe #Allow overrides of the config files so we let the user have multiple versions of the book #maybe multiple languages or different formats - book_file = ENV["GITSCRIBE_BOOK_FILE"] - book_file ||= 'book.asc' - BOOK_FILE = book_file + OVERRIDE_NAME = ENV["GITSCRIBE_BOOK_FILE"] + BOOK_FILE = 'book.asc' OUTPUT_TYPES = ['docbook', 'html', 'pdf', 'epub', 'mobi', 'site', 'ebook'] SCRIBE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) diff --git a/lib/git-scribe/generate.rb b/lib/git-scribe/generate.rb index 397181e..57b95ed 100644 --- a/lib/git-scribe/generate.rb +++ b/lib/git-scribe/generate.rb @@ -34,6 +34,10 @@ def prepare_output_dir Dir.mkdir('stylesheets') rescue nil from_stdir = File.join(SCRIBE_ROOT, 'stylesheets') FileUtils.cp_r from_stdir, '.' + + if OVERRIDE_NAME != "" + FileUtils.mv OVERRIDE_NAME, "book.asc" + end end end From 51ac2afa661dbe9a2e69d73c30006c43d9cbbd6f Mon Sep 17 00:00:00 2001 From: Matthew Kanwisher Date: Mon, 22 Jun 2015 16:01:24 +0700 Subject: [PATCH 06/10] fix override code --- lib/git-scribe/generate.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/git-scribe/generate.rb b/lib/git-scribe/generate.rb index 57b95ed..c8fc506 100644 --- a/lib/git-scribe/generate.rb +++ b/lib/git-scribe/generate.rb @@ -34,10 +34,6 @@ def prepare_output_dir Dir.mkdir('stylesheets') rescue nil from_stdir = File.join(SCRIBE_ROOT, 'stylesheets') FileUtils.cp_r from_stdir, '.' - - if OVERRIDE_NAME != "" - FileUtils.mv OVERRIDE_NAME, "book.asc" - end end end @@ -335,6 +331,10 @@ def liquid_template(file) def gather_and_process files = Dir.glob("book/*") FileUtils.cp_r files, 'output', :remove_destination => true + + if OVERRIDE_NAME != "" + FileUtils.mv OVERRIDE_NAME, "book.asc" + end end def ex(command) From 89f9f6c492103a4eaec96205ebef8ac3403444e0 Mon Sep 17 00:00:00 2001 From: Matthew Kanwisher Date: Mon, 22 Jun 2015 16:04:16 +0700 Subject: [PATCH 07/10] fix directories --- lib/git-scribe/generate.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git-scribe/generate.rb b/lib/git-scribe/generate.rb index c8fc506..b9b6585 100644 --- a/lib/git-scribe/generate.rb +++ b/lib/git-scribe/generate.rb @@ -333,7 +333,7 @@ def gather_and_process FileUtils.cp_r files, 'output', :remove_destination => true if OVERRIDE_NAME != "" - FileUtils.mv OVERRIDE_NAME, "book.asc" + FileUtils.mv "output/#{OVERRIDE_NAME}", "output/book.asc" end end From fbe8e1d8e534667aab8be372c481011caf3fde06 Mon Sep 17 00:00:00 2001 From: Matthew Kanwisher Date: Mon, 22 Jun 2015 16:11:58 +0700 Subject: [PATCH 08/10] fix initialization --- lib/git-scribe.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git-scribe.rb b/lib/git-scribe.rb index a33f2bc..14aa379 100644 --- a/lib/git-scribe.rb +++ b/lib/git-scribe.rb @@ -22,7 +22,7 @@ class GitScribe #Allow overrides of the config files so we let the user have multiple versions of the book #maybe multiple languages or different formats - OVERRIDE_NAME = ENV["GITSCRIBE_BOOK_FILE"] + OVERRIDE_NAME = ENV["GITSCRIBE_BOOK_FILE"] || "" BOOK_FILE = 'book.asc' OUTPUT_TYPES = ['docbook', 'html', 'pdf', 'epub', 'mobi', 'site', 'ebook'] SCRIBE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) From dd8579e86651abfdc1255bc55964390701257bbf Mon Sep 17 00:00:00 2001 From: Chakrit Wichian Date: Tue, 18 Aug 2015 14:30:58 +0700 Subject: [PATCH 09/10] Don't do xmllint while generating EPUB. Since a2x invokes xmllint with `--nonet` but the DTD that's required for linting the XML is very unlikely to be available on the dev machine so it always errors out preventing the generation from contiuing. --- lib/git-scribe/generate.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git-scribe/generate.rb b/lib/git-scribe/generate.rb index b9b6585..df26b0b 100644 --- a/lib/git-scribe/generate.rb +++ b/lib/git-scribe/generate.rb @@ -38,7 +38,7 @@ def prepare_output_dir end def a2x(type) - "a2x -f #{type} -d book " + "a2x -f #{type} -d book --no-xmllint " end def a2x_wss(type) From 53a14ab7e9e04e6db294c356b45d341d60ead6ff Mon Sep 17 00:00:00 2001 From: Chakrit Wichian Date: Mon, 24 Aug 2015 14:46:41 +0700 Subject: [PATCH 10/10] Fix ruby version. --- .ruby-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .ruby-version diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..b1b25a5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.2.2