lib/nanoc/cli/commands/validate-links.rb in nanoc-3.4.3 vs lib/nanoc/cli/commands/validate-links.rb in nanoc-3.5.0b1
- old
+ new
@@ -1,10 +1,11 @@
# encoding: utf-8
usage 'validate-links [options]'
aliases :validate_links, :vlink
summary 'validate links in site'
+be_hidden
description <<-EOS
Validates the site’s links. By default, both internal and external links will be checked.
EOS
flag :i, :internal, 'validate internal links only'
@@ -13,20 +14,13 @@
module Nanoc::CLI::Commands
class ValidateLinks < ::Nanoc::CLI::CommandRunner
def run
- require_site
-
- dir = site.config[:output_dir]
- index_filenames = site.config[:index_filenames]
-
- validator = ::Nanoc::Extra::Validators::Links.new(
- dir,
- index_filenames,
- :internal => (options[:external] ? false : true),
- :external => (options[:internal] ? false : true))
- validator.run
+ checks = []
+ checks << 'ilinks' if options[:internal]
+ checks << 'elinks' if options[:external]
+ Nanoc::CLI.run [ 'check', checks ].flatten
end
end
end