3. Run wizard `prepare-pristine APP-VERSION`
+ X. Commit, with name "Appname x.y.z"
+
4. Checkout the master branch
5. [FOR EXISTING REPOSITORIES]
--- /dev/null
+#!/bin/bash -e
+
+TESTNAME="upgrade_wordpress"
+source ./setup
+
+#wizard install wordpress-$VERSION-scripts "$TESTDIR" -- --title="My Blog"
+wizard install wordpress "$TESTDIR" -- --title="My Blog"
extractors.update(php.extractors)
substitutions = app.make_substitutions(seed)
substitutions.update(php.substitutions)
- install_schema = install.ArgSchema("mysql", "admin", "email")
- install_schema.add(install.Arg("title", help="Title of your new MediaWiki install"))
+ install_schema = install.ArgSchema("mysql", "admin", "email", "title")
def checkConfig(self, deployment):
return os.path.isfile(os.path.join(deployment.location, "LocalSettings.php"))
def detectVersion(self, deployment):
-from wizard import app
+import sqlalchemy
+import os
+
+from wizard import app, install, sql
from wizard.app import php
class Application(app.Application):
+ install_schema = install.ArgSchema("mysql", "email", "title")
def download(self, version):
return "http://wordpress.org/wordpress-%s.tar.gz" % version
+ def install(self, version, options):
+ post_setup_config = {
+ 'dbhost': options.mysql_host,
+ 'uname': options.mysql_user,
+ 'dbname': options.mysql_db,
+ 'pwd': options.mysql_password,
+ 'prefix': '',
+ 'submit': 'Submit',
+ 'step': '2',
+ }
+ post_install = {
+ 'weblog_title': options.title,
+ 'admin_email': options.email,
+ 'submit': 'Continue',
+ 'step': '2',
+ }
+ old_mode = os.stat(".").st_mode
+ os.chmod(".", 0777) # XXX: squick squick
+ install.fetch(options, "wp-admin/setup-config.php?step=2", post_setup_config)
+ result = install.fetch(options, "wp-admin/install.php?step=2", post_install)
+ os.chmod(".", old_mode)
+ if "Finished" not in result:
+ raise install.Failure()
+
+ # not sure what to do about this
+ meta = sql.mysql_connect(options)
+ wp_options = meta.tables["wp_options"]
+ wp_options.update().where(wp_options.c.option_name == 'siteurl').values(option_value=options.web_path).execute()
+ wp_options.update().where(wp_options.c.option_name == 'home').values(option_value="http://%s%s" % (options.web_host, options.web_path)).execute() # XXX: what if missing leading slash; this should be put in a function
import os
+from wizard import command
+
def main(argv, baton):
options, args = parse_args(argv, baton)
os.mkdir(".scripts")
- open(".scripts/.htaccess").write("Deny from all\n")
+ open(".scripts/.htaccess", "w").write("Deny from all\n")
def parse_args(argv, baton):
usage = """usage: %prog prepare-new
infile = urllib.urlopen(url)
shutil.copyfileobj(infile, outfile)
else:
- base = os.path.basename(args[0])
+ base = args[0]
# extract the files, but be smart: if only one directory is output,
# move the contents of that directory here
sh.call("tar", "xf", base)
'mysql': MysqlArgSet(),
'admin': AdminArgSet(),
'email': EmailArgSet(),
+ 'title': TitleArgSet(),
}
class Strategy(object):
Arg("email", help="Administrative email"),
]
+class TitleArgSet(ArgSet):
+ """Common arguments when a title is required."""
+ def __init__(self):
+ self.args = [
+ Arg("title", help="Title of your new site"),
+ ]
+
class ArgSchema(object):
"""
Schema container for arguments.
--- /dev/null
+import sqlalchemy
+
+def mysql_connect(options):
+ """Convenience method for connecting to a MySQL database."""
+ engine = sqlalchemy.create_engine(sqlalchemy.engine.url.URL(
+ "mysql",
+ username=options.mysql_user,
+ password=options.mysql_password,
+ host=options.mysql_host,
+ database=options.mysql_db,
+ ))
+ meta = sqlalchemy.MetaData()
+ meta.bind = engine
+ meta.reflect()
+ return meta