コード例 #1
0
ファイル: views.py プロジェクト: gitter-badger/lisa-api
 def perform_update(self, serializer):
     instance = serializer.save()
     version_str = ''
     if instance.version:
         version_str = ''.join(["==", instance.version])
     pip.main(['install', 'lisa-plugins-' + instance.name + version_str])
     logger.info(msg="Plugin updated")
コード例 #2
0
 def perform_update(self, serializer):
     instance = serializer.save()
     version_str = ''
     if instance.version:
         version_str = ''.join(["==", instance.version])
     pip.main(['install', 'lisa-plugins-' + instance.name + version_str])
     logger.info(msg="Plugin updated")
コード例 #3
0
 def load_plugins(self):
     self.mgr = extension.ExtensionManager(namespace='lisa.api.plugins',
                                           invoke_on_load=True,
                                           verify_requirements=True)
     self.plugins = self.mgr.names()
     for plugin in self.plugins:
         self.django_plugins.append('lisa_plugins_%s' % plugin)
     logger.info("Loaded plugins : %s" % self.plugins)
コード例 #4
0
 def perform_create(self, serializer):
     instance = serializer.save()
     version_str = ''
     if instance.version:
         version_str = ''.join(["==", instance.version])
     pip.main(['install', 'lisa-plugins-' + instance.name + version_str])
     if settings.BASE_DIR:
         self._touch(fname='/'.join([settings.BASE_DIR, '__init__.py']))
     logger.info(msg="Plugin installed")
コード例 #5
0
ファイル: views.py プロジェクト: gitter-badger/lisa-api
 def perform_create(self, serializer):
     instance = serializer.save()
     version_str = ''
     if instance.version:
         version_str = ''.join(["==", instance.version])
     pip.main(['install', 'lisa-plugins-' + instance.name + version_str])
     if settings.BASE_DIR:
         self._touch(fname='/'.join([settings.BASE_DIR, '__init__.py']))
     logger.info(msg="Plugin installed")
コード例 #6
0
 def load_plugins(self):
     self.mgr = extension.ExtensionManager(
         namespace='lisa.api.plugins',
         invoke_on_load=True,
         verify_requirements=True
     )
     self.plugins = self.mgr.names()
     for plugin in self.plugins:
         self.django_plugins.append('lisa_plugins_%s' % plugin)
     logger.info("Loaded plugins : %s" % self.plugins)
コード例 #7
0
 def get_version(self, plugin_name):
     if self.plugins:
         try:
             version = self.mgr.map(lambda ext: (ext.name, ext.obj.get_version()))
             for plugin in version:
                 if plugin_name == plugin[0]:
                     return plugin[1]
         except RuntimeError:
             logger.info("There was a problem loading plugins")
     else:
         logger.info("There is no plugin loaded")
コード例 #8
0
 def get_version(self, plugin_name):
     if self.plugins:
         try:
             version = self.mgr.map(lambda ext:
                                    (ext.name, ext.obj.get_version()))
             for plugin in version:
                 if plugin_name == plugin[0]:
                     return plugin[1]
         except RuntimeError:
             logger.info("There was a problem loading plugins")
     else:
         logger.info("There is no plugin loaded")
コード例 #9
0
 def load_intents(self):
     if self.plugins:
         logger.info("Adding intents to database")
         try:
             self.mgr.map(lambda ext: (ext.name, ext.obj.add_intents()))
         except RuntimeError:
             logger.info("There was a problem loading plugins intents")
     else:
         logger.info("There is no plugin loaded")
コード例 #10
0
 def load_intents(self):
     if self.plugins:
         logger.info("Adding intents to database")
         try:
             self.mgr.map(lambda ext: (ext.name, ext.obj.add_intents()))
         except RuntimeError:
             logger.info("There was a problem loading plugins intents")
     else:
         logger.info("There is no plugin loaded")
コード例 #11
0
 def perform_destroy(self, instance):
     pip.main(['uninstall', '--yes', 'lisa-plugins-' + instance.name])
     instance.delete()
     if settings.BASE_DIR:
         self._touch(fname='/'.join([settings.BASE_DIR, '__init__.py']))
     logger.info(msg="Delete plugin")
コード例 #12
0
ファイル: views.py プロジェクト: gitter-badger/lisa-api
 def perform_destroy(self, instance):
     pip.main(['uninstall', '--yes', 'lisa-plugins-' + instance.name])
     instance.delete()
     if settings.BASE_DIR:
         self._touch(fname='/'.join([settings.BASE_DIR, '__init__.py']))
     logger.info(msg="Delete plugin")