From eae314f1ac083bc7be75f13d9673b8c667764940 Mon Sep 17 00:00:00 2001 From: Didier Lafforgue Date: Tue, 25 Jun 2024 23:28:05 +0200 Subject: [PATCH] remove the Coveralls gem (too old) + fix the tests/code for Ruby 3.2.x --- Gemfile | 2 +- Gemfile.lock | 23 +++++-------------- .../steam/adapters/filesystem/yaml_loader.rb | 4 ++-- .../filesystem/yaml_loaders/content_entry.rb | 4 ++-- .../steam/initializers/dragonfly.rb | 2 +- .../steam/liquid/tags/concerns/path.rb | 2 +- spec/spec_helper.rb | 8 ------- spec/unit/initializers/dragonfly_spec.rb | 2 +- 8 files changed, 14 insertions(+), 33 deletions(-) diff --git a/Gemfile b/Gemfile index 17d5f15d..2e0158dd 100644 --- a/Gemfile +++ b/Gemfile @@ -32,5 +32,5 @@ group :test do gem 'rack-test', '~> 2.1.0' - gem 'coveralls', '~> 0.8.23', require: false + gem 'simplecov', '~> 0.22.0', require: false end diff --git a/Gemfile.lock b/Gemfile.lock index 8f417b88..99462e65 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,12 +50,6 @@ GEM colorize (1.1.0) concurrent-ruby (1.2.3) connection_pool (2.4.1) - coveralls (0.8.23) - json (>= 1.8, < 3) - simplecov (~> 0.16.1) - term-ansicolor (~> 1.3) - thor (>= 0.19.4, < 2.0) - tins (~> 1.6) crass (1.0.6) date (3.3.4) diff-lcs (1.5.1) @@ -81,7 +75,6 @@ GEM iso iso (0.4.0) i18n - json (2.7.1) json_spec (1.1.5) multi_json (~> 1.0) rspec (>= 2.0, < 4.0) @@ -165,23 +158,19 @@ GEM sanitize (6.0.2) crass (~> 1.0.2) nokogiri (>= 1.12.0) - simplecov (0.16.1) + simplecov (0.22.0) docile (~> 1.1) - json (>= 1.8, < 3) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.2) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) stackprof (0.2.26) stringex (2.8.6) - sync (0.5.0) temple (0.10.3) - term-ansicolor (1.7.2) - tins (~> 1.0) thor (1.3.1) tilt (2.3.0) timecop (0.9.8) timeout (0.4.1) - tins (1.32.1) - sync tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -190,7 +179,6 @@ PLATFORMS x86_64-darwin-22 DEPENDENCIES - coveralls (~> 0.8.23) flamegraph haml (~> 6.2.3) i18n-spec (~> 0.6.0) @@ -205,6 +193,7 @@ DEPENDENCIES rack-test (~> 2.1.0) rake rspec (~> 3.12.0) + simplecov (~> 0.22.0) stackprof timecop (~> 0.9.1) diff --git a/lib/locomotive/steam/adapters/filesystem/yaml_loader.rb b/lib/locomotive/steam/adapters/filesystem/yaml_loader.rb index e061e2fb..c06e9120 100644 --- a/lib/locomotive/steam/adapters/filesystem/yaml_loader.rb +++ b/lib/locomotive/steam/adapters/filesystem/yaml_loader.rb @@ -19,7 +19,7 @@ def load(scope = nil) end def _load(path, frontmatter = false, strict = false, &block) - if File.exists?(path) + if File.exist?(path) yaml = File.open(path).read.force_encoding('utf-8') template = nil @@ -72,7 +72,7 @@ def safe_json_load(json, template, path, &block) end def safe_json_file_load(path) - return {} unless File.exists?(path) + return {} unless File.exist?(path) json = File.read(path) diff --git a/lib/locomotive/steam/adapters/filesystem/yaml_loaders/content_entry.rb b/lib/locomotive/steam/adapters/filesystem/yaml_loaders/content_entry.rb index 4861f388..0a07636c 100644 --- a/lib/locomotive/steam/adapters/filesystem/yaml_loaders/content_entry.rb +++ b/lib/locomotive/steam/adapters/filesystem/yaml_loaders/content_entry.rb @@ -70,7 +70,7 @@ def file_size(path) _path = File.join(site_path, 'public', path) - File.exists?(_path) ? File.size(_path) : nil + File.exist?(_path) ? File.size(_path) : nil end def modify_for_associations(attributes) @@ -114,7 +114,7 @@ def path path = File.join(site_path, 'data', env.to_s, 'content_entries') - @path = File.exists?(path) ? path : File.join(site_path, 'data') # allow the legacy folder + @path = File.exist?(path) ? path : File.join(site_path, 'data') # allow the legacy folder end def content_type diff --git a/lib/locomotive/steam/initializers/dragonfly.rb b/lib/locomotive/steam/initializers/dragonfly.rb index cb22015b..49141089 100644 --- a/lib/locomotive/steam/initializers/dragonfly.rb +++ b/lib/locomotive/steam/initializers/dragonfly.rb @@ -33,7 +33,7 @@ def find_imagemagick_commands convert = ENV['IMAGE_MAGICK_CONVERT'] || `which convert`.strip.presence || '/usr/local/bin/convert' identify = ENV['IMAGE_MAGICK_IDENTIFY'] || `which identify`.strip.presence || '/usr/local/bin/identify' - if File.exists?(convert) + if File.exist?(convert) { convert_command: convert, identify_command: identify } else missing_image_magick diff --git a/lib/locomotive/steam/liquid/tags/concerns/path.rb b/lib/locomotive/steam/liquid/tags/concerns/path.rb index 7f9c2e6e..7cb22688 100644 --- a/lib/locomotive/steam/liquid/tags/concerns/path.rb +++ b/lib/locomotive/steam/liquid/tags/concerns/path.rb @@ -29,7 +29,7 @@ def render_path(context, &block) handle = @context[@handle] || @handle # is external url? - if handle =~ Locomotive::Steam::IsHTTP + if handle.is_a?(String) && handle =~ Locomotive::Steam::IsHTTP handle elsif page = self.retrieve_page_drop_from_handle(handle) # return a drop or model? # make sure we've got the page/content entry (if templatized) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4711cb11..dde0188d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,12 +1,4 @@ -# require 'simplecov' -# require 'codeclimate-test-reporter' -# require 'coveralls' -# require 'simplecov' -# require 'coveralls' - require 'simplecov' -require 'coveralls' - SimpleCov.start do # formatter SimpleCov::Formatter::MultiFormatter.new([ diff --git a/spec/unit/initializers/dragonfly_spec.rb b/spec/unit/initializers/dragonfly_spec.rb index a791021c..c7871383 100644 --- a/spec/unit/initializers/dragonfly_spec.rb +++ b/spec/unit/initializers/dragonfly_spec.rb @@ -17,7 +17,7 @@ before do ::Dragonfly::App.destroy_apps - expect(File).to receive(:exists?).and_return(false) + expect(File).to receive(:exist?).and_return(false) initializer.run end it { is_expected.to eq nil }