From 9000451050e7a23ad0d709ec4e56e7786c8687a6 Mon Sep 17 00:00:00 2001 From: Pete Travis Date: Mar 17 2015 06:20:40 +0000 Subject: classes, now with a chance of function --- diff --git a/files/anerist/buildsteps.py b/files/anerist/buildsteps.py index eb09160..481cddd 100644 --- a/files/anerist/buildsteps.py +++ b/files/anerist/buildsteps.py @@ -8,12 +8,15 @@ class PublicanBuild(ShellCommand): flunkOnFailure = 1 description = ["building"] descriptionDone = ["build complete"] - command= [ + def __init__(self, langs=["all"]): + ShellCommand.__init__(self, **kwargs) + command= [ "/usr/bin/publican", "build", "--langs %s" % ','.join(langs),\ "--formats %s" % ",".join(formats) - ] + ] + self.setCommand(command) class ZanataPublicanPull(ShellCommand): name = "zanata pull" @@ -21,13 +24,18 @@ class ZanataPublicanPull(ShellCommand): flunkOnFailure = 1 description = ["pulling translations from Zanata"] descriptionDone = ["translations refreshed"] - command = [ + def __init__(self, zanata_username=None, zanata_api_key=None): + if zanata_username is None or zanata_api_key is None: + config.error("zanata_username and zanata_api_key are required") + shellCommand.__init__(self, **kwargs) + command = [ "/usr/bin/zanata", "--username %s" % zanata_username, "--apikey %s" % zanata_api_key, "--transdir ./%s/" % lang, "--lang %s" % lang ] + self.setCommand(command) class PublicanClean(ShellCommand): name = "publican clean"