def __new__(cls, clsname, superclasses, attributes): commands = {} for superclass in superclasses: if hasattr(superclass, 'COMMANDS'): commands.update(superclass.COMMANDS) if 'COMMANDS' in attributes: commands.update(attributes['COMMANDS']) attributes['COMMANDS'] = commands module = type.__new__(cls, clsname, superclasses, attributes) if clsname != 'Module': register_module(module) return module
checkout_title = u'[private] Checkout the given branch (default: master)' def action_checkout(self): self._checkout(config.options.branch) build_title = u'[private] Build' def action_build(self): cwd = self.get_path() local.chdir(cwd) # itools package: build if lfs.exists('%s/setup.conf' % cwd): build = '%s/bin/ipkg-build.py' % prefix if not lfs.exists(build): build = 'ipkg-build.py' local.run([build]) local.run([executable, 'setup.py', '--quiet', 'sdist']) dist_title = u'All of the above' def action_dist(self): actions = ['sync', 'checkout', 'build'] for name in actions: action = self.get_action(name) if action: action() # Register register_module('pysrc', pysrc)
def action_restart(self): print "**********************************************************" print " RESTART" print "**********************************************************" self.stop() self.start() reindex_title = u"Update catalog of an ikaaro instance" def action_reindex(self): print "**********************************************************" print " REINDEX" print "**********************************************************" self.stop() self.update_catalog() self.start() vhosts_title = u"List vhosts of ikaaro instance" def action_vhosts(self): print "**********************************************************" print " List Vhosts" print "**********************************************************" self.vhosts() # Register register_module("ikaaro", ikaaro) register_module("pyenv", pyenv)
print ' RESTART' print '**********************************************************' self.stop() self.start() reindex_title = u'Update catalog of an ikaaro instance' def action_reindex(self): print '**********************************************************' print ' REINDEX' print '**********************************************************' self.stop() self.start(readonly=True) self.update_catalog() self.stop() self.start() vhosts_title = u'List vhosts of ikaaro instance' def action_vhosts(self): print '**********************************************************' print ' List Vhosts' print '**********************************************************' self.vhosts() # Register register_module('ikaaro', ikaaro) register_module('pyenv', pyenv)
update_title = u'Update usine configuration' def action_update(self): """ If config folder is a GIT repository, rebase it """ print '**********************************************************' print ' UPDATE USINE CONFIGURATION' print '**********************************************************' path = expanduser('~/.usine') for x in lfs.get_names(path): folder = '{}/{}'.format(path, x) if lfs.exists('{}/.git'.format(folder)): local.run(['git', 'fetch', 'origin'], cwd=folder) local.run(['git', 'reset', '--hard', 'origin/master'], cwd=folder) def get_sections_by_type(self, type): return self.by_type.get(type, []) def get_section(self, type, name): key = (type, name) return self.by_type_and_name.get(key) # singleton config = configuration() register_module('config', configuration)
def action_restart(self): print '**********************************************************' print ' RESTART' print '**********************************************************' self.stop() self.start() reindex_title = u'Update catalog of an ikaaro instance' def action_reindex(self): print '**********************************************************' print ' REINDEX' print '**********************************************************' self.stop() self.update_catalog() self.start() vhosts_title = u'List vhosts of ikaaro instance' def action_vhosts(self): print '**********************************************************' print ' List Vhosts' print '**********************************************************' self.vhosts() # Register register_module('ikaaro', ikaaro) register_module('pyenv', pyenv)