]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/command/install.py
Rewrite merge functionality into its own module.
[wizard.git] / wizard / command / install.py
index 5999c27ffa5661b200562ceb011548b3662275c2..fa7299aa8957b3b02237a21d4f35623a2a623d1b 100644 (file)
@@ -1,6 +1,7 @@
 import os
 import sys
 import distutils
+import logging
 
 import wizard
 from wizard import app, command, git, prompt, shell, util
@@ -18,7 +19,7 @@ def main(argv, baton):
         raise DirectoryExistsError
 
     appname, _, version = appstr.partition('-')
-    application = app.applications()[appname]
+    application = app.getApplication(appname)
 
     # get configuration
     schema = application.install_schema
@@ -40,17 +41,20 @@ Autoinstalls the application %s in the directory DIR.""" % (appname, appname))
     else:
         ihandler.ask(options)
 
-    sh = shell.Shell()
-    input.infobox("Copying files (this may take a while)...")
-    if not os.path.exists(dir):
-        sh.call("git", "clone", "-q", "--shared", application.repository(old_options.srv_path), dir)
+    if not os.path.exists(dir) or not os.listdir(dir):
+        input.infobox("Copying files (this may take a while)...")
+        shell.call("git", "clone", "-q", "--shared", application.repository(old_options.srv_path), dir)
+    else:
+        logging.info("Skipped clone")
     with util.ChangeDirectory(dir):
         if not old_options.retry and version and version != "head-scripts": # for ease in testing
-            sh.call("git", "reset", "-q", "--hard", appstr)
+            shell.call("git", "reset", "-q", "--hard", appstr)
         input.infobox("Installing...")
         application.install(distutils.version.LooseVersion(version), options)
         if not old_options.no_commit:
             git.commit_configure()
+    if not hasattr(options, "web_inferred"):
+        open(os.path.join(dir, ".scripts/url"), "w").write("http://%s%s" % (options.web_host, options.web_path)) # XXX: no support for https yet!
     input.infobox("Congratulations, your new install is now accessible at:\n\nhttp://%s%s" % (options.web_host, options.web_path), width=80)
 
 def configure_parser(parser, baton):