Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package rubygem-swd for openSUSE:Factory checked in at 2022-10-13 15:44:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-swd (Old) and /work/SRC/openSUSE:Factory/.rubygem-swd.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-swd" Thu Oct 13 15:44:39 2022 rev:5 rq:1010065 version:2.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-swd/rubygem-swd.changes 2022-02-07 23:38:41.630196710 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-swd.new.2275/rubygem-swd.changes 2022-10-13 15:45:12.991097662 +0200 @@ -1,0 +2,6 @@ +Mon Oct 10 13:24:43 UTC 2022 - Stephan Kulow <co...@suse.com> + +updated to version 2.0.2 + no changelog found + +------------------------------------------------------------------- Old: ---- swd-1.3.0.gem New: ---- swd-2.0.2.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-swd.spec ++++++ --- /var/tmp/diff_new_pack.OZptOO/_old 2022-10-13 15:45:13.675098997 +0200 +++ /var/tmp/diff_new_pack.OZptOO/_new 2022-10-13 15:45:13.679099005 +0200 @@ -24,7 +24,7 @@ # Name: rubygem-swd -Version: 1.3.0 +Version: 2.0.2 Release: 0 %define mod_name swd %define mod_full_name %{mod_name}-%{version} @@ -48,7 +48,7 @@ %install %gem_install \ - --doc-files="LICENSE README.rdoc" \ + --doc-files="CHANGELOG.md LICENSE README.rdoc" \ -f %gem_packages ++++++ swd-1.3.0.gem -> swd-2.0.2.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.github/FUNDING.yml new/.github/FUNDING.yml --- old/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/.github/FUNDING.yml 2022-10-09 09:56:03.000000000 +0200 @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: nov diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.github/workflows/spec.yml new/.github/workflows/spec.yml --- old/.github/workflows/spec.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/.github/workflows/spec.yml 2022-10-09 09:56:03.000000000 +0200 @@ -0,0 +1,32 @@ +name: Spec + +on: + push: + branches: + - master + pull_request: + +permissions: + contents: read + +jobs: + spec: + strategy: + matrix: + os: ['ubuntu-20.04'] + ruby-version: ['2.6', '2.7', '3.0', '3.1'] + # ubuntu 22.04 only supports ssl 3 and thus only ruby 3.1 + include: + - os: 'ubuntu-22.04' + ruby-version: '3.1' + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + - name: Run Specs + run: bundle exec rake spec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 2021-10-01 05:05:03.000000000 +0200 +++ new/.travis.yml 2022-10-09 09:56:03.000000000 +0200 @@ -2,6 +2,7 @@ - gem install bundler rvm: - - 2.5.8 - - 2.6.6 - - 2.7.2 \ No newline at end of file + - 2.6.10 + - 2.7.6 + - 3.0.4 + - 3.1.2 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md --- old/CHANGELOG.md 1970-01-01 01:00:00.000000000 +0100 +++ new/CHANGELOG.md 2022-10-09 09:56:03.000000000 +0200 @@ -0,0 +1,9 @@ +## [2.0.0] - 2022-10-08 + +### Added + +- start recording CHANGELOG + +### Changed + +- Switch from httpclient to faraday https://github.com/nov/SWD/pull/4 \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/VERSION new/VERSION --- old/VERSION 2021-10-01 05:05:03.000000000 +0200 +++ new/VERSION 2022-10-09 09:56:03.000000000 +0200 @@ -1 +1 @@ -1.3.0 +2.0.2 \ No newline at end of file Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/swd/debugger/request_filter.rb new/lib/swd/debugger/request_filter.rb --- old/lib/swd/debugger/request_filter.rb 2021-10-01 05:05:03.000000000 +0200 +++ new/lib/swd/debugger/request_filter.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,20 +0,0 @@ -module SWD - module Debugger - class RequestFilter - # Callback called in HTTPClient (before sending a request) - # request:: HTTP::Message - def filter_request(request) - started = "======= [SWD] HTTP REQUEST STARTED =======" - SWD.logger.info [started, request.dump].join("\n") - end - - # Callback called in HTTPClient (after received a response) - # request:: HTTP::Message - # response:: HTTP::Message - def filter_response(request, response) - finished = "======= [SWD] HTTP REQUEST FINISHED =======" - SWD.logger.info ['-' * 50, response.dump, finished].join("\n") - end - end - end -end \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/swd/debugger.rb new/lib/swd/debugger.rb --- old/lib/swd/debugger.rb 2021-10-01 05:05:03.000000000 +0200 +++ new/lib/swd/debugger.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,3 +0,0 @@ -Dir[File.dirname(__FILE__) + '/debugger/*.rb'].each do |file| - require file -end \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/swd/resource.rb new/lib/swd/resource.rb --- old/lib/swd/resource.rb 2021-10-01 05:05:03.000000000 +0200 +++ new/lib/swd/resource.rb 2022-10-09 09:56:03.000000000 +0200 @@ -17,7 +17,7 @@ def discover!(cache_options = {}) SWD.cache.fetch(cache_key, cache_options) do handle_response do - SWD.http_client.get_content endpoint.to_s + SWD.http_client.get endpoint.to_s end end end @@ -34,33 +34,32 @@ private def handle_response - res = JSON.parse(yield).with_indifferent_access - if redirect = res[:SWD_service_redirect] + json = yield.body.with_indifferent_access + if redirect = json[:SWD_service_redirect] redirect_to redirect[:location], redirect[:expires] else - to_response_object(res) + to_response_object json end - rescue HTTPClient::BadResponseError => e - case e.res.try(:status) + rescue Faraday::Error => e + case e.response_status when nil - raise Exception.new(e.message) + raise Exception.new e when 400 - raise BadRequest.new('Bad Request', res) + raise BadRequest.new('Bad Request', e.response_body) when 401 - raise Unauthorized.new('Unauthorized', res) + raise Unauthorized.new('Unauthorized', e.response_body) when 403 - raise Forbidden.new('Forbidden', res) + raise Forbidden.new('Forbidden', e.response_body) when 404 - raise NotFound.new('Not Found', res) + raise NotFound.new('Not Found', e.response_body) else - raise HttpError.new(e.res.status, e.res.reason, res) + raise HttpError.new(e.response_status, e.response_body, e.response_body) end - rescue JSON::ParserError, OpenSSL::SSL::SSLError, SocketError, Errno::ECONNREFUSED, Errno::EHOSTUNREACH => e - raise Exception.new(e.message) end - def to_response_object(hash) - Response.new hash + # NOTE: overwritten in openid_connect gem. + def to_response_object(json) + Response.new json end def redirect_to(location, expires) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/swd.rb new/lib/swd.rb --- old/lib/swd.rb 2021-10-01 05:05:03.000000000 +0200 +++ new/lib/swd.rb 2022-10-09 09:56:03.000000000 +0200 @@ -3,7 +3,8 @@ require 'openssl' require 'active_support' require 'active_support/core_ext' -require 'httpclient' +require 'faraday' +require 'faraday/follow_redirects' require 'attr_required' require 'attr_optional' @@ -51,17 +52,14 @@ self.debugging = false def self.http_client - _http_client_ = HTTPClient.new( - :agent_name => "SWD (#{VERSION})" - ) - - # NOTE: httpclient gem seems stopped maintaining root certtificate set, use OS default. - _http_client_.ssl_config.clear_cert_store - _http_client_.ssl_config.cert_store.set_default_paths - - _http_client_.request_filter << Debugger::RequestFilter.new if debugging? - http_config.try(:call, _http_client_) - _http_client_ + Faraday.new(headers: {user_agent: "SWD #{VERSION}"}) do |faraday| + faraday.response :raise_error + faraday.response :json + faraday.response :follow_redirects + faraday.response :logger, SWD.logger if debugging? + faraday.adapter Faraday.default_adapter + http_config.try(:call, faraday) + end end def self.http_config(&block) @@http_config ||= block @@ -79,6 +77,5 @@ require 'swd/exception' require 'swd/resource' require 'swd/response' -require 'swd/debugger' SWD.cache = SWD::Cache.new diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2021-10-01 05:05:03.000000000 +0200 +++ new/metadata 2022-10-09 09:56:03.000000000 +0200 @@ -1,29 +1,43 @@ --- !ruby/object:Gem::Specification name: swd version: !ruby/object:Gem::Version - version: 1.3.0 + version: 2.0.2 platform: ruby authors: - nov matake -autorequire: +autorequire: bindir: bin cert_chain: [] -date: 2021-10-01 00:00:00.000000000 Z +date: 2022-10-09 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency - name: httpclient + name: faraday + requirement: !ruby/object:Gem::Requirement + requirements: + - - "~>" + - !ruby/object:Gem::Version + version: '2.0' + type: :runtime + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - "~>" + - !ruby/object:Gem::Version + version: '2.0' +- !ruby/object:Gem::Dependency + name: faraday-follow_redirects requirement: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '2.4' + version: '0' type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version - version: '2.4' + version: '0' - !ruby/object:Gem::Dependency name: activesupport requirement: !ruby/object:Gem::Requirement @@ -129,9 +143,12 @@ extensions: [] extra_rdoc_files: [] files: +- ".github/FUNDING.yml" +- ".github/workflows/spec.yml" - ".gitignore" - ".rspec" - ".travis.yml" +- CHANGELOG.md - Gemfile - LICENSE - README.rdoc @@ -139,8 +156,6 @@ - VERSION - lib/swd.rb - lib/swd/cache.rb -- lib/swd/debugger.rb -- lib/swd/debugger/request_filter.rb - lib/swd/exception.rb - lib/swd/resource.rb - lib/swd/response.rb @@ -151,7 +166,6 @@ - spec/mock_json/redirect_with_port.json - spec/mock_json/success.json - spec/spec_helper.rb -- spec/swd/debugger/request_filter_spec.rb - spec/swd/exception_spec.rb - spec/swd/resource_spec.rb - spec/swd_spec.rb @@ -159,7 +173,7 @@ homepage: https://github.com/nov/swd licenses: [] metadata: {} -post_install_message: +post_install_message: rdoc_options: [] require_paths: - lib @@ -174,8 +188,8 @@ - !ruby/object:Gem::Version version: '0' requirements: [] -rubygems_version: 3.1.4 -signing_key: +rubygems_version: 3.3.7 +signing_key: specification_version: 4 summary: SWD (Simple Web Discovery) Client Library test_files: @@ -186,7 +200,6 @@ - spec/mock_json/redirect_with_port.json - spec/mock_json/success.json - spec/spec_helper.rb -- spec/swd/debugger/request_filter_spec.rb - spec/swd/exception_spec.rb - spec/swd/resource_spec.rb - spec/swd_spec.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/helpers/webmock_helper.rb new/spec/helpers/webmock_helper.rb --- old/spec/helpers/webmock_helper.rb 2021-10-01 05:05:03.000000000 +0200 +++ new/spec/helpers/webmock_helper.rb 2022-10-09 09:56:03.000000000 +0200 @@ -24,6 +24,9 @@ def response_for(response_file, options = {}) response = {} + response[:headers] = { + 'Content-Type': 'application/json' + } response[:body] = File.new(File.join(File.dirname(__FILE__), '../mock_json', "#{response_file}.json")) if options[:status] response[:status] = options[:status] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/swd/debugger/request_filter_spec.rb new/spec/swd/debugger/request_filter_spec.rb --- old/spec/swd/debugger/request_filter_spec.rb 2021-10-01 05:05:03.000000000 +0200 +++ new/spec/swd/debugger/request_filter_spec.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,29 +0,0 @@ -require 'spec_helper' - -describe SWD::Debugger::RequestFilter do - let(:resource_endpoint) { 'https://example.com/resources' } - let(:request) { HTTP::Message.new_request(:get, URI.parse(resource_endpoint)) } - let(:response) { HTTP::Message.new_response({:hello => 'world'}.to_json) } - let(:request_filter) { SWD::Debugger::RequestFilter.new } - - describe '#filter_request' do - it 'should log request' do - expect(SWD.logger).to receive(:info).with( - "======= [SWD] HTTP REQUEST STARTED =======\n" + - request.dump - ) - request_filter.filter_request(request) - end - end - - describe '#filter_response' do - it 'should log response' do - expect(SWD.logger).to receive(:info).with( - "--------------------------------------------------\n" + - response.dump + - "\n======= [SWD] HTTP REQUEST FINISHED =======" - ) - request_filter.filter_response(request, response) - end - end -end \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/swd/exception_spec.rb new/spec/swd/exception_spec.rb --- old/spec/swd/exception_spec.rb 2021-10-01 05:05:03.000000000 +0200 +++ new/spec/swd/exception_spec.rb 2022-10-09 09:56:03.000000000 +0200 @@ -2,12 +2,12 @@ describe SWD::HttpError do subject do - SWD::HttpError.new 400, 'Bad Request', HTTP::Message.new_response('') + SWD::HttpError.new 400, 'Bad Request', 'Message' end its(:status) { should == 400 } its(:message) { should == 'Bad Request' } - its(:response) { should be_a HTTP::Message } + its(:response) { should == 'Message' } end describe SWD::BadRequest do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/swd/resource_spec.rb new/spec/swd/resource_spec.rb --- old/spec/swd/resource_spec.rb 2021-10-01 05:05:03.000000000 +0200 +++ new/spec/swd/resource_spec.rb 2022-10-09 09:56:03.000000000 +0200 @@ -97,31 +97,10 @@ end end - context 'when invalid SSL cert' do + context 'when Faraday::Error without response' do it do - expect(SWD.http_client).to receive(:get_content).and_raise(OpenSSL::SSL::SSLError) - expect { res = resource.discover! }.to raise_error SWD::Exception - end - end - - context 'when invalid JSON' do - it do - expect(SWD.http_client).to receive(:get_content).and_raise(JSON::ParserError) - expect { res = resource.discover! }.to raise_error SWD::Exception - end - end - - context 'when SocketError' do - it do - expect(SWD.http_client).to receive(:get_content).and_raise(SocketError) - expect { res = resource.discover! }.to raise_error SWD::Exception - end - end - - context 'when BadResponseError without response' do - it do - expect(SWD.http_client).to receive(:get_content).and_raise(HTTPClient::BadResponseError.new('')) - expect { res = resource.discover! }.to raise_error SWD::Exception + expect(SWD.http_client).to receive(:get).and_raise(Faraday::Error) + expect { res = resource.discover! }.to raise_error Faraday::Error end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/swd_spec.rb new/spec/swd_spec.rb --- old/spec/swd_spec.rb 2021-10-01 05:05:03.000000000 +0200 +++ new/spec/swd_spec.rb 2022-10-09 09:56:03.000000000 +0200 @@ -108,11 +108,11 @@ context 'with http_config' do before do SWD.http_config do |config| - config.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE + config.ssl.verify = false end end it 'should configure http_client' do - SWD.http_client.ssl_config.verify_mode.should == OpenSSL::SSL::VERIFY_NONE + SWD.http_client.ssl.verify.should be_falsy end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/swd.gemspec new/swd.gemspec --- old/swd.gemspec 2021-10-01 05:05:03.000000000 +0200 +++ new/swd.gemspec 2022-10-09 09:56:03.000000000 +0200 @@ -10,7 +10,8 @@ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ['lib'] - s.add_runtime_dependency 'httpclient', '>= 2.4' + s.add_runtime_dependency 'faraday', '~> 2.0' + s.add_runtime_dependency 'faraday-follow_redirects' s.add_runtime_dependency 'activesupport', '>= 3' s.add_runtime_dependency 'attr_required', '>= 0.0.5' s.add_development_dependency 'rake'