[bugzilla-gnome-org-extensions] Adjust casing of Javascript files



commit f1df0a4fad060beb91d7b83162a637a689c270ee
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Sat Sep 12 14:12:16 2009 -0400

    Adjust casing of Javascript files
    
    Make TestUtils module map to testUtils.js not testutils.js

 Makefile                               |    4 +++-
 flattener.py                           |    6 +++++-
 js/{testutils.js => testUtils.js}      |    0
 jstest.c                               |    3 ++-
 tests/{testutils.jst => testUtils.jst} |    0
 5 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/Makefile b/Makefile
index 3ddb8cb..19f81ca 100644
--- a/Makefile
+++ b/Makefile
@@ -12,13 +12,15 @@ JS_FILES =                                  \
        js/patch.js                             \
        js/review.js                            \
        js/splinter.js                          \
+       js/testUtils.js                         \
        js/utils.js
 
+
 TESTS =                                                \
        tests/bug.jst                           \
        tests/patch.jst                         \
        tests/review.jst                        \
-       tests/testutils.jst                     \
+       tests/testUtils.jst                     \
        tests/utils.jst
 
 CLEAN_FILES =                                  \
diff --git a/flattener.py b/flattener.py
index 038ae2e..0b16274 100755
--- a/flattener.py
+++ b/flattener.py
@@ -24,6 +24,10 @@ NONBLANK_RE = re.compile("\S")
 
 NAME_RE = re.compile("(?<![\w\.])\w+(?!\w)")
 
+def moduleToFilename(module_name):
+    base_name = module_name[0].lower() + module_name[1:] + ".js"
+    return os.path.join("js", base_name)
+
 class Flattener(object):
     def __init__(self, outf):
         self.outf = outf
@@ -64,7 +68,7 @@ class Flattener(object):
                 if not module_name in self.flattened_modules:
                     self.flattened_modules.add(module_name)
                     print "var %s = {};" % module_name
-                    self.flatten(os.path.join("js", module_name.lower() + ".js"), module_name)
+                    self.flatten(moduleToFilename(module_name), module_name)
             elif m.group(2) is not None:
                 if namespace is None:
                     print "function %s%s" % (m.group(2), m.group(3))
diff --git a/js/testutils.js b/js/testUtils.js
similarity index 100%
rename from js/testutils.js
rename to js/testUtils.js
diff --git a/jstest.c b/jstest.c
index 94f9a7a..12818fc 100644
--- a/jstest.c
+++ b/jstest.c
@@ -79,7 +79,8 @@ load_module(JSContext *cx, const char *module_name, JSObject **module_out)
     JSObject *module;
     jsval dummy;
 
-    lower_name = g_ascii_strdown (module_name, -1);
+    lower_name = g_strdup(module_name);
+    lower_name[0] = g_ascii_tolower(lower_name[0]);
     file_name = g_strconcat(lower_name, ".js", NULL);
     file_path = g_build_filename("js", file_name, NULL);
 
diff --git a/tests/testutils.jst b/tests/testUtils.jst
similarity index 100%
rename from tests/testutils.jst
rename to tests/testUtils.jst


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]