import os
import os.path
-from wizard import command
+from wizard import command, shell
def main(argv, baton):
options, args = parse_args(argv, baton)
raise Exception("Not in root directory of Git working copy")
os.mkdir(".scripts")
open(".scripts/.htaccess", "w").write("Deny from all\n")
+ shell.call("git", "add", ".scripts")
def parse_args(argv, baton):
usage = """usage: %prog prepare-new
"""
return util.fetch(options.web_host, options.web_path, path, post)
-def preloads():
- """
- Retrieves a dictionary of string names to precanned :class:`ArgSet` objects.
- """
- return {
- 'web': WebArgSet(),
- 'webstub': WebStubArgSet(),
- 'db': DbArgSet(),
- 'admin': AdminArgSet(),
- 'email': EmailArgSet(),
- 'title': TitleArgSet(),
- }
-
class Strategy(object):
"""
Represents a strategy for calculating arg values without user input.
"""Uses :envvar:`USER` and assumes you are an MIT affiliate."""
# XXX: should double-check that you're on a scripts server
# and fail if you're not.
+ # XXX: This might be buggy, because locker might be set to USER
self._user = os.getenv("USER")
if self._user is None:
raise StrategyFailed
prompt="Please decide on a title for your new website."),
]
+def preloads():
+ """
+ Retrieves a dictionary of string names to precanned :class:`ArgSet` objects.
+ """
+ return {
+ 'web': WebArgSet(),
+ 'webstub': WebStubArgSet(),
+ 'db': DbArgSet(),
+ 'admin': AdminArgSet(),
+ 'email': EmailArgSet(),
+ 'title': TitleArgSet(),
+ }
+
class ArgSchema(object):
"""
Schema container for arguments.
Valid identifiers for subclasses of :class:`ArgSet` are:
- * ``mysql``, which populates the options ``mysql_host``, ``mysql_db``,
- ``mysql_user`` and ``mysql_password``.
+ * ``webstub``, which populates ``web_stub_path``.
+ * ``db``, which populates the option ``dsn``, which is a SQLAlchemy
+ database source name, with properties for ``drivername``,
+ ``username``, ``password``, ``host``, ``port``, ``database`` and
+ ``query``.
* ``admin``, which populates the options ``admin_name`` and
``admin_password``.
* ``email``, which populates the option ``email``.
Example::
- parser = ArgHandler("mysql", "admin", "email")
+ parser = ArgHandler("db", "admin", "email")
parser.add(Arg("title", help="Title of the new application"))
"""
#: Dictionary of argument names to :class:`Arg` objects in schema.