8 from wizard import command, deploy, shell, util
10 def main(argv, baton):
11 options, args = parse_args(argv, baton)
12 # XXX: do something smart if -scripts is not at the end
15 if os.path.exists(dir):
16 raise DirectoryExistsError
17 appname, _, version = app.partition('-')
18 application = deploy.applications()[appname]
20 sh.call("git", "clone", "--shared", application.repository(options.srv_path), dir)
21 with util.ChangeDirectory(dir):
23 sh.call("git", "reset", "--hard", app)
24 # this command's stdin should be hooked up to ours
26 configure_args = args[2:] + command.makeBaseArgs(options)
27 sh.call("wizard", "configure", *configure_args, interactive=True)
28 except shell.PythonCallError:
31 def parse_args(argv, baton):
32 usage = """usage: %prog install [APP [DIR -- [SETUPARGS]]]
34 Autoinstalls the application APP in the directory
35 DIR. SETUPARGS are arguments that are passed to
36 'wizard configure', see 'wizard configure APP --help'
37 for possible arguments.
39 WARNING: This command's API may change."""
40 parser = command.WizardOptionParser(usage)
41 baton.push(parser, "srv_path")
42 options, args = parser.parse_all(argv)
43 # XXX: in the future, not specifying stuff is supported, since
44 # we'll prompt for it interactively
46 parser.error("must specify application and directory")
48 parser.error("must specify directory")
51 class DirectoryExistsError(wizard.Error):
53 return "Directory already exists"