From 0bbd80fedfea5f80f674c8c1dcefd18d80012df2 Mon Sep 17 00:00:00 2001 From: Julian Arni Date: Tue, 6 Aug 2013 14:00:31 -0400 Subject: [PATCH] Add verbose option --- docs/Makefile | 12 +++++++++--- docs/course_authors/Makefile | 6 ++++++ docs/data/Makefile | 11 +++++++++++ docs/developers/Makefile | 13 ++++++++++++- rakelib/docs.rake | 19 ++++++++++++------- rakelib/tests.rake | 4 ++-- 6 files changed, 52 insertions(+), 13 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 8e5e368266..3f441a2ef2 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,7 +1,13 @@ .PHONY: html +Q_FLAG = + +ifeq ($(quiet), true) +Q_FLAG = quiet=true +endif + html: - @cd $(CURDIR)/data && make html - @cd $(CURDIR)/course_authors && make html - @cd $(CURDIR)/developers && make html + @cd $(CURDIR)/data && make html $(Q_FLAG) + @cd $(CURDIR)/course_authors && make html $(Q_FLAG) + @cd $(CURDIR)/developers && make html $(Q_FLAG) diff --git a/docs/course_authors/Makefile b/docs/course_authors/Makefile index 0321201267..b05c2d944a 100644 --- a/docs/course_authors/Makefile +++ b/docs/course_authors/Makefile @@ -12,6 +12,12 @@ ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif +Q_FLAG = + +ifeq ($(quiet), true) +Q_FLAG = -q +endif + # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter diff --git a/docs/data/Makefile b/docs/data/Makefile index 281415b978..272527a445 100644 --- a/docs/data/Makefile +++ b/docs/data/Makefile @@ -7,6 +7,17 @@ SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +Q_FLAG = + +ifeq ($(quiet), true) +Q_FLAG = -q +endif + # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter diff --git a/docs/developers/Makefile b/docs/developers/Makefile index 868fc4a95b..65fea6d46e 100644 --- a/docs/developers/Makefile +++ b/docs/developers/Makefile @@ -7,10 +7,21 @@ SPHINXBUILD = sphinx-build PAPER = BUILDDIR = build +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +Q_FLAG = + +ifeq ($(quiet), true) +Q_FLAG = -q +endif + # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -q -d $(BUILDDIR)/doctrees -c source $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +ALLSPHINXOPTS = $(Q_FLAG) -d $(BUILDDIR)/doctrees -c source $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source diff --git a/rakelib/docs.rake b/rakelib/docs.rake index ddd2549f2b..3af50e2492 100644 --- a/rakelib/docs.rake +++ b/rakelib/docs.rake @@ -2,19 +2,24 @@ require 'launchy' # --- Develop and public documentation --- desc "Invoke sphinx 'make build' to generate docs." -task :builddocs, [:options] do |t, args| - if args.options == 'dev' +task :builddocs, [:type, :quiet] do |t, args| + args.with_defaults(:quiet => "quiet") + if args.type == 'dev' path = "docs/developer" - elsif args.options == 'author' + elsif args.type == 'author' path = "docs/course_authors" - elsif args.options == 'data' + elsif args.type == 'data' path = "docs/data" else path = "docs" end Dir.chdir(path) do - sh('make html') + if args.quiet == 'verbose' + sh('make html quiet=false') + else + sh('make html') + end end end @@ -34,7 +39,7 @@ task :showdocs, [:options] do |t, args| end desc "Build docs and show them in browser" -task :doc, [:options] => :builddocs do |t, args| - Rake::Task["showdocs"].invoke(args.options) +task :doc, [:type, :quiet] => :builddocs do |t, args| + Rake::Task["showdocs"].invoke(args.type, args.quiet) end # --- Develop and public documentation --- diff --git a/rakelib/tests.rake b/rakelib/tests.rake index 8b308efa15..f940c8f9c4 100644 --- a/rakelib/tests.rake +++ b/rakelib/tests.rake @@ -40,9 +40,9 @@ end desc "Run documentation tests" task :test_docs do # Be sure that sphinx can build docs w/o exceptions. - test_message = "If test fails, you shoud run %s and look at whole output and fix exceptions. + test_message = "If test fails, you shoud run '%s' and look at whole output and fix exceptions. (You shouldn't fix rst warnings and errors for this to pass, just get rid of exceptions.)" - puts (test_message % ["rake doc"]).colorize( :light_green ) + puts (test_message % ["rake doc[docs,verbose]"]).colorize( :light_green ) test_sh('rake builddocs') end