You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by db...@apache.org on 2015/12/10 06:37:52 UTC

docs commit: Making language-generating script error out when it sees a language whose name it doesn't know.

Repository: cordova-docs
Updated Branches:
  refs/heads/master ce2879aab -> de535f6fa


Making language-generating script error out when it sees a language whose name it doesn't know.


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

Branch: refs/heads/master
Commit: de535f6faee6edd07a3c9aa35299d7ffafde2da7
Parents: ce2879a
Author: Dmitry Blotsky <dm...@gmail.com>
Authored: Wed Dec 9 21:37:45 2015 -0800
Committer: Dmitry Blotsky <dm...@gmail.com>
Committed: Wed Dec 9 21:37:45 2015 -0800

----------------------------------------------------------------------
 tools/bin/gen_languages.js | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/de535f6f/tools/bin/gen_languages.js
----------------------------------------------------------------------
diff --git a/tools/bin/gen_languages.js b/tools/bin/gen_languages.js
index 0ee27cf..0f60ccd 100755
--- a/tools/bin/gen_languages.js
+++ b/tools/bin/gen_languages.js
@@ -40,6 +40,7 @@ var LANGUAGE_MAP = {
 
 function main () {
 
+    var scriptName = process.argv[1];
     var rootDir = process.argv[2];
     var config = {};
 
@@ -54,6 +55,16 @@ function main () {
         var langPath     = path.join(rootDir, langId);
         var versionNames = util.listdirsSync(langPath);
 
+        // get language ID
+        var langName;
+        if (langId in LANGUAGE_MAP) {
+            langName = LANGUAGE_MAP[langId];
+        } else {
+            console.error("Language identifier '" + langId + "' doesn't have an associated name. Please fix that by changing " + scriptName + ".");
+            process.exit(1);
+        }
+
+        // set the language name and the versions it has
         config[langId] = {
             'name':     LANGUAGE_MAP[langId],
             'versions': versionNames


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org