Module: SiteChecker

Defined in:
lib/site_checker.rb,
lib/site_checker/dsl.rb,
lib/site_checker/link.rb,
lib/site_checker/cli/cli.rb,
lib/site_checker/version.rb,
lib/site_checker/parse/page.rb,
lib/site_checker/link_collector.rb,
lib/site_checker/io/content_from_web.rb,
lib/site_checker/io/content_from_file_system.rb

Defined Under Namespace

Modules: DSL, IO, Parse Classes: Cli, Link, LinkCollector

Constant Summary collapse

VERSION =
'0.4.0'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.dsl_enabledObject

Returns the value of attribute dsl_enabled.



18
19
20
# File 'lib/site_checker.rb', line 18

def dsl_enabled
  @dsl_enabled
end

.ignore_listObject

Returns the value of attribute ignore_list.



15
16
17
# File 'lib/site_checker.rb', line 15

def ignore_list
  @ignore_list
end

Returns the value of attribute link_collector.



19
20
21
# File 'lib/site_checker.rb', line 19

def link_collector
  @link_collector
end

.max_recursion_depthObject

Returns the value of attribute max_recursion_depth.



17
18
19
# File 'lib/site_checker.rb', line 17

def max_recursion_depth
  @max_recursion_depth
end

.visit_referencesObject

Returns the value of attribute visit_references.



16
17
18
# File 'lib/site_checker.rb', line 16

def visit_references
  @visit_references
end

Class Method Details

.check(url, root = nil) ⇒ Object

Recursively visits the provided url looking for reference problems.

Parameters:

  • url (String)

    where the processing starts

  • root (String) (defaults to: nil)

    (optional) the root URL of the site. If not provided then the method will use the url to figure it out.



51
52
53
54
# File 'lib/site_checker.rb', line 51

def check(url, root=nil)
  create_instance
  @link_collector.check(url, root)
end

.configure {|_self| ... } ⇒ Object

The following configuration options, which can be used together, are available:

  • ignoring certain links:

    SiteChecker.configure do |config|
      config.ignore_list = ["/", "/atom.xml"]
    end
    
  • visit the external references as well:

    SiteChecker.configure do |config|
      config.visit_references = true
    end
    
  • set the depth of the recursion:

    SiteChecker.configure do |config|
      config.max_recursion_depth = 3
    end
    

Yields:

  • (_self)

Yield Parameters:

  • _self (SiteChecker)

    the object that the method was called on



41
42
43
# File 'lib/site_checker.rb', line 41

def configure
  yield self
end

.local_imagesArray

Returns the Array of the visited local images.

Returns:

  • (Array)

    list of the visited local images



79
80
81
# File 'lib/site_checker.rb', line 79

def local_images
  @link_collector.local_images
end

.local_pagesArray

Returns the Array of the visited local pages.

Returns:

  • (Array)

    list of the visited local pages



61
62
63
# File 'lib/site_checker.rb', line 61

def local_pages
  @link_collector.local_pages
end

.problemsHash

Returns the Hash (:parent_url => [Array of problematic links]) of the problems.

Returns:

  • (Hash)

    the result of the check



97
98
99
# File 'lib/site_checker.rb', line 97

def problems
  @link_collector.problems
end

.remote_imagesArray

Returns the Array of the visited remote (external) images.

Returns:

  • (Array)

    list of the visited remote images



88
89
90
# File 'lib/site_checker.rb', line 88

def remote_images
  @link_collector.remote_images
end

.remote_pagesArray

Returns the Array of the visited remote (external) pages.

Returns:

  • (Array)

    list of the visited remote pages



70
71
72
# File 'lib/site_checker.rb', line 70

def remote_pages
  @link_collector.remote_pages
end