From 0bd981fcf0d3900cbb14abe5570774a5c923c8e1 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 6 Aug 2021 12:28:03 -0700 Subject: [PATCH 1/9] Remove unused travis config. --- .travis.yml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 83a126b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: ruby -script: "bundle exec rspec spec" -env: - - CI=true -rvm: - - 2.4 - - 2.5 - - 2.6 - - 2.7 - - jruby -cache: bundler -sudo: false -matrix: - allow_failures: - - rvm: jruby -dist: trusty From 18cd6e9746f7aa5695bd9f697853a1e07adf7e64 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Fri, 6 Aug 2021 12:28:26 -0700 Subject: [PATCH 2/9] Don't use Nokogumbo directly, as it is included in Nokgiri 1.12. Dependency remains 1.10 in Gemfile until Ruby 2.4 is deprecated. (Removes testing on Ruby 2.4). --- .github/workflows/ci.yml | 1 - Gemfile | 1 - README.md | 3 --- lib/rdf/microdata/rdfa_reader.rb | 9 ++++++--- lib/rdf/microdata/reader/nokogiri.rb | 3 +-- rdf-microdata.gemspec | 2 +- 6 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d49a23..d757e31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,6 @@ jobs: fail-fast: false matrix: ruby: - - 2.4 - 2.5 - 2.6 - 2.7 diff --git a/Gemfile b/Gemfile index e33063c..487884c 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,6 @@ gemspec gem "rdf", git: "https://github.com/ruby-rdf/rdf", branch: "develop" gem "rdf-rdfa", git: "https://github.com/ruby-rdf/rdf-rdfa", branch: "develop" gem "rdf-xsd", git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop" -gem "nokogumbo", '~> 2.0' group :development do gem "json-ld", git: "https://github.com/ruby-rdf/json-ld", branch: "develop" diff --git a/README.md b/README.md index ea16205..1f502c5 100755 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ RDF::Microdata parses [Microdata][] into statements or triples using the rules d * Microdata parser. * Uses Nokogiri for parsing HTML -* If available, uses [Nokogumbo][] gem for are pure-HTML5 parser with better error detection. Install with 'gem install rdf-microdata' @@ -52,7 +51,6 @@ If the `RDFa` parser is available, {RDF::Microdata::Format} will not assert cont * [RDF::XSD](https://rubygems.org/gems/rdf-xsd) (~> 3.1) * [HTMLEntities](https://rubygems.org/gems/htmlentities) ('~> 4.3') * [Nokogiri](https://rubygems.org/gems/nokogiri) (~> 1.10) -* Soft dependency on [Nokogumbo](https://github.com/rubys/nokogumbo) (~> 2.0) ## Documentation Full documentation available on [Rubydoc.info][Microdata doc] @@ -116,4 +114,3 @@ see or the accompanying {file:UNLICENSE} file. [Microdata]: https://dev.w3.org/html5/md/Overview.html "HTML Microdata" [Microdata RDF]: https://dvcs.w3.org/hg/htmldata/raw-file/default/microdata-rdf/index.html "Microdata to RDF" [Microdata doc]: https://rubydoc.info/github/ruby-rdf/rdf-microdata/frames -[Nokogumbo]: https://github.com/rubys/nokogumbo/#readme diff --git a/lib/rdf/microdata/rdfa_reader.rb b/lib/rdf/microdata/rdfa_reader.rb index 3157af9..343ea89 100644 --- a/lib/rdf/microdata/rdfa_reader.rb +++ b/lib/rdf/microdata/rdfa_reader.rb @@ -1,5 +1,4 @@ require 'rdf/rdfa' -require 'nokogumbo' module RDF::Microdata ## @@ -42,8 +41,12 @@ def initialize(input = $stdin, **options, &block) # Otherwise, default is utf-8 options[:encoding] ||= 'utf-8' options[:encoding] = options[:encoding].to_s if options[:encoding] - input = input.read if input.respond_to?(:read) - ::Nokogiri::HTML5(input.force_encoding(options[:encoding])) + begin + input = input.read if input.respond_to?(:read) + ::Nokogiri::HTML5(input.force_encoding(options[:encoding]), max_parse_errors: 1000) + rescue LoadError, NoMethodError + ::Nokogiri::HTML.parse(input, base_uri.to_s, options[:encoding]) + end end # For all members having @itemscope diff --git a/lib/rdf/microdata/reader/nokogiri.rb b/lib/rdf/microdata/reader/nokogiri.rb index 561330c..4b851cd 100644 --- a/lib/rdf/microdata/reader/nokogiri.rb +++ b/lib/rdf/microdata/reader/nokogiri.rb @@ -192,10 +192,9 @@ def initialize_html(input, **options) options[:encoding] = options[:encoding].to_s if options[:encoding] begin - require 'nokogumbo' unless defined?(::Nokogumbo) input = input.read if input.respond_to?(:read) ::Nokogiri::HTML5(input.force_encoding(options[:encoding]), max_parse_errors: 1000) - rescue LoadError + rescue LoadError, NoMethodError ::Nokogiri::HTML.parse(input, base_uri.to_s, options[:encoding]) end end diff --git a/rdf-microdata.gemspec b/rdf-microdata.gemspec index a0d124a..d4a6a7c 100755 --- a/rdf-microdata.gemspec +++ b/rdf-microdata.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'rdf-rdfa', '~> 3.1', '>= 3.1.3' gem.add_runtime_dependency 'rdf-xsd', '~> 3.1' gem.add_runtime_dependency 'htmlentities', '~> 4.3' - gem.add_runtime_dependency 'nokogiri' , '~> 1.10' # 1.11 Ruby 2.5 + gem.add_runtime_dependency 'nokogiri' , '~> 1.10' # 1.11 Ruby >= 2.5 gem.add_development_dependency 'equivalent-xml' , '~> 0.6' gem.add_development_dependency 'yard' , '~> 0.9' From 701542b93c0c1c00d812d33083e0dbfa67b00329 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 8 Aug 2021 16:22:35 -0700 Subject: [PATCH 3/9] Update CI for coveralls. --- .github/workflows/ci.yml | 8 ++++++-- Gemfile | 5 +++-- spec/spec_helper.rb | 10 +++++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d757e31..d6890c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,5 +35,9 @@ jobs: - name: Install dependencies run: bundle install --jobs 4 --retry 3 - name: Run tests - run: bundle exec rspec spec - + run: bundle exec rspec spec || $ALLOW_FAILURES + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v1.1.2 + if: "matrix.ruby == '3.0'" + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Gemfile b/Gemfile index 487884c..5f170de 100644 --- a/Gemfile +++ b/Gemfile @@ -22,6 +22,7 @@ group :debug do end group :test do - gem 'simplecov', '~> 0.16', platforms: :mri - gem 'coveralls', '~> 0.8', platforms: :mri + gem 'simplecov', '~> 0.21', platforms: :mri + gem 'simplecov-lcov', '~> 0.8', platforms: :mri + gem 'coveralls', platforms: :mri end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 62e89fa..3afcf15 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,10 +19,18 @@ begin require 'simplecov' + require 'simplecov-lcov' require 'coveralls' + + SimpleCov::Formatter::LcovFormatter.config do |config| + #Coveralls is coverage by default/lcov. Send info results + config.report_with_single_file = true + config.single_report_path = 'coverage/lcov.info' + end + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([ SimpleCov::Formatter::HTMLFormatter, - Coveralls::SimpleCov::Formatter + SimpleCov::Formatter::LcovFormatter ]) SimpleCov.start do add_filter "/spec/" From f239f5d02a0dabaa59e0398b7c8ce4901e48838f Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sun, 8 Aug 2021 16:25:43 -0700 Subject: [PATCH 4/9] Don't 'wear' coveralls. --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3afcf15..f6a5149 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,6 +17,7 @@ c.include(RDF::Spec::Matchers) end +require 'byebug'; byebug begin require 'simplecov' require 'simplecov-lcov' @@ -35,7 +36,6 @@ SimpleCov.start do add_filter "/spec/" end - Coveralls.wear! rescue LoadError => e STDERR.puts "Coverage Skipped: #{e.message}" end From 60eb619bd4f9197adf3895e06d855542c4e9f788 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 11 Aug 2021 12:32:04 -0700 Subject: [PATCH 5/9] Remove explicit dependency on coveralls gem. --- Gemfile | 1 - spec/spec_helper.rb | 4 +--- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 5f170de..209a743 100644 --- a/Gemfile +++ b/Gemfile @@ -24,5 +24,4 @@ end group :test do gem 'simplecov', '~> 0.21', platforms: :mri gem 'simplecov-lcov', '~> 0.8', platforms: :mri - gem 'coveralls', platforms: :mri end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f6a5149..b338b77 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,7 +4,6 @@ require "bundler/setup" require 'rspec' require 'rdf/isomorphic' -require 'rdf/microdata' require 'rdf/turtle' require 'rdf/spec' require 'rdf/spec/matchers' @@ -17,11 +16,9 @@ c.include(RDF::Spec::Matchers) end -require 'byebug'; byebug begin require 'simplecov' require 'simplecov-lcov' - require 'coveralls' SimpleCov::Formatter::LcovFormatter.config do |config| #Coveralls is coverage by default/lcov. Send info results @@ -39,6 +36,7 @@ rescue LoadError => e STDERR.puts "Coverage Skipped: #{e.message}" end +require 'rdf/microdata' # Heuristically detect the input stream def detect_format(stream) From 8514016538f34c272eff6f54058c6877136ee97a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 11 Oct 2021 12:29:42 -0400 Subject: [PATCH 6/9] Add back jruby to CI, but use ALLOW_FAILURES, also on ruby-head. --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6890c0..467d0dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ jobs: runs-on: ubuntu-latest env: CI: true + ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'jruby' }} strategy: fail-fast: false matrix: @@ -24,7 +25,7 @@ jobs: - 2.7 - 3.0 - ruby-head - #- jruby # No Nokogumbo on JRuby + - jruby steps: - name: Clone repository uses: actions/checkout@v2 @@ -33,7 +34,7 @@ jobs: with: ruby-version: ${{ matrix.ruby }} - name: Install dependencies - run: bundle install --jobs 4 --retry 3 + run: ruby --version; bundle install --jobs 4 --retry 3 - name: Run tests run: bundle exec rspec spec || $ALLOW_FAILURES - name: Coveralls GitHub Action From a34c5277241aee8e2d64e4eadd77734f0b3d668a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 26 Oct 2021 10:42:03 -0700 Subject: [PATCH 7/9] Update dependencies. --- Gemfile | 2 +- rdf-microdata.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index 209a743..f4d64cd 100644 --- a/Gemfile +++ b/Gemfile @@ -7,7 +7,7 @@ gem "rdf-rdfa", git: "https://github.com/ruby-rdf/rdf-rdfa", branch: "deve gem "rdf-xsd", git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop" group :development do - gem "json-ld", git: "https://github.com/ruby-rdf/json-ld", branch: "develop" + gem "json-ld", git: "https://github.com/ruby-rdf/json-ld", branch: "develop" gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop" gem 'rdf-aggregate-repo', git: "https://github.com/ruby-rdf/rdf-aggregate-repo", branch: "develop" gem 'rdf-isomorphic', git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop" diff --git a/rdf-microdata.gemspec b/rdf-microdata.gemspec index d4a6a7c..f184dbd 100755 --- a/rdf-microdata.gemspec +++ b/rdf-microdata.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |gem| gem.add_runtime_dependency 'rdf-rdfa', '~> 3.1', '>= 3.1.3' gem.add_runtime_dependency 'rdf-xsd', '~> 3.1' gem.add_runtime_dependency 'htmlentities', '~> 4.3' - gem.add_runtime_dependency 'nokogiri' , '~> 1.10' # 1.11 Ruby >= 2.5 + gem.add_runtime_dependency 'nokogiri' , '~> 1.12' gem.add_development_dependency 'equivalent-xml' , '~> 0.6' gem.add_development_dependency 'yard' , '~> 0.9' From e0add7ee4b0b08d41ad31a48a94f2befb3ccacc7 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 26 Oct 2021 11:38:51 -0700 Subject: [PATCH 8/9] Update CI. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 467d0dd..16487f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Install dependencies run: ruby --version; bundle install --jobs 4 --retry 3 - name: Run tests - run: bundle exec rspec spec || $ALLOW_FAILURES + run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES - name: Coveralls GitHub Action uses: coverallsapp/github-action@v1.1.2 if: "matrix.ruby == '3.0'" From ece9b78ee8e3c1fcf35a3ca162f7c477c7ac34c9 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Tue, 26 Oct 2021 12:53:40 -0700 Subject: [PATCH 9/9] Version 3.1.4. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ff365e0..0aec50e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.3 +3.1.4