def run(self): with self.app.test_request_context('/'): stream = ShipLogger.get_memory_stream() logger = ShipLogger() while not self._stopevent.isSet( ): print self._stopevent.isSet() line = stream.getvalue() if line: self.socketio.emit('deploy-log', {'data': line + "\n"}, namespace='/deploy') gevent.sleep(self._sleepperiod)
def deploy_clear_log(data): stream = ShipLogger.get_memory_stream() stream.truncate(0)
def deploy_connect(): stream = ShipLogger.get_memory_stream() stream.truncate(0)
import traceback from ship.logger import ShipLogger from ship.project import ProjectBuilder from ship.validator import * from ship.errors import SVNException, ProjectIdNotFoundException ENVIRONMENT = "sample" HOME = "/tmp/target" URL = "svn://localhost/repos/SAMPLE" PROJECT_NAME = "sample" KEY = "smp" VERSION = "trunk" if __name__ == "__main__": logger = ShipLogger("INFO") try: logger.success("Initializing project construction") rules = [ ConfigFileValidationRule, ConsoleLogValidationRule, PomXMLValidationRule, CompiledPackageExistsValidationRule ] project = ProjectBuilder(HOME, PROJECT_NAME, "/etc/uji/%s/app.properties" % KEY) \ .with_subversion(URL, VERSION) \ .with_maven() \ .with_validation_rules(rules) \ .build() \ .deploy(ENVIRONMENT) logger.success("Finished succesfully!!")