--- /dev/null
+import re
+
+from wizard import deploy
+
+def make_regex(var):
+ return re.compile('^\$' + var + r'''\s*=\s*((["\']).*\2;)$''', re.M)
+
+wizard_to_var = \
+ {'WIZARD_IP': 'IP' # obsolete
+ ,'WIZARD_SITENAME': 'wgSitename'
+ ,'WIZARD_SCRIPTPATH': 'wgScriptPath'
+ ,'WIZARD_EMERGENCYCONTACT': 'wgEmergencyContact'
+ ,'WIZARD_DBSERVER': 'wgDBserver'
+ ,'WIZARD_DBNAME': 'wgDBname'
+ ,'WIZARD_DBUSER': 'wgDBuser'
+ ,'WIZARD_DBPASSWORD': 'wgDBpassword'
+ ,'WIZARD_PROXYKEY': 'wgProxyKey'}
+
+class Application(deploy.Application):
+ pass
--- /dev/null
+php_ini_regexes = \
+ {'WIZARD_SESSIONNAME': None,
+ 'WIZARD_TMPDIR': None}
## -- some generic helper stuff --
def parse_install_lines(show, options, yield_errors = False):
- if not show: show = deploy.applications
+ if not show: show = deploy.applications()
show = frozenset(show)
for line in deploy.getInstallLines(options.versions_path):
# construction
self.versions[version] = ApplicationVersion(distutils.version.LooseVersion(version), self)
return self.versions[version]
@staticmethod
- def make(self, name):
- pass
+ def make(name):
+ """Makes an application, but uses the correct subtype if available."""
+ try:
+ __import__("wizard.app." + name)
+ return getattr(wizard.app, name).Application(name)
+ except ImportError:
+ return Application(name)
class ApplicationVersion(object):
"""Represents an abstract notion of a version for an application"""
version = "trunk"
except ValueError: # mostly from the a, b = foo.split(' ')
raise DeploymentParseError(deploydir, location)
- if not applookup: applookup = applications
+ if not applookup: applookup = applications()
try:
# defer to the application for version creation
return applookup[app].makeVersion(version)
# these are technically deprecated
"advancedpoll", "gallery",
]
-
-"""Hash table for looking up string application name to instance"""
-applications = dict([(n,Application(n)) for n in application_list ])
+_applications = None
+
+def applications():
+ """Hash table for looking up string application name to instance"""
+ global _applications
+ if not _applications:
+ _applications = dict([(n,Application.make(n)) for n in application_list ])
+ return _applications
assert isinstance(dlog[0].source, log.TarballInstall)
assert dlog[0].source.location == "/afs/athena.mit.edu/contrib/scripts/deploy/mediawiki.tar.gz"
assert dlog[0].source.isDev == False
- assert dlog[0].version == deploy.applications["mediawiki"].makeVersion('1.5.6')
+ assert dlog[0].version == deploy.applications()["mediawiki"].makeVersion('1.5.6')
assert dlog[1].datetime == datetime(2007, 10, 17, 3, 38, 2, tzinfo=tzoffset(None, -4 * 60 * 60))
assert dlog[1].user == "quentin@QUICHE-LORRAINE.MIT.EDU"
assert isinstance(dlog[1].source, log.OldUpdate)
assert dlog[1].source.isDev == True
- assert dlog[1].version == deploy.applications["mediawiki"].makeVersion('1.5.6')
+ assert dlog[1].version == deploy.applications()["mediawiki"].makeVersion('1.5.6')
assert dlog[2].datetime == datetime(2009, 6, 13, 21, 33, 0, tzinfo=tzoffset(None, -4 * 60 * 60))
assert dlog[2].user == "ezyang@mit.edu"
assert isinstance(dlog[2].source, log.WizardUpdate)
- assert dlog[2].version == deploy.applications["mediawiki"].makeVersion('1.14.0-scripts')
+ assert dlog[2].version == deploy.applications()["mediawiki"].makeVersion('1.14.0-scripts')