from wizard import command, deploy, shell, util
def main(argv, baton):
- options, args = parse_args(argv)
+ options, args = parse_args(argv, baton)
# XXX: do something smart if -scripts is not at the end
- dir = args[0]
+ app = args[0]
+ dir = args[1]
if os.path.exists(dir):
raise DirectoryExistsError
- appname, _, version = options.app.partition('-')
- app = deploy.applications()[appname]
+ appname, _, version = app.partition('-')
+ application = deploy.applications()[appname]
sh = shell.Shell()
- sh.call("git", "clone", "--shared", app.repository, dir)
+ sh.call("git", "clone", "--shared", application.repository(options.srv_path), dir)
with util.ChangeDirectory(dir):
if version:
- sh.call("git", "checkout", options.app)
+ sh.call("git", "checkout", app)
# this command's stdin should be hooked up to ours
try:
- sh.call("wizard", "configure", *args[1:], interactive=True)
+ configure_args = args[2:] + command.makeBaseArgs(options)
+ sh.call("wizard", "configure", *configure_args, interactive=True)
except shell.PythonCallError:
sys.exit(1)
-def parse_args(argv):
+def parse_args(argv, baton):
usage = """usage: %prog install [APP [DIR -- [SETUPARGS]]]
Autoinstalls the application APP in the directory
WARNING: This command's API may change."""
parser = command.WizardOptionParser(usage)
- parser.add_option("--app", dest="app",
- help="Application to install, optionally specifying a version as APP-VERSION")
+ baton.push(parser, "srv_path")
options, args = parser.parse_all(argv)
+ # XXX: in the future, not specifying stuff is supported, since
+ # we'll prompt for it interactively
if not args:
- # XXX: in the future, not specifying stuff is supported, since
- # we'll prompt for it interactively
- parser.error("must specify application")
+ parser.error("must specify application and directory")
+ elif len(args) == 1:
+ parser.error("must specify directory")
return options, args
class DirectoryExistsError(wizard.Error):