Class: Nanoc::Checking::Checks::MixedContent Private

Inherits:
Nanoc::Checking::Check show all
Defined in:
lib/nanoc/checking/checks/mixed_content.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A check that verifies HTML files do not reference external resources with URLs that would trigger “mixed content” warnings.

Constant Summary collapse

PROTOCOL_PATTERN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

/^(\w+):\/\//

Instance Attribute Summary

Attributes inherited from Nanoc::Checking::Check

#issues

Instance Method Summary collapse

Methods inherited from Nanoc::Checking::Check

#add_issue, create, define, #excluded_patterns, #initialize, #output_filenames, #output_html_filenames

Constructor Details

This class inherits a constructor from Nanoc::Checking::Check

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/nanoc/checking/checks/mixed_content.rb', line 15

def run
  filenames = output_html_filenames
  resource_uris_with_filenames = ::Nanoc::Checking::LinkCollector.new(filenames).filenames_per_resource_uri

  resource_uris_with_filenames.each_pair do |uri, fns|
    next unless guaranteed_insecure?(uri)

    fns.each do |filename|
      add_issue(
        "mixed content include: #{uri}",
        subject: filename,
      )
    end
  end
end