diff --git a/.ruby-version b/.ruby-version index 9cec7165a..f092941a7 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.6 +3.2.8 diff --git a/Dockerfile b/Dockerfile index 2ad7aa075..e0fe18087 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.1.6 +FROM ruby:3.2.8 ENV LANG C.UTF-8 diff --git a/Gemfile b/Gemfile index 6e3c72806..777786543 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -ruby '3.1.6' +ruby '3.2.8' gem 'bootsnap' gem 'pg' diff --git a/Gemfile.lock b/Gemfile.lock index 2415b5684..0afd2fd68 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -567,7 +567,7 @@ DEPENDENCIES web-console RUBY VERSION - ruby 3.1.6p260 + ruby 3.2.8p263 BUNDLED WITH 2.5.19 diff --git a/app/controllers/docs_controller.rb b/app/controllers/docs_controller.rb index e2a1d4b4d..9cd3b25ab 100644 --- a/app/controllers/docs_controller.rb +++ b/app/controllers/docs_controller.rb @@ -15,7 +15,7 @@ def kata def show @doc = Document.new(params[:id]) - redirect_to root_url unless @doc.exists? + redirect_to root_url unless @doc.exist? if @doc.content.include? "NUM_OF_" @doc.content.gsub! "{{ NUM_OF_JAPAN_DOJOS }}", Dojo.active_dojos_count.to_s @@ -32,9 +32,9 @@ def show if @meta_image.end_with? '.webp' # .webp -> .jpg # .webp -> .png - @meta_image.gsub!('.webp', '.jpg') if File.exists? "public/#{@meta_image[0..-6]}.jpg" - @meta_image.gsub!('.webp', '.jpeg') if File.exists? "public/#{@meta_image[0..-6]}.jpeg" - @meta_image.gsub!('.webp', '.png') if File.exists? "public/#{@meta_image[0..-6]}.png" + @meta_image.gsub!('.webp', '.jpg') if File.exist? "public/#{@meta_image[0..-6]}.jpg" + @meta_image.gsub!('.webp', '.jpeg') if File.exist? "public/#{@meta_image[0..-6]}.jpeg" + @meta_image.gsub!('.webp', '.png') if File.exist? "public/#{@meta_image[0..-6]}.png" end # Add here if you want to optimize meta description. diff --git a/app/models/document.rb b/app/models/document.rb index 2bac3899c..513fb4d82 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -55,13 +55,13 @@ def url "#{URL_PATH}/#{self.filename}" end - def exists? + def exist? return false if path.include? "\u0000" Document.all.map(&:filename).include?(filename) end def title - return '' unless self.exists? + return '' unless self.exist? @title ||= ActionController::Base.helpers.strip_tags( Kramdown::Document.new(self.get_first_paragraph, input: 'GFM').to_html @@ -69,7 +69,7 @@ def title end def description - return '' unless self.exists? + return '' unless self.exist? @desc ||= ActionController::Base.helpers.strip_tags( Kramdown::Document.new(self.get_second_paragraph, input: 'GFM').to_html @@ -80,7 +80,7 @@ def description=(text) end def content - @content ||= self.exists? ? File.read(self.path) : '' + @content ||= self.exist? ? File.read(self.path) : '' end private diff --git a/app/models/podcast.rb b/app/models/podcast.rb index d4add910f..ca6c09126 100644 --- a/app/models/podcast.rb +++ b/app/models/podcast.rb @@ -18,10 +18,10 @@ def path "#{DIR_PATH}/#{id}.md" end - def exists?(offset: 0) + def exist?(offset: 0) return false if self.path.include?("\u0000") return false if (self.id + offset).zero? - File.exists?("#{DIR_PATH}/#{id + offset}.md") + File.exist?("#{DIR_PATH}/#{id + offset}.md") end def cover @@ -30,6 +30,6 @@ def cover end def content - exists? ? File.read(path) : '' + exist? ? File.read(path) : '' end end diff --git a/app/views/podcasts/_navigation.html.erb b/app/views/podcasts/_navigation.html.erb index 7cd656a23..7115660a1 100644 --- a/app/views/podcasts/_navigation.html.erb +++ b/app/views/podcasts/_navigation.html.erb @@ -1,6 +1,6 @@