Updated Branches:
  refs/heads/master f8894a315 -> 27f5921ca

Added command-line arguments to the bin/generate script to allow for
generating just en/edge (--edge) or a single specific lang/ver (en
1.6.0), while leaving the default to generate all languages and all
versions. This makes it much quicker to generate just the edge docs
when that is the only one being worked on.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/commit/27f5921c
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/tree/27f5921c
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/diff/27f5921c

Branch: refs/heads/master
Commit: 27f5921cac9b446b758e9efed6e07e853ccf9a17
Parents: f8894a3
Author: Marcel Kinard <cmarc...@gmail.com>
Authored: Mon Sep 24 13:42:34 2012 -0400
Committer: Marcel Kinard <cmarc...@gmail.com>
Committed: Mon Sep 24 13:42:34 2012 -0400

----------------------------------------------------------------------
 bin/generate          |   13 ++++++++++++-
 lib/docs_generator.rb |    4 +++-
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/27f5921c/bin/generate
----------------------------------------------------------------------
diff --git a/bin/generate b/bin/generate
index 3269a7b..c2074a4 100755
--- a/bin/generate
+++ b/bin/generate
@@ -22,6 +22,17 @@ $: << File.join(File.dirname(__FILE__), '..', 'lib')
 require 'docs_generator'
 
 generator = DocsGenerator.new
-generator.run
+
+# Can be invoked without any args, or with a specific language/version
+# such as "bin/generate en edge" which will build just that one, or
+# with the --edge flag to build just en/edge.
+if (ARGV[0] && (ARGV[0] == "--edge"))
+  generator.run("en", "edge")
+elsif (ARGV[0] && ARGV[1])
+  generator.run(ARGV[0], ARGV[1])
+else
+  # build all languages and versions
+  generator.run
+end
 
 puts " => #{generator.output_directory}"

http://git-wip-us.apache.org/repos/asf/incubator-cordova-docs/blob/27f5921c/lib/docs_generator.rb
----------------------------------------------------------------------
diff --git a/lib/docs_generator.rb b/lib/docs_generator.rb
index 2d4d5b4..16bc4eb 100644
--- a/lib/docs_generator.rb
+++ b/lib/docs_generator.rb
@@ -50,17 +50,19 @@ class DocsGenerator
   #     - Pre-file processing
   #     - Release and cleanup
   #
-  def run
+  def run(one_lang = nil, one_version = nil)
     empty_output_directory
 
     ignore_list = ['.', '..', '.DS_Store']
 
     Dir.foreach @input_directory do |language_dir|
       next if ignore_list.include? language_dir
+      next if one_lang and language_dir != one_lang
       language_path = File.join @input_directory, language_dir
 
       Dir.foreach language_path do |version_dir|
         next if ignore_list.include? version_dir
+        next if one_version and version_dir != one_version
         output_path = File.join @output_directory, language_dir, version_dir
         input_path  = File.join @input_directory,  language_dir, version_dir
         options     = { :lang => language_dir, :version => version_dir }

Reply via email to