How to use plugins method in stryker-parent

Best JavaScript code snippet using stryker-parent

PluginComponent.py

Source:PluginComponent.py Github

copy

Full Screen

1import os2from bisect import insort3from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS4from Tools.Import import my_import5from Tools.Profile import profile6from Plugins.Plugin import PluginDescriptor7import keymapparser8class PluginComponent:9 firstRun = True10 restartRequired = False11 def __init__(self):12 self.plugins = {}13 self.pluginList = [ ]14 self.installedPluginList = [ ]15 self.setPluginPrefix("Plugins.")16 self.resetWarnings()17 def setPluginPrefix(self, prefix):18 self.prefix = prefix19 def addPlugin(self, plugin):20 if self.firstRun or not plugin.needsRestart:21 self.pluginList.append(plugin)22 for x in plugin.where:23 insort(self.plugins.setdefault(x, []), plugin)24 if x == PluginDescriptor.WHERE_AUTOSTART:25 plugin(reason=0)26 else:27 self.restartRequired = True28 def removePlugin(self, plugin):29 self.pluginList.remove(plugin)30 for x in plugin.where:31 self.plugins[x].remove(plugin)32 if x == PluginDescriptor.WHERE_AUTOSTART:33 plugin(reason=1)34 def readPluginList(self, directory):35 """enumerates plugins"""36 new_plugins = []37 for c in os.listdir(directory):38 directory_category = os.path.join(directory, c)39 if not os.path.isdir(directory_category):40 continue41 for pluginname in os.listdir(directory_category):42 path = os.path.join(directory_category, pluginname)43 if os.path.isdir(path):44 profile('plugin '+pluginname)45 try:46 plugin = my_import('.'.join(["Plugins", c, pluginname, "plugin"]))47 plugins = plugin.Plugins(path=path)48 except Exception, exc:49 print "Plugin ", c + "/" + pluginname, "failed to load:", exc50 # supress errors due to missing plugin.py* files (badly removed plugin)51 for fn in ('plugin.py', 'plugin.pyo'):52 if os.path.exists(os.path.join(path, fn)):53 self.warnings.append( (c + "/" + pluginname, str(exc)) )54 from traceback import print_exc55 print_exc()56 break57 else:58 print "Plugin probably removed, but not cleanly in", path59 try:60 os.rmdir(path)61 except:62 pass63 continue64 # allow single entry not to be a list65 if not isinstance(plugins, list):66 plugins = [ plugins ]67 for p in plugins:68 p.path = path69 p.updateIcon(path)70 new_plugins.append(p)71 keymap = os.path.join(path, "keymap.xml")72 if fileExists(keymap):73 try:74 keymapparser.readKeymap(keymap)75 except Exception, exc:76 print "keymap for plugin %s/%s failed to load: " % (c, pluginname), exc77 self.warnings.append( (c + "/" + pluginname, str(exc)) )78 # build a diff between the old list of plugins and the new one79 # internally, the "fnc" argument will be compared with __eq__80 plugins_added = [p for p in new_plugins if p not in self.pluginList]81 plugins_removed = [p for p in self.pluginList if not p.internal and p not in new_plugins]82 #ignore already installed but reloaded plugins83 for p in plugins_removed:84 for pa in plugins_added:85 if pa.path == p.path and pa.where == p.where:86 pa.needsRestart = False87 for p in plugins_removed:88 self.removePlugin(p)89 for p in plugins_added:90 if self.firstRun or p.needsRestart is False:91 self.addPlugin(p)92 else:93 for installed_plugin in self.installedPluginList:94 if installed_plugin.path == p.path:95 if installed_plugin.where == p.where:96 p.needsRestart = False97 self.addPlugin(p)98 if self.firstRun:99 self.firstRun = False100 self.installedPluginList = self.pluginList101 def getPlugins(self, where):102 """Get list of plugins in a specific category"""103 if not isinstance(where, list):104 # if not a list, we're done quickly, because the105 # lists are already sorted106 return self.plugins.get(where, [])107 res = []108 # Efficiently merge two sorted lists together, though this109 # appears to never be used in code anywhere...110 for x in where:111 for p in self.plugins.get(x, []):112 insort(res, p)113 return res114 def getPluginsForMenu(self, menuid):115 res = [ ]116 for p in self.getPlugins(PluginDescriptor.WHERE_MENU):117 res += p(menuid)118 return res119 def clearPluginList(self):120 self.pluginList = []121 self.plugins = {}122 def reloadPlugins(self, dummy=False):123 self.clearPluginList()124 self.readPluginList(resolveFilename(SCOPE_PLUGINS))125 def shutdown(self):126 for p in self.pluginList[:]:127 self.removePlugin(p)128 def resetWarnings(self):129 self.warnings = [ ]130 def getNextWakeupTime(self):131 wakeup = -1132 for p in self.pluginList:133 current = p.getWakeupTime()134 if current > -1 and (wakeup > current or wakeup == -1):135 wakeup = current136 return int(wakeup)...

