Class: WayOfWorking::Audit::Github::Auditor
- Inherits:
-
Object
- Object
- WayOfWorking::Audit::Github::Auditor
- Defined in:
- lib/way_of_working/audit/github/auditor.rb
Overview
This auditor runs all the rules against any given GitHub repository
Instance Method Summary collapse
- #audit(repository) ⇒ Object
-
#initialize(access_token, organisation_name) ⇒ Auditor
constructor
A new instance of Auditor.
- #repositories ⇒ Object
Constructor Details
#initialize(access_token, organisation_name) ⇒ Auditor
Returns a new instance of Auditor.
9 10 11 12 |
# File 'lib/way_of_working/audit/github/auditor.rb', line 9 def initialize(access_token, organisation_name) @access_token = access_token @organisation_name = organisation_name end |
Instance Method Details
#audit(repository) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/way_of_working/audit/github/auditor.rb', line 14 def audit(repository) # Get all the rules once, rather than repeatedly in individual rules rulesets = @client.get("repos/#{repository.full_name}/rulesets").map do |rule| @client.get("repos/#{repository.full_name}/rulesets/#{rule[:id]}") end Array(Rules::Registry.rules).each do |rule_name, klass| rule = klass.new(client, rule_name, repository, rulesets) yield rule end end |
#repositories ⇒ Object
27 28 29 |
# File 'lib/way_of_working/audit/github/auditor.rb', line 27 def repositories @repositories ||= client.org_repos(@organisation_name) end |