{"action":"closed","issue":{"url":"https://api.github.com/repos/danger/danger/issues/223","repository_url":"https://api.github.com/repos/danger/danger","labels_url":"https://api.github.com/repos/danger/danger/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/danger/danger/issues/223/comments","events_url":"https://api.github.com/repos/danger/danger/issues/223/events","html_url":"https://github.com/danger/danger/issues/223","id":157544279,"number":223,"title":"Danger plugins use of methods instead of classes","user":{"login":"KrauseFx","id":869950,"avatar_url":"https://avatars.githubusercontent.com/u/869950?v=3","gravatar_id":"","url":"https://api.github.com/users/KrauseFx","html_url":"https://github.com/KrauseFx","followers_url":"https://api.github.com/users/KrauseFx/followers","following_url":"https://api.github.com/users/KrauseFx/following{/other_user}","gists_url":"https://api.github.com/users/KrauseFx/gists{/gist_id}","starred_url":"https://api.github.com/users/KrauseFx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KrauseFx/subscriptions","organizations_url":"https://api.github.com/users/KrauseFx/orgs","repos_url":"https://api.github.com/users/KrauseFx/repos","events_url":"https://api.github.com/users/KrauseFx/events{/privacy}","received_events_url":"https://api.github.com/users/KrauseFx/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-30T18:48:10Z","updated_at":"2016-05-30T20:26:19Z","closed_at":"2016-05-30T20:26:19Z","body":"While this looks great today, it might be something we run into later on. Looking at an [example plugin](https://github.com/danger/danger/blob/master/danger_plugins/protect_files.rb) the actual implementation is a method, not a class.\r\n\r\nThis might have a few disadvantages, e.g. we can't provide extra methods in action for metadata of the plugin, or internal helper methods.\r\n\r\nFor example in fastlane here are some of the methods available for an action: https://github.com/fastlane/fastlane/blob/master/fastlane/lib/fastlane/action.rb\r\n\r\nMy question is: How about in this example we use:\r\n\r\n```ruby\r\nmodule Danger\r\n  module Files < Plugin # note that this is a module\r\n    class ProtectFiles\r\n      def run(path: nil, message: nil, fail_build: true)\r\n        # code here\r\n      end\r\n    end\r\n  end\r\nend\r\n```\r\nCalling the action can be done the exact same way using\r\n```ruby\r\nfiles.protect_files(path: \"danger.gemspec\")\r\n```\r\nby mapping `files.protect_files` to `Danger::Files::ProtectFiles.run(...)`"}}
{"actor":{"display_login":"orta"}}