From 2cd7e6a78bdcd8bd7f003f5cf69c666fb33728a5 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:12:22 +0200 Subject: [PATCH 01/17] Bump bundler --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4f1490f..5311c49 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -249,4 +249,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.3.7 + 2.4.13 From 80fbac0b3f967b1dadbe52a443e619580345a615 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:12:34 +0200 Subject: [PATCH 02/17] Bump rails --- Gemfile.lock | 55 ++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5311c49..a60d667 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -19,20 +19,20 @@ PATH GEM remote: https://rubygems.org/ specs: - actionpack (7.0.3.1) - actionview (= 7.0.3.1) - activesupport (= 7.0.3.1) - rack (~> 2.0, >= 2.2.0) + actionpack (7.0.5) + actionview (= 7.0.5) + activesupport (= 7.0.5) + rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actionview (7.0.3.1) - activesupport (= 7.0.3.1) + actionview (7.0.5) + activesupport (= 7.0.5) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activesupport (7.0.3.1) + activesupport (7.0.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -43,13 +43,13 @@ GEM builder (3.2.4) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.1.10) + concurrent-ruby (1.2.2) crack (0.4.5) rexml crass (1.0.6) diff-lcs (1.5.0) docile (1.4.0) - erubi (1.10.0) + erubi (1.12.0) ethon (0.15.0) ffi (>= 1.15.0) fabrication (2.29.0) @@ -70,7 +70,7 @@ GEM httparty (0.20.0) mime-types (~> 3.0) multi_xml (>= 0.5.2) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) json (2.6.2) json-schema (3.0.0) @@ -78,20 +78,20 @@ GEM listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - loofah (2.18.0) + loofah (2.21.3) crass (~> 1.0.2) - nokogiri (>= 1.5.9) + nokogiri (>= 1.12.0) macaddr (1.7.2) systemu (~> 2.6.5) method_source (1.0.0) mime-types (3.4.1) mime-types-data (~> 3.2015) mime-types-data (3.2022.0105) - mini_portile2 (2.8.0) - minitest (5.16.2) + mini_portile2 (2.8.2) + minitest (5.18.0) multi_xml (0.6.0) - nokogiri (1.13.8) - mini_portile2 (~> 2.8.0) + nokogiri (1.15.2) + mini_portile2 (~> 2.8.2) racc (~> 1.4) nyan-cat-formatter (0.12.0) rspec (>= 2.99, >= 2.14.2, < 4) @@ -119,18 +119,19 @@ GEM byebug (~> 11.0) pry (~> 0.13.0) public_suffix (4.0.7) - racc (1.6.0) - rack (2.2.4) - rack-test (2.0.2) + racc (1.7.0) + rack (2.2.7) + rack-test (2.1.0) rack (>= 1.3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.3) - loofah (~> 2.3) - railties (7.0.3.1) - actionpack (= 7.0.3.1) - activesupport (= 7.0.3.1) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.0.5) + actionpack (= 7.0.5) + activesupport (= 7.0.5) method_source rake (>= 12.2) thor (~> 1.0) @@ -201,10 +202,10 @@ GEM systemu (2.6.5) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (1.2.1) + thor (1.2.2) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (2.0.5) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.2.0) uuid (2.3.9) @@ -217,7 +218,7 @@ GEM webrick (1.7.0) yard (0.9.28) webrick (~> 1.7.0) - zeitwerk (2.6.0) + zeitwerk (2.6.8) PLATFORMS ruby From 9a83345ab7e73338f5e905277c51a3b4583ce00d Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:13:17 +0200 Subject: [PATCH 03/17] Bump faraday --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a60d667..e5356af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -53,12 +53,12 @@ GEM ethon (0.15.0) ffi (>= 1.15.0) fabrication (2.29.0) - faraday (2.3.0) - faraday-net_http (~> 2.0) + faraday (2.7.6) + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-follow_redirects (0.3.0) faraday (>= 1, < 3) - faraday-net_http (2.0.3) + faraday-net_http (3.0.2) ffi (1.15.5) fuubar (2.5.1) rspec-core (~> 3.0) From 7b03c436d9615d231e5c10196b91643893a879b5 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:24:05 +0200 Subject: [PATCH 04/17] Bump fabrication --- Gemfile.lock | 2 +- spec/factories.rb | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e5356af..3bc0098 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,7 +52,7 @@ GEM erubi (1.12.0) ethon (0.15.0) ffi (>= 1.15.0) - fabrication (2.29.0) + fabrication (2.30.0) faraday (2.7.6) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) diff --git a/spec/factories.rb b/spec/factories.rb index bbba632..f3733fc 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -19,26 +19,26 @@ Fabricator(:user, class_name: Person) do end Fabricator(:post, class_name: Entity) do - on_init { init_with("Post") } + initialize_with { resolved_class.new("Post") } author { Fabricate(:person) } end Fabricator(:comment, class_name: Entity) do - on_init { init_with("Comment") } + initialize_with { resolved_class.new("Comment") } author { Fabricate(:person) } end Fabricator(:poll, class_name: Entity) do - on_init { init_with("Poll") } + initialize_with { resolved_class.new("Poll") } author { Fabricate(:person) } end Fabricator(:event, class_name: Entity) do - on_init { init_with("Event") } + initialize_with { resolved_class.new("Event") } author { Fabricate(:person) } end Fabricator(:conversation, class_name: Entity) do - on_init { init_with("Conversation") } + initialize_with { resolved_class.new("Conversation") } author { Fabricate(:person) } end From 35671e206c351915339e65334110eafdb0a2cb44 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:43:04 +0200 Subject: [PATCH 05/17] Bump rubocop and rubocop-rails --- .rubocop.yml | 4 +++ Gemfile | 4 +-- Gemfile.lock | 33 ++++++++++--------- Rakefile | 2 +- .../discovery/web_finger_spec.rb | 2 +- spec/spec_helper.rb | 2 +- spec/support/helper_methods.rb | 2 +- test/dummy/config/environments/production.rb | 2 +- 8 files changed, 28 insertions(+), 23 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3440ccd..e336e0c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -191,6 +191,10 @@ Rails/NegateInclude: Rails/RakeEnvironment: Enabled: false +# only available on rails >= 6.0 +Rails/IndexWith: + Enabled: false + Lint/ConstantDefinitionInBlock: Exclude: - "spec/**/*" diff --git a/Gemfile b/Gemfile index b9077eb..0fb7255 100644 --- a/Gemfile +++ b/Gemfile @@ -21,8 +21,8 @@ group :development do # code style gem "pronto", "0.11.0", require: false gem "pronto-rubocop", "0.11.2", require: false - gem "rubocop", "1.32.0", require: false - gem "rubocop-rails", "2.15.2", require: false + gem "rubocop", "1.52.0", require: false + gem "rubocop-rails", "2.19.1", require: false gem "rubocop-rake", "0.6.0", require: false # debugging diff --git a/Gemfile.lock b/Gemfile.lock index 3bc0098..f657283 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -72,7 +72,7 @@ GEM multi_xml (>= 0.5.2) i18n (1.14.1) concurrent-ruby (~> 1.0) - json (2.6.2) + json (2.6.3) json-schema (3.0.0) addressable (>= 2.8) listen (3.7.1) @@ -98,9 +98,10 @@ GEM octokit (4.25.1) faraday (>= 1, < 3) sawyer (~> 0.9) - parallel (1.22.1) - parser (3.1.2.0) + parallel (1.23.0) + parser (3.2.2.3) ast (~> 2.4.1) + racc pronto (0.11.0) gitlab (~> 4.4, >= 4.4.0) httparty (>= 0.13.7) @@ -141,7 +142,7 @@ GEM rb-fsevent (0.11.1) rb-inotify (0.10.1) ffi (~> 1.0) - regexp_parser (2.5.0) + regexp_parser (2.8.1) rexml (3.2.5) rspec (3.11.0) rspec-core (~> 3.11.0) @@ -167,25 +168,25 @@ GEM rspec-mocks (~> 3.10) rspec-support (~> 3.10) rspec-support (3.11.0) - rubocop (1.32.0) + rubocop (1.52.0) json (~> 2.3) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.2.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.19.1, < 2.0) + rubocop-ast (>= 1.28.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.19.1) - parser (>= 3.1.1.0) - rubocop-rails (2.15.2) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.29.0) + parser (>= 3.2.1.0) + rubocop-rails (2.19.1) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) + rubocop (>= 1.33.0, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - ruby-progressbar (1.11.0) + ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) rugged (1.0.1) sawyer (0.9.2) @@ -207,7 +208,7 @@ GEM ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.2.0) + unicode-display_width (2.4.2) uuid (2.3.9) macaddr (~> 1.0) valid (1.2.0) @@ -241,8 +242,8 @@ DEPENDENCIES rspec-collection_matchers (~> 1.2.0) rspec-json_expectations (~> 2.1) rspec-rails (~> 5.1.2) - rubocop (= 1.32.0) - rubocop-rails (= 2.15.2) + rubocop (= 1.52.0) + rubocop-rails (= 2.19.1) rubocop-rake (= 0.6.0) simplecov (= 0.21.2) simplecov-rcov (= 0.3.1) diff --git a/Rakefile b/Rakefile index 882b89f..ec95592 100644 --- a/Rakefile +++ b/Rakefile @@ -15,7 +15,7 @@ RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_files.include("lib/**/*.rb") end -if defined?(::Rails) +if defined?(Rails) APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__) load "rails/tasks/engine.rake" load "rails/tasks/statistics.rake" diff --git a/spec/lib/diaspora_federation/discovery/web_finger_spec.rb b/spec/lib/diaspora_federation/discovery/web_finger_spec.rb index 52dc4bd..36f7e46 100644 --- a/spec/lib/diaspora_federation/discovery/web_finger_spec.rb +++ b/spec/lib/diaspora_federation/discovery/web_finger_spec.rb @@ -344,7 +344,7 @@ module DiasporaFederation }, { "rel": "self", - "type": "application/ld+json; profile=\\\"https://www.w3.org/ns/activitystreams\\\"", + "type": "application/ld+json; profile=\\"https://www.w3.org/ns/activitystreams\\"", "href": "#{person.url}channel/#{person.nickname}" }, { diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index be04393..8efec0f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -50,7 +50,7 @@ RSpec.configure do |config| expect_config.syntax = :expect end - if defined?(::Rails) + if defined?(Rails) config.before(:each, type: :controller) do ActionController::Base.allow_forgery_protection = true end diff --git a/spec/support/helper_methods.rb b/spec/support/helper_methods.rb index ee413a2..89ec861 100644 --- a/spec/support/helper_methods.rb +++ b/spec/support/helper_methods.rb @@ -34,7 +34,7 @@ def change_time(time, options={}) new_min = options.fetch(:min, options[:hour] ? 0 : time.min) new_sec = options.fetch(:sec, options[:hour] || options[:min] ? 0 : time.sec) - ::Time.utc(time.year, time.month, time.day, new_hour, new_min, new_sec) + Time.utc(time.year, time.month, time.day, new_hour, new_min, new_sec) end # indent helper diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb index 602df3e..5d803d7 100644 --- a/test/dummy/config/environments/production.rb +++ b/test/dummy/config/environments/production.rb @@ -58,7 +58,7 @@ Rails.application.configure do config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. # require "syslog/logger" From 24df32286f0493fd8581e79a17d27f0a9eafb0d3 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:49:30 +0200 Subject: [PATCH 06/17] Bump pronto and pronto-rubocop --- Gemfile | 4 ++-- Gemfile.lock | 36 +++++++++++++++++------------------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/Gemfile b/Gemfile index 0fb7255..7c1a25b 100644 --- a/Gemfile +++ b/Gemfile @@ -19,8 +19,8 @@ end group :development do # code style - gem "pronto", "0.11.0", require: false - gem "pronto-rubocop", "0.11.2", require: false + gem "pronto", "0.11.1", require: false + gem "pronto-rubocop", "0.11.5", require: false gem "rubocop", "1.52.0", require: false gem "rubocop-rails", "2.19.1", require: false gem "rubocop-rake", "0.6.0", require: false diff --git a/Gemfile.lock b/Gemfile.lock index f657283..4732953 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,8 +37,8 @@ GEM i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.4) + public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) builder (3.2.4) byebug (11.1.3) @@ -67,8 +67,8 @@ GEM httparty (~> 0.20) terminal-table (>= 1.5.1) hashdiff (1.0.1) - httparty (0.20.0) - mime-types (~> 3.0) + httparty (0.21.0) + mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) i18n (1.14.1) concurrent-ruby (~> 1.0) @@ -84,9 +84,7 @@ GEM macaddr (1.7.2) systemu (~> 2.6.5) method_source (1.0.0) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2022.0105) + mini_mime (1.1.2) mini_portile2 (2.8.2) minitest (5.18.0) multi_xml (0.6.0) @@ -95,22 +93,22 @@ GEM racc (~> 1.4) nyan-cat-formatter (0.12.0) rspec (>= 2.99, >= 2.14.2, < 4) - octokit (4.25.1) + octokit (6.1.1) faraday (>= 1, < 3) sawyer (~> 0.9) parallel (1.23.0) parser (3.2.2.3) ast (~> 2.4.1) racc - pronto (0.11.0) - gitlab (~> 4.4, >= 4.4.0) - httparty (>= 0.13.7) - octokit (~> 4.7, >= 4.7.0) + pronto (0.11.1) + gitlab (>= 4.4.0, < 5.0) + httparty (>= 0.13.7, < 1.0) + octokit (>= 4.7.0, < 7.0) rainbow (>= 2.2, < 4.0) - rexml (~> 3.2) - rugged (>= 0.23.0, < 1.1.0) + rexml (>= 3.2.5, < 4.0) + rugged (>= 0.23.0, < 2.0) thor (>= 0.20.3, < 2.0) - pronto-rubocop (0.11.2) + pronto-rubocop (0.11.5) pronto (~> 0.11.0) rubocop (>= 0.63.1, < 2.0) pry (0.13.1) @@ -119,7 +117,7 @@ GEM pry-byebug (3.9.0) byebug (~> 11.0) pry (~> 0.13.0) - public_suffix (4.0.7) + public_suffix (5.0.1) racc (1.7.0) rack (2.2.7) rack-test (2.1.0) @@ -188,7 +186,7 @@ GEM rubocop (~> 1.0) ruby-progressbar (1.13.0) ruby2_keywords (0.0.5) - rugged (1.0.1) + rugged (1.6.3) sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) @@ -233,8 +231,8 @@ DEPENDENCIES json-schema (~> 3.0) listen nyan-cat-formatter - pronto (= 0.11.0) - pronto-rubocop (= 0.11.2) + pronto (= 0.11.1) + pronto-rubocop (= 0.11.5) pry pry-byebug rake From a4e661a9f2b3bdb5fadd3d3d5aa7146109e42b59 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:50:50 +0200 Subject: [PATCH 07/17] Bump pry and pry-byebug --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4732953..0a2c999 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -111,12 +111,12 @@ GEM pronto-rubocop (0.11.5) pronto (~> 0.11.0) rubocop (>= 0.63.1, < 2.0) - pry (0.13.1) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.9.0) + pry-byebug (3.10.1) byebug (~> 11.0) - pry (~> 0.13.0) + pry (>= 0.13, < 0.15) public_suffix (5.0.1) racc (1.7.0) rack (2.2.7) From 296c1935db8f39613a0ec1d27c28659784ea17e5 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:51:20 +0200 Subject: [PATCH 08/17] Bump yard --- Gemfile.lock | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0a2c999..ddaa991 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -214,9 +214,7 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.7.0) - yard (0.9.28) - webrick (~> 1.7.0) + yard (0.9.34) zeitwerk (2.6.8) PLATFORMS From 00da9e1f4ff82c693abc97305890db0e9e5254ee Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:51:35 +0200 Subject: [PATCH 09/17] Bump listen --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ddaa991..498d5fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,7 +75,7 @@ GEM json (2.6.3) json-schema (3.0.0) addressable (>= 2.8) - listen (3.7.1) + listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) loofah (2.21.3) @@ -137,7 +137,7 @@ GEM zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) - rb-fsevent (0.11.1) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) regexp_parser (2.8.1) From d4998ea4ffc89f3074efaab063d15513a9e3acb3 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:52:48 +0200 Subject: [PATCH 10/17] Bump simplecov --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 7c1a25b..67d0a69 100644 --- a/Gemfile +++ b/Gemfile @@ -42,7 +42,7 @@ group :test do gem "nyan-cat-formatter", require: false # test coverage - gem "simplecov", "0.21.2", require: false + gem "simplecov", "0.22.0", require: false gem "simplecov-rcov", "0.3.1", require: false # test helpers diff --git a/Gemfile.lock b/Gemfile.lock index 498d5fc..d0a5080 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -190,7 +190,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - simplecov (0.21.2) + simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) @@ -241,7 +241,7 @@ DEPENDENCIES rubocop (= 1.52.0) rubocop-rails (= 2.19.1) rubocop-rake (= 0.6.0) - simplecov (= 0.21.2) + simplecov (= 0.22.0) simplecov-rcov (= 0.3.1) webmock (~> 3.0) yard From 0306cab0dcd6805f9c497f5e6a4f6b3a452d16c1 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:56:14 +0200 Subject: [PATCH 11/17] Bump json-schema --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 67d0a69..ac4dcae 100644 --- a/Gemfile +++ b/Gemfile @@ -46,7 +46,7 @@ group :test do gem "simplecov-rcov", "0.3.1", require: false # test helpers - gem "json-schema", "~> 3.0" + gem "json-schema", "~> 4.0" gem "rspec-collection_matchers", "~> 1.2.0" gem "rspec-json_expectations", "~> 2.1" gem "webmock", "~> 3.0" diff --git a/Gemfile.lock b/Gemfile.lock index d0a5080..d6861f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -73,7 +73,7 @@ GEM i18n (1.14.1) concurrent-ruby (~> 1.0) json (2.6.3) - json-schema (3.0.0) + json-schema (4.0.0) addressable (>= 2.8) listen (3.8.0) rb-fsevent (~> 0.10, >= 0.10.3) @@ -226,7 +226,7 @@ DEPENDENCIES diaspora_federation-rails! diaspora_federation-test! fuubar (= 2.5.1) - json-schema (~> 3.0) + json-schema (~> 4.0) listen nyan-cat-formatter pronto (= 0.11.1) From 44d4f11262e8596b00551ccc0f08ace3a9a14928 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 16:56:49 +0200 Subject: [PATCH 12/17] Bump webmock --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index d6861f1..e73d3ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -210,7 +210,7 @@ GEM uuid (2.3.9) macaddr (~> 1.0) valid (1.2.0) - webmock (3.14.0) + webmock (3.18.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) From 5bcf8126468c5a18d1a5705d176690a9a15b2be7 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 17:08:32 +0200 Subject: [PATCH 13/17] Bump rspec --- Gemfile | 2 +- Gemfile.lock | 24 +++++++++---------- .../entities/relayable_spec.rb | 2 +- spec/lib/diaspora_federation/entity_spec.rb | 12 ++++++---- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Gemfile b/Gemfile index ac4dcae..2599680 100644 --- a/Gemfile +++ b/Gemfile @@ -56,6 +56,6 @@ group :development, :test do gem "rake" # unit tests - gem "rspec", "~> 3.11.0" + gem "rspec", "~> 3.12.0" gem "rspec-rails", "~> 5.1.2" end diff --git a/Gemfile.lock b/Gemfile.lock index e73d3ed..424fd66 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -142,21 +142,21 @@ GEM ffi (~> 1.0) regexp_parser (2.8.1) rexml (3.2.5) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) + rspec (3.12.0) + rspec-core (~> 3.12.0) + rspec-expectations (~> 3.12.0) + rspec-mocks (~> 3.12.0) rspec-collection_matchers (1.2.0) rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) + rspec-core (3.12.2) + rspec-support (~> 3.12.0) + rspec-expectations (3.12.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.12.0) rspec-json_expectations (2.2.0) - rspec-mocks (3.11.1) + rspec-mocks (3.12.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) + rspec-support (~> 3.12.0) rspec-rails (5.1.2) actionpack (>= 5.2) activesupport (>= 5.2) @@ -165,7 +165,7 @@ GEM rspec-expectations (~> 3.10) rspec-mocks (~> 3.10) rspec-support (~> 3.10) - rspec-support (3.11.0) + rspec-support (3.12.0) rubocop (1.52.0) json (~> 2.3) parallel (~> 1.10) @@ -234,7 +234,7 @@ DEPENDENCIES pry pry-byebug rake - rspec (~> 3.11.0) + rspec (~> 3.12.0) rspec-collection_matchers (~> 1.2.0) rspec-json_expectations (~> 2.1) rspec-rails (~> 5.1.2) diff --git a/spec/lib/diaspora_federation/entities/relayable_spec.rb b/spec/lib/diaspora_federation/entities/relayable_spec.rb index 1bcf51a..d143264 100644 --- a/spec/lib/diaspora_federation/entities/relayable_spec.rb +++ b/spec/lib/diaspora_federation/entities/relayable_spec.rb @@ -474,7 +474,7 @@ module DiasporaFederation parent: remote_parent }.merge("new_property" => new_property), %w[author guid parent_guid new_property property], - "new_property" => new_property + {"new_property" => new_property} ).and_call_original Entities::SomeRelayable.from_hash(entity_data, property_order) end diff --git a/spec/lib/diaspora_federation/entity_spec.rb b/spec/lib/diaspora_federation/entity_spec.rb index 60b33b9..45071c9 100644 --- a/spec/lib/diaspora_federation/entity_spec.rb +++ b/spec/lib/diaspora_federation/entity_spec.rb @@ -200,9 +200,11 @@ module DiasporaFederation it "calls .from_hash with the hash representation of provided XML" do expect(Entities::TestDefaultEntity).to receive(:from_hash).with( - test1: "asdf", - test2: "qwer", - test3: true + { + test1: "asdf", + test2: "qwer", + test3: true + } ) Entities::TestDefaultEntity.from_xml(Nokogiri::XML(<<~XML).root) @@ -340,7 +342,7 @@ module DiasporaFederation } expect(Entities::TestEntity).to receive(:json_parser_class).and_call_original expect_any_instance_of(Parsers::JsonParser).to receive(:parse).with(json).and_call_original - expect(Entities::TestEntity).to receive(:from_hash).with(test: "value") + expect(Entities::TestEntity).to receive(:from_hash).with({test: "value"}) Entities::TestEntity.from_json(json) end @@ -388,7 +390,7 @@ module DiasporaFederation it "calls a constructor of the entity of the appropriate type" do entity_data = {test1: "abc", test2: "123"} - expect(Entities::TestDefaultEntity).to receive(:new).with(test1: "abc", test2: "123") + expect(Entities::TestDefaultEntity).to receive(:new).with({test1: "abc", test2: "123"}) Entities::TestDefaultEntity.from_hash(entity_data) end From 114d26d732afbd47e094625d482a05e4600a8842 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 17:25:56 +0200 Subject: [PATCH 14/17] Bump ethon --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 424fd66..7fa516e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,7 +50,7 @@ GEM diff-lcs (1.5.0) docile (1.4.0) erubi (1.12.0) - ethon (0.15.0) + ethon (0.16.0) ffi (>= 1.15.0) fabrication (2.30.0) faraday (2.7.6) From 3dbf0488dd75ab70402d9a6adb567c2e5445594e Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 18:09:41 +0200 Subject: [PATCH 15/17] Allow to test for multiple rails versions in CI Before we only tested with the latest rails version and without rails, that made it possible to accidentally break with older rails versions without noticing it. The old way of keeping separate Gemfiles (and lockfiles) was too complicated to keep up to date, especially with many supported rails versions. This allows now to run with different rails version with just the same Gemfile using an env-var. For CI the Gemfile.lock is only used for the latest rails version (7.0 at the moment), as it obviously doesn't fit for other versions. I think that's fine, as if we are not compatible with a too new version of something, we need to add a maximum version there anyway. The `ruby/setup-ruby@v1` step automatically uses the deployment mode when a Gemfile.lock is present, so the `BUNDLE_FROZEN` env-var is not required, even if a Gemfile.lock is used. --- .github/workflows/ci.yml | 21 ++++-- Gemfile | 14 +++- Gemfile.lock | 1 + lib/tasks/gemfiles.rake | 24 ------- test/dummy/config/application.rb | 2 +- test/gemfiles/no-rails.Gemfile | 41 ----------- test/gemfiles/no-rails.Gemfile.lock | 107 ---------------------------- 7 files changed, 30 insertions(+), 180 deletions(-) delete mode 100644 lib/tasks/gemfiles.rake delete mode 100644 test/gemfiles/no-rails.Gemfile delete mode 100644 test/gemfiles/no-rails.Gemfile.lock diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58349cb..d038f60 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ on: jobs: test: + name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.rails }}' runs-on: ubuntu-latest strategy: fail-fast: false @@ -17,17 +18,27 @@ jobs: - "3.1" - "3.0" - "2.7" - gemfile: - - Gemfile - - test/gemfiles/no-rails.Gemfile + rails: + - "7.0" + - "6.1" + - "6.0" + - "5.2" + - "none" + exclude: + - ruby: "3.1" + rails: "5.2" + - ruby: "3.0" + rails: "5.2" env: - BUNDLE_GEMFILE: ${{ matrix.gemfile }} + RAILS_VERSION: ${{ matrix.rails }} BUNDLE_WITHOUT: development - BUNDLE_FROZEN: true BUNDLE_DISABLE_SHARED_GEMS: true CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} steps: - uses: actions/checkout@v2 + - name: Delete Gemfile.lock + run: rm Gemfile.lock + if: matrix.rails != '7.0' # Gemfile.lock is only generated for latest rails version - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} diff --git a/Gemfile b/Gemfile index 2599680..52d690c 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,9 @@ gemspec name: "diaspora_federation" Dir["diaspora_federation-*.gemspec"].each do |gemspec| plugin = gemspec.scan(/diaspora_federation-(.*)\.gemspec/).flatten.first - gemspec(name: "diaspora_federation-#{plugin}", development_group: plugin) + unless ENV["RAILS_VERSION"] == "none" && plugin == "rails" + gemspec(name: "diaspora_federation-#{plugin}", development_group: plugin) + end end # Declare any dependencies that are still in development here instead of in @@ -57,5 +59,13 @@ group :development, :test do # unit tests gem "rspec", "~> 3.12.0" - gem "rspec-rails", "~> 5.1.2" + + unless ENV["RAILS_VERSION"] == "none" + gem "rspec-rails", "~> 5.1.2" + + # The default rails version needs to be kept up to date also in: + # - test/dummy/config/application.rb (config.load_defaults) + # - .github/workflows/ci.yml ('Delete Gemfile.lock' step) + gem "actionpack", "~> #{ENV['RAILS_VERSION'] || '7.0'}.0" + end end diff --git a/Gemfile.lock b/Gemfile.lock index 7fa516e..587cb83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -221,6 +221,7 @@ PLATFORMS ruby DEPENDENCIES + actionpack (~> 7.0.0) diaspora_federation! diaspora_federation-json_schema! diaspora_federation-rails! diff --git a/lib/tasks/gemfiles.rake b/lib/tasks/gemfiles.rake deleted file mode 100644 index 582dd7e..0000000 --- a/lib/tasks/gemfiles.rake +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true - -namespace :gemfiles do - desc "Generates no-rails.Gemfile" - task :generate do - FileUtils.mkdir_p("test/gemfiles") - FileUtils.rm(Dir["test/gemfiles/*.Gemfile.lock"]) - - original_gemfile = File.read("Gemfile") - original_gemfile.sub!(/(gemspec name:.*)/) { "#{Regexp.last_match[1]}, path: \"../../\"" } - original_gemfile.sub!(/(gemspec\(name:.*)\)/) { "#{Regexp.last_match[1]}, path: \"../../\")" } - original_gemfile.sub!(/^group :development do$.*?^end$\n\n/m, "") - - no_rails_gemfile = original_gemfile.dup - no_rails_gemfile.sub!(/(gemspec\(name:.*)/) { "#{Regexp.last_match[1]} unless plugin == \"rails\"" } - no_rails_gemfile.sub!(/^.*rspec-rails.*$\n/, "") - no_rails_path = "test/gemfiles/no-rails.Gemfile" - File.write(no_rails_path, no_rails_gemfile) - - Bundler.with_unbundled_env do - system("BUNDLE_GEMFILE=#{no_rails_path} bundle install") - end - end -end diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 1f3ea4c..4b85ba7 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -24,7 +24,7 @@ require "diaspora_federation/rails" module Dummy class Application < Rails::Application # Initialize configuration defaults for originally generated Rails version. - config.load_defaults 7.0 + config.load_defaults(ENV["RAILS_VERSION"] || "7.0") # Configuration for the application, engines, and railties goes here. # diff --git a/test/gemfiles/no-rails.Gemfile b/test/gemfiles/no-rails.Gemfile deleted file mode 100644 index ce9a1c4..0000000 --- a/test/gemfiles/no-rails.Gemfile +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" - -# Declare your gem's dependencies in diaspora_federation.gemspec. -# Bundler will treat runtime dependencies like base dependencies, and -# development dependencies will be added by default to the :development group. -gemspec name: "diaspora_federation", path: "../../" - -Dir["diaspora_federation-*.gemspec"].each do |gemspec| - plugin = gemspec.scan(/diaspora_federation-(.*)\.gemspec/).flatten.first - gemspec(name: "diaspora_federation-#{plugin}", development_group: plugin, path: "../../") unless plugin == "rails" -end - -# Declare any dependencies that are still in development here instead of in -# your gemspec. These might include edge Rails or gems from your path or -# Git. Remember to move these dependencies to your gemspec before releasing -# your gem to rubygems.org. - -group :test do - # rspec formatter - gem "fuubar", "2.5.1", require: false - gem "nyan-cat-formatter", require: false - - # test coverage - gem "simplecov", "0.21.2", require: false - gem "simplecov-rcov", "0.3.1", require: false - - # test helpers - gem "json-schema", "~> 3.0" - gem "rspec-collection_matchers", "~> 1.2.0" - gem "rspec-json_expectations", "~> 2.1" - gem "webmock", "~> 3.0" -end - -group :development, :test do - gem "rake" - - # unit tests - gem "rspec", "~> 3.11.0" -end diff --git a/test/gemfiles/no-rails.Gemfile.lock b/test/gemfiles/no-rails.Gemfile.lock deleted file mode 100644 index dd0ab09..0000000 --- a/test/gemfiles/no-rails.Gemfile.lock +++ /dev/null @@ -1,107 +0,0 @@ -PATH - remote: ../.. - specs: - diaspora_federation (1.0.1) - faraday (>= 1.0, < 3) - faraday-follow_redirects (~> 0.3) - nokogiri (~> 1.6, >= 1.6.8) - typhoeus (~> 1.0) - valid (~> 1.0) - diaspora_federation-json_schema (1.0.1) - diaspora_federation-test (1.0.1) - diaspora_federation (= 1.0.1) - fabrication (~> 2.29) - uuid (~> 2.3, >= 2.3.8) - -GEM - remote: https://rubygems.org/ - specs: - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) - crack (0.4.5) - rexml - diff-lcs (1.5.0) - docile (1.4.0) - ethon (0.15.0) - ffi (>= 1.15.0) - fabrication (2.29.0) - faraday (2.3.0) - faraday-net_http (~> 2.0) - ruby2_keywords (>= 0.0.4) - faraday-follow_redirects (0.3.0) - faraday (>= 1, < 3) - faraday-net_http (2.0.3) - ffi (1.15.5) - fuubar (2.5.1) - rspec-core (~> 3.0) - ruby-progressbar (~> 1.4) - hashdiff (1.0.1) - json-schema (3.0.0) - addressable (>= 2.8) - macaddr (1.7.2) - systemu (~> 2.6.5) - nokogiri (1.13.8-x86_64-linux) - racc (~> 1.4) - nyan-cat-formatter (0.12.0) - rspec (>= 2.99, >= 2.14.2, < 4) - public_suffix (4.0.7) - racc (1.6.0) - rake (13.0.6) - rexml (3.2.5) - rspec (3.11.0) - rspec-core (~> 3.11.0) - rspec-expectations (~> 3.11.0) - rspec-mocks (~> 3.11.0) - rspec-collection_matchers (1.2.0) - rspec-expectations (>= 2.99.0.beta1) - rspec-core (3.11.0) - rspec-support (~> 3.11.0) - rspec-expectations (3.11.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-json_expectations (2.2.0) - rspec-mocks (3.11.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.11.0) - rspec-support (3.11.0) - ruby-progressbar (1.11.0) - ruby2_keywords (0.0.5) - simplecov (0.21.2) - docile (~> 1.1) - simplecov-html (~> 0.11) - simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) - simplecov-rcov (0.3.1) - simplecov (>= 0.4.1) - simplecov_json_formatter (0.1.4) - systemu (2.6.5) - typhoeus (1.4.0) - ethon (>= 0.9.0) - uuid (2.3.9) - macaddr (~> 1.0) - valid (1.2.0) - webmock (3.14.0) - addressable (>= 2.8.0) - crack (>= 0.3.2) - hashdiff (>= 0.4.0, < 2.0.0) - -PLATFORMS - x86_64-linux - -DEPENDENCIES - diaspora_federation! - diaspora_federation-json_schema! - diaspora_federation-test! - fuubar (= 2.5.1) - json-schema (~> 3.0) - nyan-cat-formatter - rake - rspec (~> 3.11.0) - rspec-collection_matchers (~> 1.2.0) - rspec-json_expectations (~> 2.1) - simplecov (= 0.21.2) - simplecov-rcov (= 0.3.1) - webmock (~> 3.0) - -BUNDLED WITH - 2.3.7 From a7f5b7cf5c340488ea72ecdf774ecd09c6adc370 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 18:10:15 +0200 Subject: [PATCH 16/17] Bump actions/checkout@v3 to get rid of node deprecation warning --- .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 d038f60..7ead036 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: BUNDLE_DISABLE_SHARED_GEMS: true CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Delete Gemfile.lock run: rm Gemfile.lock if: matrix.rails != '7.0' # Gemfile.lock is only generated for latest rails version From 9298b2afeb450ee9228811ab16f82a840a9f7031 Mon Sep 17 00:00:00 2001 From: Benjamin Neff Date: Sun, 11 Jun 2023 18:28:28 +0200 Subject: [PATCH 17/17] Add ruby 3.2 to CI --- .github/workflows/ci.yml | 3 +++ .ruby-version | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7ead036..80d5934 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,7 @@ jobs: fail-fast: false matrix: ruby: + - "3.2" - "3.1" - "3.0" - "2.7" @@ -25,6 +26,8 @@ jobs: - "5.2" - "none" exclude: + - ruby: "3.2" + rails: "5.2" - ruby: "3.1" rails: "5.2" - ruby: "3.0" diff --git a/.ruby-version b/.ruby-version index 8c50098..a3ec5a4 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1 +3.2