From 5ea6f0ebd8162ff1df45e3b5a3f2fcb8931c3e54 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sat, 26 Aug 2023 15:27:27 -0700 Subject: [PATCH 1/2] Fix content-type expectations, as text/plain no longer is the same as N-Triples. --- spec/client_spec.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 7a2aead7..1d603b86 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -58,8 +58,8 @@ def response(header) it "handles successful response with plain header" do expect(subject).to receive(:request).and_yield response('text/plain') - expect(RDF::Reader).to receive(:for).with(content_type: 'text/plain').and_call_original - subject.query(query) + expect(RDF::Reader).to receive(:for).with(content_type: 'application/n-triples').and_call_original + subject.query(query, content_type: 'application/n-triples') end it "handles successful response with boolean header" do @@ -109,17 +109,17 @@ def response(header) end it "handles successful response with custom headers" do - expect(subject).to receive(:request).with(anything, {"Authorization" => "Basic XXX=="}). - and_yield response('text/plain') - subject.query(query, headers: {"Authorization" => "Basic XXX=="}) + expect(subject).to receive(:request).with(anything, {"Authorization" => "Basic XXX==", "Content-Type" => "application/n-triples"}). + and_yield response('application/n-triples') + subject.query(query, headers: {"Authorization" => "Basic XXX==", "Content-Type" => "application/n-triples"}) end it "handles successful response with initial custom headers" do options = {headers: {"Authorization" => "Basic XXX=="}, method: :get} client = SPARQL::Client.new('http://data.linkedmdb.org/sparql', **options) - client.instance_variable_set :@http, double(request: response('text/plain')) + client.instance_variable_set :@http, double(request: response('application/n-triples')) expect(Net::HTTP::Get).to receive(:new).with(anything, hash_including(options[:headers])) - client.query(query) + client.query(query, content_type: 'application/n-triples') end it "enables overriding the http method" do @@ -194,7 +194,7 @@ def response(header) to_return(body: '', status: 200, headers: { 'Content-Type' => 'application/n-triples'}) subject.query(construct_query) expect(WebMock).to have_requested(:post, "http://data.linkedmdb.org/sparql"). - with(headers: {'Accept'=>'application/n-triples, text/plain, */*;q=0.1'}) + with(headers: {'Accept'=>'application/n-triples, */*;q=0.1'}) end it "uses application/n-triples for DESCRIBE" do @@ -202,7 +202,7 @@ def response(header) to_return(body: '', status: 200, headers: { 'Content-Type' => 'application/n-triples'}) subject.query(describe_query) expect(WebMock).to have_requested(:post, "http://data.linkedmdb.org/sparql"). - with(headers: {'Accept'=>'application/n-triples, text/plain, */*;q=0.1'}) + with(headers: {'Accept'=>'application/n-triples, */*;q=0.1'}) end it "uses application/sparql-results+json for SELECT" do From 58bc635c9bd6642e2ef010e8664a795abe7a052a Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Sat, 26 Aug 2023 15:28:08 -0700 Subject: [PATCH 2/2] Updates for version 3.3.0 with minimum Ruby version 3.0. --- .github/workflows/ci.yml | 4 ++-- Gemfile | 4 ++-- Gemfile-pure | 1 - README.md | 8 ++++---- VERSION | 2 +- sparql-client.gemspec | 10 +++++----- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 796b550b..f499c8e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.6, 2.7, '3.0', 3.1, 3.2, ruby-head, jruby] + ruby: ['3.0', 3.1, 3.2, ruby-head, jruby] gemfile: - Gemfile - Gemfile-pure @@ -37,6 +37,6 @@ jobs: run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES - name: Coveralls GitHub Action uses: coverallsapp/github-action@v2 - if: ${{ matrix.ruby == '3.0' && matrix.gemfile == 'Gemfile' }} + if: ${{ matrix.ruby == '3.2' && matrix.gemfile == 'Gemfile' }} with: github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Gemfile b/Gemfile index 1e0930d8..bb479bd4 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ gemspec gem 'rdf', git: "https://github.com/ruby-rdf/rdf", branch: "develop" gem 'rdf-aggregate-repo', git: "https://github.com/ruby-rdf/rdf-aggregate-repo", branch: "develop" gem 'sparql', git: "https://github.com/ruby-rdf/sparql", branch: "develop" -gem "nokogiri", '~> 1.13', '>= 1.13.4' +gem "nokogiri", '~> 1.15', '>= 1.15.4' group :development, :test do gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop" @@ -15,7 +15,7 @@ group :development, :test do gem "rdf-xsd", git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop" gem 'sxp', git: "https://github.com/dryruby/sxp.rb", branch: "develop" gem "redcarpet", platform: :ruby - gem 'simplecov', '~> 0.21', platforms: :mri + gem 'simplecov', '~> 0.22', platforms: :mri gem 'simplecov-lcov', '~> 0.8', platforms: :mri end diff --git a/Gemfile-pure b/Gemfile-pure index 4c744c55..157790c5 100644 --- a/Gemfile-pure +++ b/Gemfile-pure @@ -5,7 +5,6 @@ gemspec gem 'rdf', git: "https://github.com/ruby-rdf/rdf", branch: "develop" gem 'rdf-aggregate-repo', git: "https://github.com/ruby-rdf/rdf-aggregate-repo", branch: "develop" gem 'sparql', git: "https://github.com/ruby-rdf/sparql", branch: "develop" -#gem "nokogiri", '~> 1.8' group :development, :test do gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop" diff --git a/README.md b/README.md index 3cd39b7a..e2ac2978 100644 --- a/README.md +++ b/README.md @@ -124,11 +124,11 @@ sparql.delete_data(data) ## 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) * [Net::HTTP::Persistent](https://rubygems.org/gems/net-http-persistent) (~> 4.0, >= 4.0.1) -* Soft dependency on [SPARQL](https://rubygems.org/gems/sparql) (~> 3.2) -* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (>= 1.12) +* Soft dependency on [SPARQL](https://rubygems.org/gems/sparql) (~> 3.3) +* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (>= 1.15) ## Installation diff --git a/VERSION b/VERSION index be94e6f5..15a27998 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.2.2 +3.3.0 diff --git a/sparql-client.gemspec b/sparql-client.gemspec index 94e2031d..506c608c 100755 --- a/sparql-client.gemspec +++ b/sparql-client.gemspec @@ -29,15 +29,15 @@ Gem::Specification.new do |gem| gem.bindir = %q(bin) gem.require_paths = %w(lib) - gem.required_ruby_version = '>= 2.6' + gem.required_ruby_version = '>= 3.0' gem.requirements = [] - gem.add_runtime_dependency 'rdf', '~> 3.2', '>= 3.2.11' + gem.add_runtime_dependency 'rdf', '~> 3.3' gem.add_runtime_dependency 'net-http-persistent', '~> 4.0', '>= 4.0.2' - gem.add_development_dependency 'rdf-spec', '~> 3.2' - gem.add_development_dependency 'sparql', '~> 3.2' + gem.add_development_dependency 'rdf-spec', '~> 3.3' + gem.add_development_dependency 'sparql', '~> 3.3' gem.add_development_dependency 'rspec', '~> 3.12' gem.add_development_dependency 'rspec-its', '~> 1.3' - gem.add_development_dependency 'webmock', '~> 3.14' + gem.add_development_dependency 'webmock', '~> 3.19' gem.add_development_dependency 'yard' , '~> 0.9' gem.post_install_message = nil