Class: GovukPublishingComponents::AuditController

Inherits:
ApplicationController show all
Defined in:
app/controllers/govuk_publishing_components/audit_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/govuk_publishing_components/audit_controller.rb', line 3

def show
  application_dirs = %w[
    collections
    collections-publisher
    content-data-admin
    content-publisher
    datagovuk_find
    email-alert-frontend
    feedback
    finder-frontend
    frontend
    government-frontend
    govspeak-preview
    release
    search-admin
    signon
    smart-answers
    static
    travel-advice-publisher
    whitehall
  ]

  application_dirs = [GovukPublishingComponents::ApplicationHelper.get_application_name_from_path(Rails.root)] unless ENV["MAIN_COMPONENT_GUIDE"]

  gem_path = Gem.loaded_specs["govuk_publishing_components"].full_gem_path
  gem_path = Dir.pwd if ENV["MAIN_COMPONENT_GUIDE"]
  host_dir = File.expand_path("..")

  @in_application = false
  @in_application = true unless ENV["MAIN_COMPONENT_GUIDE"]

  components = AuditComponents.new(gem_path)
  applications = analyse_applications(host_dir, application_dirs)
  compared_data = AuditComparer.new(components.data, applications)

  @applications = compared_data.applications_data || []
  @components = compared_data.gem_data || []
end