diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1aca237..d3ca86e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -33,6 +33,10 @@ test:2.7: extends: .tests image: 'ruby:2.7' +test:3.0: + extends: .tests + image: 'ruby:3.0' + test:jruby: extends: .tests image: 'jruby:9.2.12-jre' diff --git a/.travis.yml b/.travis.yml index ddb6bf8..90765af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ rvm: - 2.5 - 2.6 - 2.7 + - 3.0 - jruby-9.2.12.0 - ruby-head - jruby-head diff --git a/lib/validate_website/core.rb b/lib/validate_website/core.rb index 68874fb..d04dcef 100644 --- a/lib/validate_website/core.rb +++ b/lib/validate_website/core.rb @@ -118,7 +118,7 @@ def not_found_error(location) # @param [Hash] Validator options # def validate(doc, body, url, options) - validator = Validator.new(doc, body, options) + validator = Validator.new(doc, body, **options) if validator.valid? print color(:success, '.', options[:color]) # rspec style else diff --git a/lib/validate_website/crawl.rb b/lib/validate_website/crawl.rb index 82db508..0cff182 100644 --- a/lib/validate_website/crawl.rb +++ b/lib/validate_website/crawl.rb @@ -46,7 +46,7 @@ def extract_imgs_from_page(page) page.doc.search('//img[@src]').reduce(Set[]) do |result, elem| u = elem.attributes['src'].content - result << page.to_absolute(URI.parse(URI.encode(u))) + result << page.to_absolute(URI.parse(WEBrick::HTTPUtils.escape(u))) end end diff --git a/lib/validate_website/static_link.rb b/lib/validate_website/static_link.rb index b334b3a..5dfe259 100644 --- a/lib/validate_website/static_link.rb +++ b/lib/validate_website/static_link.rb @@ -8,7 +8,7 @@ # rubocop:disable Metrics/BlockLength StaticLink = Struct.new(:link, :site) do def link_uri - @link_uri = URI.parse(URI.encode(link)) + @link_uri = URI.parse(WEBrick::HTTPUtils.escape(link)) @link_uri = URI.join(site, @link_uri) if @link_uri.host.nil? @link_uri end diff --git a/validate-website.gemspec b/validate-website.gemspec index b7e72a2..4c03e04 100644 --- a/validate-website.gemspec +++ b/validate-website.gemspec @@ -18,6 +18,7 @@ Gem::Specification.new do |s| s.add_dependency 'spidr', '~> 0.6' s.add_dependency 'tidy_ffi', '~> 1.0' s.add_dependency 'w3c_validators', '~> 1.3' + s.add_dependency 'webrick', '~> 1' s.add_development_dependency 'asciidoctor', '~> 1.5' s.add_development_dependency 'minitest', '~> 5.0' s.add_development_dependency 'rake', '~> 12'