def setUp(self): self.raw = ''' # Sketch Plugin Directory A list of Sketch plugins hosted at GitHub, in alphabetical order. **Note:** if you want to add yours, just open an issue with the URL, or send a pull request. - [47deg/pointgrid](https://github.com/47deg/pointgrid) This plugin makes it easy to create different breakpoints during a responsive web design. - [8by8/sketchplugins](https://github.com/8by8/sketchplugins) Plugins for Sketch. - [abynim/BaseAlign](https://github.com/abynim/basealign) A Sketch Plugin to align Text Layers by their baselines - [abynim/SketchSquares](https://github.com/abynim/sketchsquares) Replace layers in Sketch with photos from Instagram. - [abynim/sketchy-pies](https://github.com/abynim/sketchy-pies) A Sketch plugin to magically convert regular circle layers into pie charts! - [abynim/userflows](https://github.com/abynim/userflows) Generate user walkthroughs from Artboards in Sketch. - [abynim/Xport](https://github.com/abynim/xport) A Sketch Plugin to export image assets directly to Xcode - [acollurafici/Sketch-Nearest-8](https://github.com/acollurafici/sketch-nearest-8) Sketch Plugin to round shape size to the nearest multiple of 8 - [adamhowell/random-opacity-sketch-plugin](https://github.com/adamhowell/random-opacity-sketch-plugin) Randomly change the opacity of selected objects in Sketch. - [ajaaibu/ThaanaText](https://github.com/ajaaibu/thaanatext) Sketch Plugin to generate thaana strings, paragraphs, articles. - [alessndro/sketch-plugins](https://github.com/alessndro/sketch-plugins) An incredible collection of plugins, including some great ones for working with baselines. - [PEZ/Sketch-Plugin-Testing-Repo](https://github.com/PEZ/Sketch-Plugin-Testing-Repo) testing only - [PEZ/SketchDistributor](https://github.com/pez/sketchdistributor) Distribute selection objects vertically or horizontally with a given spacing between them. - [utom/sketch-measure](https://github.com/utom/sketch-measure) A measure tool for Sketch.app (think Specctr for Sketch) ''' self.pd = PluginDirectory(freezer_prefix='test-') self.pd.fetch_directory(raw_directory_text=self.raw) self.pd._repo_search_limit = 5
def test_fetch_shortcuts_from_forked_repo(self): pd = PluginDirectory('test-') pd.fetch_directory( raw_directory_text= '''- [PEZ/Sketch-Plugin-Testing-Repo](https://github.com/PEZ/Sketch-Plugin-Testing-Repo) testing only''' ) forked_repo_name = '' forked_repo_found = False for repo in pd._search_plugin_bundle(): if repo.name == forked_repo_name: forked_repo_found = True self.assertTrue(forked_repo_found)
def fetch_shortcuts(): total_shortcuts = 0 total_repos = 0 pd = PluginDirectory() pd.fetch_directory() for plugin in pd.fetch_shortcuts(): total_repos = total_repos + 1 shortcuts = len(plugin.shortcuts) total_shortcuts = total_shortcuts + shortcuts print 'Fetched %d shortcuts for %s' % (shortcuts, plugin.name) print 'Total: %d shortcuts in %d repositories' % (total_shortcuts, total_repos)