]> scripts.mit.edu Git - wizard.git/commitdiff
Remove unnecessary commands, add help to install.
authorEdward Z. Yang <ezyang@mit.edu>
Mon, 2 Nov 2009 07:14:40 +0000 (02:14 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Mon, 2 Nov 2009 07:14:40 +0000 (02:14 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
TODO
bin/preserve-empty-dir [deleted file]
bin/unfurl [deleted file]
bin/wipe-working-dir [deleted file]
bin/wizard
bin/wizard-smoketest [deleted file]
wizard/command/__init__.py
wizard/command/configure.py [deleted file]
wizard/command/install.py

diff --git a/TODO b/TODO
index f5280bb8ce1b29150088522da056cc0e756a1d53..ec10358e58d31b3f602212b97aff18e9385f5fee 100644 (file)
--- a/TODO
+++ b/TODO
@@ -2,6 +2,12 @@ The Git Autoinstaller
 
 TODO NOW:
 
+- Do early validation of inputs for configuration
+- Let 'wizard configure' be interactive
+- Parse output HTML for class="error" and give those errors back to the user,
+  then boot them back into configure
+- Indicate a default is available in the --help message.
+
 - Keep my sanity when upgrading 1000 installs
     - Replace gaierror with a more descriptive name (this is a DNS error)
 
diff --git a/bin/preserve-empty-dir b/bin/preserve-empty-dir
deleted file mode 100755 (executable)
index ea06ffc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash -e
-
-if [[ "$1" = "" ]]
-then
-    echo "Usage: $0 directory"
-    echo "Adds a .preserve-dir file to all empty directories"
-    exit 1
-fi
-
-find "$1" -type d -empty -not -path "*/.git/*" -printf "%p/.preserve-dir\0" \
-    | xargs -0 -r touch
-
diff --git a/bin/unfurl b/bin/unfurl
deleted file mode 100755 (executable)
index c06ac39..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash -e
-if [[ "$1" = "" ]]
-then
-    echo "Usage: $0 app-1.2.3 app"
-    echo "Takes a app-1.2.3 folder from deploy and pastes it over app"
-    exit 1
-fi
-cd $1
-tar -xvf $1.tar.gz
-cd ..
-#cd $1
-#patch -p0 < $1.patch
-#rm $1.patch
-#cd ..
-cp -Rp $1/$2/. $2
diff --git a/bin/wipe-working-dir b/bin/wipe-working-dir
deleted file mode 100755 (executable)
index e8aea2f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash -e
-if [[ "$1" = "" ]]
-then
-    echo "Usage: $0 dir"
-    echo "Takes a git working copy and removes all its files"
-    exit 1
-fi
-cd $1
-find . -not -path "./.git/*" -not -path "./.git" -delete
-cd ..
index e492a5388a69ee2f3629bc69bbce3433c1df5dc7..a4da6a8a618cc10c68f3f43eb56d644361c8f828 100755 (executable)
@@ -36,7 +36,6 @@ Administrative commands:
     summary         Generate statistics (see help for subcommands)
 
 Utility commands:
-    configure       Configures an autoinstall (database, etc) to work
     prepare-pristine    Downloads and extracts pristine upstream files
     prepare-new     Prepares a new repository
     prepare-config  Prepares configuration files for versioning
diff --git a/bin/wizard-smoketest b/bin/wizard-smoketest
deleted file mode 100755 (executable)
index 5691676..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash -e
-# Poor man's acceptance testing!
-set -v
-! wizard help
-! wizard help summary
-! wizard summary help
-wizard summary
-wizard summary list
-wizard summary list mediawiki
-wizard summary list mediawiki-1.11.0
-wizard summary list-errors
-wizard summary version
-wizard summary version mediawiki
-wizard summary version mediawiki-1.11.0
-# wizard summary count-exists ...
-! wizard summary bogus
-set +v
-echo "--------------------------------------------------"
-echo "                       PASS                       "
-echo "No commands exited with unexpected non-zero status"
-echo "--------------------------------------------------"
index 3314ac0bbe8645ad5085b343ee9d27b185b20cca..4362e2f179abc93e43dedd8e22d27ef59fc09f25 100644 (file)
@@ -205,11 +205,18 @@ class NullLogHandler(logging.Handler):
 
 class WizardOptionParser(optparse.OptionParser):
     """Configures some default user-level options"""
+    store_help = False
     def __init__(self, *args, **kwargs):
         kwargs["add_help_option"] = False
+        if "store_help" in kwargs:
+            self.store_help = kwargs["store_help"]
+            del kwargs["store_help"]
         optparse.OptionParser.__init__(self, *args, **kwargs)
     def parse_all(self, *args, **kwargs):
-        self.add_option("-h", "--help", action="help", help=optparse.SUPPRESS_HELP)
+        if self.store_help:
+            self.add_option("-h", "--help", action="store_true", default=False, dest="help", help=optparse.SUPPRESS_HELP)
+        else:
+            self.add_option("-h", "--help", action="help", help=optparse.SUPPRESS_HELP)
         group = optparse.OptionGroup(self, "Common Options")
         group.add_option("-v", "--verbose", dest="verbose", action="store_true",
                 default=boolish(os.getenv("WIZARD_VERBOSE")), help="Turns on verbose output.  Envvar is WIZARD_VERBOSE")
diff --git a/wizard/command/configure.py b/wizard/command/configure.py
deleted file mode 100644 (file)
index 32d6333..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-import optparse
-import distutils.version
-import os
-
-from wizard import app, command, git, install, shell, util
-from wizard.install import installopt
-
-def main(argv, baton):
-
-    usage = """usage: %prog configure [ARGS]
-
-Takes an already cloned working copy and configures the
-application, running any installer scripts and creating
-configuration files.  Options change depending on what
-application is being configured in the current working directory.
-
-This is a plumbing command, normal users should use
-`%prog install`."""
-
-    # XXX: squick squick squick
-    if argv and argv[0][0] != '-':
-        if '--help' not in argv and '-h' not in argv:
-            argv.append('--help')
-    if '--help' in argv or '-h' in argv:
-        # Do a "fake parse" in order to get out the application name
-        parser = optparse.OptionParser(usage, add_help_option=False)
-        parser.add_option("--help", "-h", action="store_true")
-        options, args = parser.parse_args(argv)
-        try:
-            application = args[0]
-        except IndexError:
-            parser.error("Use 'wizard configure --help APP' to see APP-specific options.")
-        version = None # not relevant
-    else:
-        tag = git.describe()
-        application, _, version = tag.partition('-')
-
-    application = app.applications()[application]
-    schema = application.install_schema
-    handler = installopt.Controller(os.getcwd(), schema)
-
-    parser = command.WizardOptionParser(usage)
-    handler.push(parser)
-    options, args = parser.parse_all(argv)
-    handler.handle(options)
-
-    application.install(distutils.version.LooseVersion(version), options)
-
-    git.commit_configure()
index fa235957f80fe3f865ef470a6cdc52712db531b6..49d067ac2027446dd4c4daa74f706a486cec6fe9 100644 (file)
@@ -14,7 +14,7 @@ def main(argv, baton):
     appstr = args[0]
     dir = args[1]
 
-    if os.path.exists(dir) and os.listdir(dir):
+    if not old_options.help and os.path.exists(dir) and os.listdir(dir):
         raise DirectoryExistsError
 
     appname, _, version = appstr.partition('-')
@@ -25,8 +25,13 @@ def main(argv, baton):
     options = None
     opthandler = installopt.Controller(dir, schema)
     ihandler = interactive.Controller(dir, schema, input)
-    parser = command.WizardOptionParser()
+    parser = command.WizardOptionParser("""usage: %%prog install %s DIR [ -- SETUPARGS ]
+
+Autoinstalls the application %s in the directory DIR.""" % (appname, appname))
     opthandler.push(parser)
+    if old_options.help:
+        parser.print_help()
+        sys.exit(1)
     options, _ = parser.parse_all(args[2:] + command.make_base_args(old_options)) # accumulate
     if old_options.non_interactive:
         opthandler.handle(options)
@@ -48,21 +53,25 @@ def main(argv, baton):
 def parse_args(argv, baton):
     usage = """usage: %prog install APP DIR [ -- SETUPARGS ]
 
-Autoinstalls the application APP in the directory
-DIR.  SETUPARGS are arguments that are passed to
-'wizard configure', see 'wizard configure APP --help'
-for possible arguments.  If arguments are missing
-this command will interactively ask for them.
-"""
-    parser = command.WizardOptionParser(usage)
+Autoinstalls the application APP in the directory DIR.
+This command will interactively ask for information to
+complete the autoinstall."""
+    parser = command.WizardOptionParser(usage, store_help=True)
     parser.add_option("--prompt", dest="prompt", action="store_true",
             default=False, help="Force to use non-ncurses interactive interface")
     parser.add_option("--non-interactive", dest="non_interactive", action="store_true",
-            default=False, help="Force program to be non-interactive")
+            default=False, help="Force program to be non-interactive and use SETUPARGS.  Use --help with APP to find argument names.")
     baton.push(parser, "srv_path")
     options, args = parser.parse_all(argv)
-    if len(args) < 2:
-        parser.error("not enough arguments")
+    if options.help:
+        if len(args) == 0:
+            parser.print_help()
+            sys.exit(1)
+        elif len(args) == 1:
+            args.append(os.getcwd())
+    else:
+        if len(args) < 2:
+            parser.error("not enough arguments")
     return options, args
 
 class DirectoryExistsError(wizard.Error):