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)
+++ /dev/null
-#!/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
-
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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 ..
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
+++ /dev/null
-#!/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 "--------------------------------------------------"
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")
+++ /dev/null
-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()
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('-')
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)
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):