Full Screen

Full Screen

plugin_pool.py

Source:plugin_pool.py Github

copy

Full Screen

...10class PluginPool(object):11 def __init__(self):12 self.plugins = {}13 self.discovered = False14 def discover_plugins(self):15 if self.discovered:16 return17 self.discovered = True18 load('cms_plugins')19 def register_plugin(self, plugin):20 """21 Registers the given plugin(s).22 If a plugin is already registered, this will raise PluginAlreadyRegistered.23 """24 if hasattr(plugin,'__iter__'):25 warnings.warn("Registering more than one plugin at once will be deprecated in 2.3", DeprecationWarning)26 for single_plugin in plugin:27 self.register_plugin(single_plugin)28 return29 if not issubclass(plugin, CMSPluginBase):30 raise ImproperlyConfigured(31 "CMS Plugins must be subclasses of CMSPluginBase, %r is not."32 % plugin33 )34 plugin_name = plugin.__name__35 if plugin_name in self.plugins:36 raise PluginAlreadyRegistered(37 "Cannot register %r, a plugin with this name (%r) is already "38 "registered." % (plugin, plugin_name)39 )40 plugin.value = plugin_name41 self.plugins[plugin_name] = plugin42 if 'reversion' in settings.INSTALLED_APPS:43 try:44 from reversion.registration import RegistrationError45 except ImportError:46 from reversion.revisions import RegistrationError47 try:48 reversion_register(plugin.model)49 except RegistrationError:50 pass51 def unregister_plugin(self, plugin):52 """53 Unregisters the given plugin(s).54 If a plugin isn't already registered, this will raise PluginNotRegistered.55 """56 if hasattr(plugin,'__iter__'):57 warnings.warn("Unregistering more than one plugin at once will be deprecated in 2.3", DeprecationWarning)58 for single_plugin in plugin:59 self.unregister_plugin(single_plugin)60 return 61 plugin_name = plugin.__name__62 if plugin_name not in self.plugins:63 raise PluginNotRegistered(64 'The plugin %r is not registered' % plugin65 )66 del self.plugins[plugin_name]67 def get_all_plugins(self, placeholder=None, page=None, setting_key="plugins", include_page_only=True):68 self.discover_plugins()69 plugins = self.plugins.values()[:]70 plugins.sort(key=lambda obj: unicode(obj.name))71 final_plugins = []72 if page:73 template = page.get_template()74 else:75 template = None76 allowed_plugins = get_placeholder_conf(77 setting_key,78 placeholder,79 template,80 )81 for plugin in plugins:82 include_plugin = False83 if placeholder:84 if allowed_plugins:85 if plugin.__name__ in allowed_plugins:86 include_plugin = True87 elif setting_key == "plugins":88 include_plugin = True89 if plugin.page_only and not include_page_only:90 include_plugin = False91 if include_plugin:92 final_plugins.append(plugin)93 94 if final_plugins:95 plugins = final_plugins96 # plugins sorted by modules97 plugins = sorted(plugins, key=lambda obj: unicode(obj.module))98 return plugins99 def get_text_enabled_plugins(self, placeholder, page):100 plugins = self.get_all_plugins(placeholder, page)101 plugins +=self.get_all_plugins(placeholder, page, 'text_only_plugins')102 final = []103 for plugin in plugins:104 if plugin.text_enabled:105 if plugin not in final:106 final.append(plugin)107 return final108 def get_plugin(self, name):109 """110 Retrieve a plugin from the cache.111 """112 self.discover_plugins()113 return self.plugins[name]...

Full Screen

Full Screen

module.js

Source:module.js Github

copy

Full Screen

