Better names for configuration file.

Leonardo Robol [2011-10-02 13:52]
Better names for configuration file.
Filename
bundle.py
diff --git a/bundle.py b/bundle.py
index 70cc094..f999dd4 100755
--- a/bundle.py
+++ b/bundle.py
@@ -41,9 +41,9 @@ class Bundle():

         # Create packing information
         package_info = {
-            'appname': self._appname,
-            'appcmd': self._appcmd,
-            'appdir': os.path.basename (self._appdir),
+            'name': self._appname,
+            'cmd': self._appcmd,
+            'dir': os.path.basename (self._appdir),
             }

         # Add the directory that needs to be packed together
@@ -113,11 +113,11 @@ class Bundle():
         tar.close ()

         package_info = json.load (open ("info.bundle", "r"))
-        print_msg ("Launching %s" % package_info["appname"])
-        os.chdir (package_info["appdir"])
+        print_msg ("Launching %s" % package_info["name"])
+        os.chdir (package_info["dir"])

         # Executing the program
-        p = subprocess.Popen (package_info["appcmd"], shell = True)
+        p = subprocess.Popen (package_info["cmd"], shell = True)
         p.wait ()

         # Remove extracted files
@@ -138,9 +138,9 @@ To pack your application, simply create an application.info file
 similar to this (JSON coded dictionary)

 {
-    "appname": "My beatiful application",
-    "appdir":  "/home/me/dev/my_app",
-    "appcmd":  "./src/my_app"
+    "name": "My beatiful application",
+    "path":  "/home/me/dev/my_app",
+    "cmd":  "./src/my_app"
 }

 and then run ./bundle.py application.info
@@ -165,9 +165,9 @@ if __name__ == "__main__":
     else:
         print_msg ("Entering bundle mode")
         package_info = json.load (open (sys.argv[1], "r"))
-        bundle = Bundle (package_info["appname"])
-        b_path = bundle.bundle_app (package_info["appdir"],
-                                    package_info["appcmd"])
+        bundle = Bundle (package_info["name"])
+        b_path = bundle.bundle_app (package_info["path"],
+                                    package_info["cmd"])

         if b_path is not None:
             print_msg ("Bundle created correctly as %s" % b_path)
ViewGit