{"action":"created","issue":{"url":"https://api.github.com/repos/variety/variety/issues/92","labels_url":"https://api.github.com/repos/variety/variety/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/variety/variety/issues/92/comments","events_url":"https://api.github.com/repos/variety/variety/issues/92/events","html_url":"https://github.com/variety/variety/issues/92","id":71971076,"number":92,"title":"Plugin infrastructure","user":{"login":"todvora","id":4102775,"avatar_url":"https://avatars.githubusercontent.com/u/4102775?v=3","gravatar_id":"","url":"https://api.github.com/users/todvora","html_url":"https://github.com/todvora","followers_url":"https://api.github.com/users/todvora/followers","following_url":"https://api.github.com/users/todvora/following{/other_user}","gists_url":"https://api.github.com/users/todvora/gists{/gist_id}","starred_url":"https://api.github.com/users/todvora/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/todvora/subscriptions","organizations_url":"https://api.github.com/users/todvora/orgs","repos_url":"https://api.github.com/users/todvora/repos","events_url":"https://api.github.com/users/todvora/events{/privacy}","received_events_url":"https://api.github.com/users/todvora/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-29T19:49:51Z","updated_at":"2015-04-30T22:31:22Z","closed_at":null,"body":"Hi all,\r\nRecently we received a PR for the latex support. Requests like this requires lots of coding from the author, long discussions under the PR, dealing with test suite of Variety and is complicated on all sides. Maybe we should come up with some form of a plugins infrastructure, that would allow contributors extending Variety functionality without modifying the main library itself. \r\n\r\nI have tried to integrate a plugins functionality and it could be done with only minor changes of Variety. You can see the first implementation [here](https://github.com/todvora/variety/tree/plugin-infrastructure). \r\n\r\nI also created one [sample plugin](https://github.com/todvora/variety-plugin-csv), that outputs results in the CSV format and has configurable delimiter. In the same way could be implemented also [the latex output](https://github.com/todvora/variety-plugin-latex).\r\n\r\nPlugins can be attached simply by adding a parameter like this:\r\n```\r\nmongo test --eval \"var collection = 'users'; var plugins='/path/to/plugin/index.js';\" variety.js\r\n```\r\nMore details can be found in the sample plugin readme. The dynamic loading of plugins is based on the ```load``` function provided by the Mongo shell.  \r\n\r\nThe sample plugin is compatible with the [NPM](https://www.npmjs.com/) specification, but does not depend on node/npm anyhow. It allows easier testing and providing metadata in a standard format. Around this format can be later build a variety-plugin directory (for example like [gitbook plugins](http://plugins.gitbook.com/)).\r\n\r\nThe main Variety library is still standalone, no dependencies or additional requirements. Without the plugin param behaves exactly the same way as before. \r\n\r\nWhat do you think? Does it make sense? \r\n\r\nThanks,\r\nTomas\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/variety/variety/issues/comments/97990046","html_url":"https://github.com/variety/variety/issues/92#issuecomment-97990046","issue_url":"https://api.github.com/repos/variety/variety/issues/92","id":97990046,"user":{"login":"joggino","id":1836025,"avatar_url":"https://avatars.githubusercontent.com/u/1836025?v=3","gravatar_id":"","url":"https://api.github.com/users/joggino","html_url":"https://github.com/joggino","followers_url":"https://api.github.com/users/joggino/followers","following_url":"https://api.github.com/users/joggino/following{/other_user}","gists_url":"https://api.github.com/users/joggino/gists{/gist_id}","starred_url":"https://api.github.com/users/joggino/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joggino/subscriptions","organizations_url":"https://api.github.com/users/joggino/orgs","repos_url":"https://api.github.com/users/joggino/repos","events_url":"https://api.github.com/users/joggino/events{/privacy}","received_events_url":"https://api.github.com/users/joggino/received_events","type":"User","site_admin":false},"created_at":"2015-04-30T22:31:22Z","updated_at":"2015-04-30T22:31:22Z","body":"I'm in favour, it makes the process a lot simpler to use and people can add what they need without bloating the initial library for everyone."}}