{"id":40808162,"url":"https://github.com/sn/plugg","last_synced_at":"2026-01-21T21:11:18.566Z","repository":{"id":36116652,"uuid":"40419025","full_name":"sn/plugg","owner":"sn","description":"A generic Ruby bolt-on plugin application framework","archived":false,"fork":false,"pushed_at":"2020-11-07T19:17:17.000Z","size":27,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-14T11:21:37.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/plugg","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-08T23:12:13.000Z","updated_at":"2025-05-21T08:48:00.000Z","dependencies_parsed_at":"2022-09-03T11:02:11.002Z","dependency_job_id":null,"html_url":"https://github.com/sn/plugg","commit_stats":null,"previous_names":["wixel/plugg"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sn/plugg","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sn%2Fplugg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sn%2Fplugg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sn%2Fplugg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sn%2Fplugg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sn","download_url":"https://codeload.github.com/sn/plugg/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sn%2Fplugg/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28643024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T18:04:35.752Z","status":"ssl_error","status_checked_at":"2026-01-21T18:03:55.054Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-21T21:11:17.904Z","updated_at":"2026-01-21T21:11:18.549Z","avatar_url":"https://github.com/sn.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Plugg: A dependency-free plugin framework for Ruby applications\n\n[![Gem Version](https://badge.fury.io/rb/plugg.svg)](https://rubygems.org/gems/plugg)\n\nSimple \u0026 efficient asynchronous plugin framework for Ruby applications.\n\nPlugg automatically loads all plugins from the paths you specify and creates instances of each inside an internal registry. When you send messages to Plugg, it relays those messages to each plugin that can respond to the message. Once all plugins have responded, it hands back an array containing the output from each plugin. \n\nEach plugin is called in it's own Thread so that all plugins are executed asynchronously.\n\nRequirements\n-----------------\n\nIt's recommend that you use Ruby 2.0.0 or higher.\n\nInstallation\n-----------------\n\n```\ngem install plugg\n```\n\nGetting Started\n-----------------\n\nIt's really simple to get Plugg running, after the installation, you set the source directory where the plugin classes should be loaded from. You can also specify more than one source directory by passing an array to the *Plugg.source(path)* method instead of a single string path. One caveat is that plugin class names should match the plugin file names exactly.\n\n```ruby\nrequire 'plugg'\n\nPlugg.source('./plugins') # or Plugg.source(['./plugins1', './plugins2'])\n\nresult = Plugg.send(:test_method, 'a parameter')\n\nresult = Plugg.send('/about', request)\n```\n\nIn the above example, you are sending the *:test_method* message to each loaded plugin and returning the output from each of these calls in an array to the `result` variable.\n\nThe *:test_method* message should correspond to a method name in each plugin class.\n\n```ruby\nclass DemoPlugin\n  def test_method(param)\n    puts \"Inside test_method with #{param}\"\n  end\n\n  def to_s\n    'Demo Plugin'\n  end\nend\n```\n\nYou can pass any number of arguments to the plugins:\n\n```ruby\nresult = Plugg.send(:test_method, arg1, arg2 arg3, etc)\n```\n\nDefault Parameters\n-----------------\n\nIf you wish to share default parameters or arguments with your plugins, you can do so by passing a hash as the second parameter to _Plugg.source()_.\n\n```ruby\nPlugg.source('./plugins', { param1: 'A value', param2: 'Another value' })\n```\n\nTo be able to inject the parameter hash from the registry into your plugin class, you need to implement a `setup(p)` method that will be called after instantiating the plugin class:\n\n```ruby\nclass DemoPlugin\n  def test_method(param)\n    puts \"Inside test_method with #{param}\"\n  end\n\n  def setup(p)\n    @params = p\n  end\n\n  def to_s\n    'Demo Plugin'\n  end\nend\n```\n\nControlling Timeouts\n-----------------\n\nBy default, plugins receive 30 seconds to perform their tasks. If you have long running jobs, you can set the timeout value as needed.\n\n```ruby\nPlugg.timeout(120) # Now 120 seconds instead of the default 30\n```\n\nOne thing to be aware of is that Plugg will only send back the return data once the last plugin has finished executing.\n\nReturn value\n-----------------\n\nYou can return anything you need from your plugin methods and can easily access the return data inspecting the result from *Plugg.send()* method for each plugin that was invoked:\n\n```ruby\n[\n  {\n    plugin: 'Demo Plugin',\n    return: nil,\n    timing: 0.013\n  }\n]\n```\n\nPlug is powerful in the sense that it allows you to separate any application logic from actor logic. Each plugin can act as a self contained application that responds to a set protocol. Your plugins can also return any data types.\n\nIf no plugin class is able to respond, the result of *Plugg.send()* will be empty.\n\nRunning the tests\n-----------------\n\nTo test the current stable version of Plugg, simply run:\n\n    rake test\n\nLicense\n-----------------\n\nPlease see [LICENSE](https://github.com/sn/plugg/blob/master/LICENSE) for licensing details.\n\nAuthor\n-----------------\n\n[github.com/sn](https://github.com/sn) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsn%2Fplugg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsn%2Fplugg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsn%2Fplugg/lists"}