1angular.module('ngCordova.plugins', [2 'ngCordova.plugins.actionSheet',3 'ngCordova.plugins.adMob',4 'ngCordova.plugins.appAvailability',5 'ngCordova.plugins.appRate',6 'ngCordova.plugins.appVersion',7 'ngCordova.plugins.backgroundGeolocation',8 'ngCordova.plugins.badge',9 'ngCordova.plugins.barcodeScanner',10 'ngCordova.plugins.batteryStatus',11 'ngCordova.plugins.beacon',12 'ngCordova.plugins.ble',13 'ngCordova.plugins.bluetoothSerial',14 'ngCordova.plugins.brightness',15 'ngCordova.plugins.calendar',16 'ngCordova.plugins.camera',17 'ngCordova.plugins.capture',18 'ngCordova.plugins.clipboard',19 'ngCordova.plugins.contacts',20 'ngCordova.plugins.datePicker',21 'ngCordova.plugins.device',22 'ngCordova.plugins.deviceMotion',23 'ngCordova.plugins.deviceOrientation',24 'ngCordova.plugins.dialogs',25 'ngCordova.plugins.emailComposer',26 'ngCordova.plugins.facebook',27 'ngCordova.plugins.facebookAds',28 'ngCordova.plugins.file',29 'ngCordova.plugins.fileTransfer',30 'ngCordova.plugins.fileOpener2',31 'ngCordova.plugins.flashlight',32 'ngCordova.plugins.flurryAds',33 'ngCordova.plugins.ga',34 'ngCordova.plugins.geolocation',35 'ngCordova.plugins.globalization',36 'ngCordova.plugins.googleAds',37 'ngCordova.plugins.googleAnalytics',38 'ngCordova.plugins.googleMap',39 'ngCordova.plugins.googlePlayGame',40 'ngCordova.plugins.googlePlus',41 'ngCordova.plugins.healthKit',42 'ngCordova.plugins.httpd',43 'ngCordova.plugins.iAd',44 'ngCordova.plugins.imagePicker',45 'ngCordova.plugins.inAppBrowser',46 'ngCordova.plugins.instagram',47 'ngCordova.plugins.keyboard',48 'ngCordova.plugins.keychain',49 'ngCordova.plugins.launchNavigator',50 'ngCordova.plugins.localNotification',51 'ngCordova.plugins.media',52 'ngCordova.plugins.mMediaAds',53 'ngCordova.plugins.mobfoxAds',54 'ngCordova.plugins.mopubAds',55 'ngCordova.plugins.nativeAudio',56 'ngCordova.plugins.network',57 'ngCordovaOauth',58 'ngCordova.plugins.pinDialog',59 'ngCordova.plugins.preferences',60 'ngCordova.plugins.printer',61 'ngCordova.plugins.progressIndicator',62 'ngCordova.plugins.push',63 'ngCordova.plugins.push_v5',64 'ngCordova.plugins.sms',65 'ngCordova.plugins.socialSharing',66 'ngCordova.plugins.spinnerDialog',67 'ngCordova.plugins.splashscreen',68 'ngCordova.plugins.sqlite',69 'ngCordova.plugins.statusbar',70 'ngCordova.plugins.toast',71 'ngCordova.plugins.touchid',72 'ngCordova.plugins.vibration',73 'ngCordova.plugins.videoCapturePlus',74 'ngCordova.plugins.zip',75 'ngCordova.plugins.insomnia'...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1module.exports = function(config){2 config.set({3 });4}5module.exports = function(config){6 config.set({7 });8}9module.exports = function(config){10 config.set({11 });12}13module.exports = function(config){14 config.set({15 });16}17module.exports = function(config){18 config.set({19 });20}21module.exports = function(config){22 config.set({23 });24}25module.exports = function(config){26 config.set({27 });28}29module.exports = function(config){30 config.set({31 });32}33module.exports = function(config){34 config.set({35 });36}37module.exports = function(config){38 config.set({39 });40}41module.exports = function(config){42 config.set({43 });44}45module.exports = function(config){46 config.set({47 });48}49module.exports = function(config){50 config.set({51 });52}

Full Screen

Using AI Code Generation

copy

Full Screen

1const strykerPlugins = require('stryker-parent/plugins');2const plugins = strykerPlugins(/* options */);3module.exports = function(config) {4 config.set({5 });6};7const strykerPlugins = require('./test');8module.exports = function(config) {9 config.set({10 });11};12const strykerPlugins = require('./test');13module.exports = function(config) {14 config.set({15 });16};17const strykerPlugins = require('./test');18module.exports = function(config) {19 config.set({20 });21};22const strykerPlugins = require('./test');23module.exports = function(config) {24 config.set({25 });26};27const strykerPlugins = require('./test');28module.exports = function(config) {29 config.set({30 });31};32const strykerPlugins = require('./test');33module.exports = function(config) {34 config.set({35 });36};37const strykerPlugins = require('./test');38module.exports = function(config) {39 config.set({40 });41};42const strykerPlugins = require('./test');43module.exports = function(config) {44 config.set({45 });46};47const strykerPlugins = require('./test');48module.exports = function(config) {49 config.set({50 });51};52const strykerPlugins = require('./test');53module.exports = function(config) {54 config.set({55 });56};57const strykerPlugins = require('./test');58module.exports = function(config) {59 config.set({60 });61};

Full Screen

Using AI Code Generation

copy

Full Screen

1var plugins = require('stryker-parent').plugins;2var myPlugin = function() {3 return {4 'preTest': function() {5 console.log('preTest');6 },7 'postTest': function() {8 console.log('postTest');9 },10 'preTestRun': function() {11 console.log('preTestRun');12 },13 'postTestRun': function() {14 console.log('postTestRun');15 }16 };17};18plugins.add('myPlugin', myPlugin);19module.exports = function(config) {20 config.set({21 });22};23var plugins = require('stryker-parent').plugins;24var myPlugin = function() {25 return {26 'preTest': function() {27 var stryker = plugins.current('stryker');28 stryker.log('This is a log message');29 }30 };31};32plugins.add('myPlugin', myPlugin);33module.exports = function(config) {34 config.set({35 });36};37module.exports = function myPlugin() {38 return {39 'preTest': function() {40 console.log('preTest');41 }42 };43};44module.exports = function(config) {45 config.set({46 });47};48module.exports = function(config) {49 config.set({50 });51};

Full Screen

Using AI Code Generation

copy

Full Screen

1var parent = require('stryker-parent');2parent.plugins();3module.exports = {4 plugins: function() {5 console.log('plugins');6 }7};8module.exports = {9 plugins: function() {10 console.log('plugins');11 }12};13module.exports = {14 plugins: function() {15 console.log('plugins');16 }17};18module.exports = {19 plugins: function() {20 console.log('plugins');21 }22};23module.exports = {24 plugins: function() {25 console.log('plugins');26 }27};28module.exports = {29 plugins: function() {30 console.log('plugins');31 }32};33module.exports = {34 plugins: function() {35 console.log('plugins');36 }37};38module.exports = {39 plugins: function() {40 console.log('plugins');41 }42};43module.exports = {44 plugins: function() {45 console.log('plugins');46 }47};

Full Screen

Using AI Code Generation

copy

Full Screen

1var plugins = require('stryker-parent').plugins;2plugins.init();3plugins.load('stryker-foo');4plugins.load('stryker-bar');5plugins.load('stryker-baz');6var plugins = require('stryker-parent').plugins;7plugins.init();8plugins.load('stryker-foo');9plugins.load('stryker-bar');10plugins.load('stryker-baz');11var plugins = require('stryker-parent').plugins;12plugins.init();13plugins.load('stryker-foo');14plugins.load('stryker-bar');15plugins.load('stryker-baz');16var plugins = require('stryker-parent').plugins;17plugins.init();18plugins.load('stryker-foo');19plugins.load('stryker-bar');20plugins.load('stryker-baz');21var plugins = require('stryker-parent').plugins;22plugins.init();23plugins.load('stryker-foo');24plugins.load('stryker-bar');25plugins.load('stryker-baz');26var plugins = require('stryker-parent').plugins;27plugins.init();28plugins.load('stryker-foo');29plugins.load('stryker-bar');30plugins.load('stryker-baz');31var plugins = require('stryker-parent').plugins;32plugins.init();33plugins.load('stryker-foo');34plugins.load('stryker-bar');35plugins.load('stryker-baz');36var plugins = require('stryker-parent').plugins;37plugins.init();38plugins.load('stryker-foo');39plugins.load('stryker-bar');40plugins.load('stryker-baz');41var plugins = require('stryker-parent').plugins;42plugins.init();43plugins.load('stryker-foo');44plugins.load('stryker-bar');45plugins.load('stryker-baz');46var plugins = require('stryker-parent').plugins;47plugins.init();48plugins.load('stryker-foo');49plugins.load('stryker-bar');50plugins.load('stryker-baz');

Full Screen

Using AI Code Generation

copy

Full Screen

1var plugins = require('stryker-parent/plugins');2module.exports = function(config) {3 plugins(config);4}5var test = require('./test.js');6module.exports = function(config) {7 test(config);8}

Full Screen

Using AI Code Generation

copy

Full Screen

1var plugins = require('stryker-parent').plugins;2plugins.load('stryker-jasmine');3module.exports = function(config) {4 config.set({5 });6};7var stryker = require('stryker-parent').stryker;8module.exports = stryker.configure({9});

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stryker-parent automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful