diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0589f05..b9ff1ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,16 +19,10 @@ jobs: strategy: fail-fast: false matrix: - ruby: - - 2.6 - - 2.7 - - "3.0" - - 3.1 - - ruby-head - - jruby + ruby: ['3.0', 3.1, 3.2, ruby-head, jruby] steps: - name: Clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -38,8 +32,8 @@ jobs: - name: Run tests 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'" + uses: coverallsapp/github-action@v2 + if: "matrix.ruby == '3.2'" with: github-token: ${{ secrets.GITHUB_TOKEN }} wintests: @@ -56,7 +50,7 @@ jobs: - 3.1 steps: - name: Clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -65,8 +59,3 @@ jobs: run: bundle install --jobs 4 --retry 3 - name: Run tests 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'" - with: - github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/generate-docs.yml b/.github/workflows/generate-docs.yml index b8d16ed..65aea93 100644 --- a/.github/workflows/generate-docs.yml +++ b/.github/workflows/generate-docs.yml @@ -10,7 +10,7 @@ jobs: name: Update gh-pages with docs steps: - name: Clone repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/Gemfile b/Gemfile index 1ea67a0..a6079c9 100644 --- a/Gemfile +++ b/Gemfile @@ -5,12 +5,13 @@ gem 'rdf', github: "ruby-rdf/rdf", branch: "develop" gem 'rdf-xsd', github: "ruby-rdf/rdf-xsd", branch: "develop" group :development do - gem 'linkeddata', github: "ruby-rdf/linkeddata", branch: "develop" + gem 'linkeddata' gem 'ebnf', github: "dryruby/ebnf", branch: "develop" gem 'json-ld', github: "ruby-rdf/json-ld", branch: "develop" gem 'rdf-aggregate-repo', github: "ruby-rdf/rdf-aggregate-repo", branch: "develop" gem 'rdf-isomorphic', github: "ruby-rdf/rdf-isomorphic", branch: "develop" gem "rdf-spec", github: "ruby-rdf/rdf-spec", branch: "develop" + gem 'rdf-trig', github: "ruby-rdf/rdf-trig", branch: "develop" gem 'rdf-turtle', github: "ruby-rdf/rdf-turtle", branch: "develop" gem 'rdf-vocab', github: "ruby-rdf/rdf-vocab", branch: "develop" gem 'sparql', github: "ruby-rdf/sparql", branch: "develop" @@ -23,6 +24,6 @@ group :debug do end group :development, :test do - gem 'simplecov', '~> 0.21', platforms: :mri + gem 'simplecov', '~> 0.22', platforms: :mri gem 'simplecov-lcov', '~> 0.8', platforms: :mri end diff --git a/README.md b/README.md index da8fcbe..2ca3cd0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [CSV][] reader for [RDF.rb][] and fully JSON serializer. -[![Gem Version](https://badge.fury.io/rb/rdf-tabular.png)](https://badge.fury.io/rb/rdf-tabular) +[![Gem Version](https://badge.fury.io/rb/rdf-tabular.svg)](https://badge.fury.io/rb/rdf-tabular) [![Build Status](https://github.com/ruby-rdf/rdf-tabular/workflows/CI/badge.svg?branch=develop)](https://github.com/ruby-rdf/rdf-tabular/actions?query=workflow%3ACI) [![Coverage Status](https://coveralls.io/repos/ruby-rdf/rdf-tabular/badge.svg?branch=develop)](https://coveralls.io/github/ruby-rdf/rdf-tabular?branch=develop) [![Gitter chat](https://badges.gitter.im/ruby-rdf/rdf.png)](https://gitter.im/ruby-rdf/rdf) @@ -253,8 +253,8 @@ Full documentation available on [RubyDoc](https://rubydoc.info/gems/rdf-tabular/ * {RDF::Tabular::Reader} ## Dependencies -* [Ruby](https://ruby-lang.org/) (>= 2.6) -* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.2) +* [Ruby](https://ruby-lang.org/) (>= 3.0) +* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.3) * [JSON](https://rubygems.org/gems/json) (>= 2.6) ## Installation diff --git a/VERSION b/VERSION index e4604e3..15a2799 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.1 +3.3.0 diff --git a/lib/rdf/tabular/metadata.rb b/lib/rdf/tabular/metadata.rb index 37d86b2..26cbcf5 100644 --- a/lib/rdf/tabular/metadata.rb +++ b/lib/rdf/tabular/metadata.rb @@ -2,7 +2,7 @@ require 'json' require 'json/ld' -require 'bcp47' +require 'bcp47_spec' require 'addressable/template' require 'rdf/xsd' require 'yaml' # used by BCP47, which should have required it. @@ -146,6 +146,8 @@ def self.open(path, **options) RDF::Util::File.open_file(path, **options) do |file| self.new(file, **options.merge(base: path, filenames: path)) end + rescue Errno::ENOENT => e + raise IOError, e.message end # Return the well-known configuration for a file, and remember using a weak-reference cache to avoid uncessary retreivles. @@ -366,7 +368,7 @@ def initialize(input, **options) @options[:base] = @context ? @context.base : RDF::URI(opt_base) - if @context && @context.default_language && !BCP47::Language.identify(@context.default_language.to_s) + if @context && @context.default_language && !BCP47.valid?(@context.default_language.to_s) log_warn "Context has invalid @language (#{@context.default_language.inspect}): expected valid BCP47 language tag" @context.default_language = nil end @@ -437,7 +439,7 @@ def initialize(input, **options) when :aboutUrl, :default, :propertyUrl, :valueUrl "string" unless value.is_a?(String) when :lang - "valid BCP47 language tag" unless BCP47::Language.identify(value.to_s) + "valid BCP47 language tag" unless BCP47.valid?(value.to_s) when :null # To be valid, it must be a string or array "string or array of strings" unless !value.is_a?(Hash) && Array(value).all? {|v| v.is_a?(String)} @@ -837,7 +839,7 @@ def valid_natural_language_property?(value) "a valid natural language property" unless value.all? {|v| v.is_a?(String)} when Hash "a valid natural language property" if - value.keys.any? {|k| k.to_s != "und" && !BCP47::Language.identify(k)} || + value.keys.any? {|k| k.to_s != "und" && !BCP47.valid?(k)} || value.values.any? {|v| valid_natural_language_property?(v).is_a?(String)} else "a valid natural language property" @@ -1170,7 +1172,7 @@ def normalize_jsonld(property, value) log_error "Value object may not contain keys other than @value, @type, or @language: #{value.to_json}" elsif (value.keys.sort & %w(@language @type)) == %w(@language @type) log_error "Value object may not contain both @type and @language: #{value.to_json}" - elsif value['@language'] && !BCP47::Language.identify(value['@language'].to_s) + elsif value['@language'] && !BCP47.valid?(value['@language'].to_s) log_error "Value object with @language must use valid language: #{value.to_json}" elsif value['@type'] && (value['@type'].start_with?('_:') || !context.expand_iri(value['@type'], vocab: true).absolute?) log_error "Value object with @type must defined type: #{value.to_json}" @@ -1230,7 +1232,7 @@ def set_nl(value) when String then value when Array then value.select {|v| v.is_a?(String)} when Hash - value.delete_if {|k, v| !BCP47::Language.identify(k)} + value.delete_if {|k, v| !BCP47.valid?(k)} value.each do |k, v| value[k] = Array(v).select {|vv| vv.is_a?(String)} end diff --git a/rdf-tabular.gemspec b/rdf-tabular.gemspec index 4f6d0d4..480b16f 100755 --- a/rdf-tabular.gemspec +++ b/rdf-tabular.gemspec @@ -27,22 +27,22 @@ Gem::Specification.new do |gem| gem.extensions = %w() gem.test_files = Dir.glob('spec/*.rb') + Dir.glob('spec/data/**') - gem.required_ruby_version = '>= 2.6' + gem.required_ruby_version = '>= 3.0' gem.requirements = [] - gem.add_runtime_dependency 'bcp47', '~> 0.3', '>= 0.3.3' - gem.add_runtime_dependency 'rdf', '~> 3.2', '>= 3.2.7' - gem.add_runtime_dependency 'rdf-vocab', '~> 3.2' - gem.add_runtime_dependency 'rdf-xsd', '~> 3.2' - gem.add_runtime_dependency 'json-ld', '~> 3.2' + gem.add_runtime_dependency 'bcp47_spec', '~> 0.2' + gem.add_runtime_dependency 'rdf', '~> 3.3' + gem.add_runtime_dependency 'rdf-vocab', '~> 3.3' + gem.add_runtime_dependency 'rdf-xsd', '~> 3.3' + gem.add_runtime_dependency 'json-ld', '~> 3.3' gem.add_runtime_dependency 'addressable', '~> 2.8' - gem.add_development_dependency 'nokogiri', '~> 1.13', '>= 1.13.4' - gem.add_development_dependency 'rspec', '~> 3.10' + gem.add_development_dependency 'nokogiri', '~> 1.15', '>= 1.13.4' + gem.add_development_dependency 'rspec', '~> 3.12' gem.add_development_dependency 'rspec-its', '~> 1.3' - gem.add_development_dependency 'rdf-isomorphic', '~> 3.2' - gem.add_development_dependency 'rdf-spec', '~> 3.2' - gem.add_development_dependency 'rdf-turtle', '~> 3.2' - gem.add_development_dependency 'sparql', '~> 3.2' - gem.add_development_dependency 'webmock', '~> 3.14' + gem.add_development_dependency 'rdf-isomorphic', '~> 3.3' + gem.add_development_dependency 'rdf-spec', '~> 3.3' + gem.add_development_dependency 'rdf-turtle', '~> 3.3' + gem.add_development_dependency 'sparql', '~> 3.3' + gem.add_development_dependency 'webmock', '~> 3.19' gem.add_development_dependency 'yard' , '~> 0.9' gem.post_install_message = nil diff --git a/spec/matchers.rb b/spec/matchers.rb index e8632c1..3e695c2 100644 --- a/spec/matchers.rb +++ b/spec/matchers.rb @@ -1,7 +1,7 @@ require 'rdf/isomorphic' require 'rspec/matchers' -Info = Struct.new(:id, :debug, :action, :result, :metadata) +Info = Struct.new(:id, :logger, :action, :result, :metadata) RSpec::Matchers.define :pass_query do |expected, info| match do |actual| @@ -10,7 +10,6 @@ elsif info.is_a?(Hash) Info.new(info[:id], info[:logger], info[:action], info.fetch(:result, RDF::Literal::TRUE), info[:metadata]) end - @info.debug = Array(@info.debug).join("\n") @expected = expected.respond_to?(:read) ? expected.read : expected diff --git a/spec/metadata_spec.rb b/spec/metadata_spec.rb index 1aef633..d63af19 100644 --- a/spec/metadata_spec.rb +++ b/spec/metadata_spec.rb @@ -110,7 +110,6 @@ subject.send("#{prop}=".to_sym, v) expect(subject).to be_valid # Causes re-validation expect(logger.to_s).not_to include "ERROR" - expect(logger.to_s).to include "WARN" end end it "errors" do diff --git a/spec/reader_spec.rb b/spec/reader_spec.rb index 5180623..44ce4a5 100644 --- a/spec/reader_spec.rb +++ b/spec/reader_spec.rb @@ -313,7 +313,7 @@ prov:endedAtTime ?end; prov:qualifiedUsage [ a prov:Usage ; - prov:entity ; + # prov:entity ; prov:hadRole csvw:csvEncodedTabularData ]; ] @@ -336,11 +336,11 @@ prov:endedAtTime ?end; prov:qualifiedUsage [ a prov:Usage ; - prov:entity , ; + # prov:entity , ; prov:hadRole csvw:csvEncodedTabularData ], [ a prov:Usage ; - prov:entity ; + # prov:entity ; prov:hadRole csvw:tabularMetadata ]; ]