Skip to content

Commit a382534

Browse files
authored
Merge pull request #1684 from kimihito/chore/bump-ruby-3.2.8
Rubyのバージョンを3.2.8にする
2 parents 5aa23f0 + 98e490e commit a382534

File tree

10 files changed

+32
-32
lines changed

10 files changed

+32
-32
lines changed

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.6
1+
3.2.8

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ruby:3.1.6
1+
FROM ruby:3.2.8
22

33
ENV LANG C.UTF-8
44

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
source 'https://rubygems.org'
2-
ruby '3.1.6'
2+
ruby '3.2.8'
33

44
gem 'bootsnap'
55
gem 'pg'

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ DEPENDENCIES
567567
web-console
568568

569569
RUBY VERSION
570-
ruby 3.1.6p260
570+
ruby 3.2.8p263
571571

572572
BUNDLED WITH
573573
2.5.19

app/controllers/docs_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def kata
1515

1616
def show
1717
@doc = Document.new(params[:id])
18-
redirect_to root_url unless @doc.exists?
18+
redirect_to root_url unless @doc.exist?
1919

2020
if @doc.content.include? "NUM_OF_"
2121
@doc.content.gsub! "{{ NUM_OF_JAPAN_DOJOS }}", Dojo.active_dojos_count.to_s
@@ -32,9 +32,9 @@ def show
3232
if @meta_image.end_with? '.webp'
3333
# .webp -> .jpg
3434
# .webp -> .png
35-
@meta_image.gsub!('.webp', '.jpg') if File.exists? "public/#{@meta_image[0..-6]}.jpg"
36-
@meta_image.gsub!('.webp', '.jpeg') if File.exists? "public/#{@meta_image[0..-6]}.jpeg"
37-
@meta_image.gsub!('.webp', '.png') if File.exists? "public/#{@meta_image[0..-6]}.png"
35+
@meta_image.gsub!('.webp', '.jpg') if File.exist? "public/#{@meta_image[0..-6]}.jpg"
36+
@meta_image.gsub!('.webp', '.jpeg') if File.exist? "public/#{@meta_image[0..-6]}.jpeg"
37+
@meta_image.gsub!('.webp', '.png') if File.exist? "public/#{@meta_image[0..-6]}.png"
3838
end
3939

4040
# Add here if you want to optimize meta description.

app/models/document.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ def url
5555
"#{URL_PATH}/#{self.filename}"
5656
end
5757

58-
def exists?
58+
def exist?
5959
return false if path.include? "\u0000"
6060
Document.all.map(&:filename).include?(filename)
6161
end
6262

6363
def title
64-
return '' unless self.exists?
64+
return '' unless self.exist?
6565
@title ||=
6666
ActionController::Base.helpers.strip_tags(
6767
Kramdown::Document.new(self.get_first_paragraph, input: 'GFM').to_html
6868
).strip
6969
end
7070

7171
def description
72-
return '' unless self.exists?
72+
return '' unless self.exist?
7373
@desc ||=
7474
ActionController::Base.helpers.strip_tags(
7575
Kramdown::Document.new(self.get_second_paragraph, input: 'GFM').to_html
@@ -80,7 +80,7 @@ def description=(text)
8080
end
8181

8282
def content
83-
@content ||= self.exists? ? File.read(self.path) : ''
83+
@content ||= self.exist? ? File.read(self.path) : ''
8484
end
8585

8686
private

app/models/podcast.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def path
1818
"#{DIR_PATH}/#{id}.md"
1919
end
2020

21-
def exists?(offset: 0)
21+
def exist?(offset: 0)
2222
return false if self.path.include?("\u0000")
2323
return false if (self.id + offset).zero?
24-
File.exists?("#{DIR_PATH}/#{id + offset}.md")
24+
File.exist?("#{DIR_PATH}/#{id + offset}.md")
2525
end
2626

2727
def cover
@@ -30,6 +30,6 @@ def cover
3030
end
3131

3232
def content
33-
exists? ? File.read(path) : ''
33+
exist? ? File.read(path) : ''
3434
end
3535
end

app/views/podcasts/_navigation.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div style="display: table; font-weight: bolder; width: 100%; padding: 10px 10px; background-color:#3870c4;">
22
<p class="nav prev">
3-
<% if @episode.exists?(offset: -1) %>
3+
<% if @episode.exist?(offset: -1) %>
44
<%= link_to podcast_path(@episode.id - 1), title: '前のエピソードを見る' do %>
55
&laquo; prev
66
<% end %>
@@ -12,7 +12,7 @@
1212
<%= link_to '目次に戻る'.html_safe, podcasts_path %>
1313
</p>
1414
<p class="nav next">
15-
<% if @episode.exists?(offset: +1) %>
15+
<% if @episode.exist?(offset: +1) %>
1616
<%= link_to podcast_path(@episode.id + 1), title: '次のエピソードを見る' do %>
1717
next &raquo;
1818
<% end %>

spec/features/podcasts_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
scenario 'Charter should be exist' do
1111
@podcast = create(:podcast)
12-
allow(@podcast).to receive(:exists?) { true }
13-
allow(@podcast).to receive(:exists?).with(offset: -1) { false }
12+
allow(@podcast).to receive(:exist?) { true }
13+
allow(@podcast).to receive(:exist?).with(offset: -1) { false }
1414
allow(@podcast).to receive(:content) { "title\n収録日: 2019/05/10\n..." }
1515
allow(Podcast).to receive(:find_by).with(id: @podcast.id.to_s) { @podcast }
1616

@@ -25,7 +25,7 @@
2525

2626
scenario 'Load doc file with absolute path' do
2727
@podcast = create(:podcast)
28-
allow(@podcast).to receive(:exists?) { true }
28+
allow(@podcast).to receive(:exist?) { true }
2929
allow(@podcast).to receive(:content) { "title\n収録日: 2019/05/10\n..." }
3030
allow(Podcast).to receive(:find_by).with(id: @podcast.id.to_s) { @podcast }
3131

spec/models/podcast_spec.rb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,42 @@
1010
expect(@podcast.path).to eq("public/podcasts/#{@podcast.id}.md")
1111
end
1212

13-
describe 'exists?(offset: 0)' do
13+
describe 'exist?(offset: 0)' do
1414
it '\u0000 を含む ⇒ false' do
1515
allow(@podcast).to receive(:path) { "public/podcasts/\u0000" }
1616

17-
expect(@podcast.exists?).to eq(false)
17+
expect(@podcast.exist?).to eq(false)
1818
end
1919

2020
context 'offset 省略' do
2121
before :each do
22-
allow(File).to receive(:exists?) { false }
22+
allow(File).to receive(:exist?) { false }
2323
end
2424

2525
it 'ファイルあり ⇒ true' do
26-
allow(File).to receive(:exists?).with("public/podcasts/#{@podcast.id}.md") { true }
26+
allow(File).to receive(:exist?).with("public/podcasts/#{@podcast.id}.md") { true }
2727

28-
expect(@podcast.exists?).to eq(true)
28+
expect(@podcast.exist?).to eq(true)
2929
end
3030

3131
it 'ファイルなし ⇒ false' do
32-
expect(@podcast.exists?).to eq(false)
32+
expect(@podcast.exist?).to eq(false)
3333
end
3434
end
3535

3636
context 'offset 指定' do
3737
before :each do
38-
allow(File).to receive(:exists?) { false }
38+
allow(File).to receive(:exist?) { false }
3939
end
4040

4141
it 'ファイルあり ⇒ true' do
42-
allow(File).to receive(:exists?).with("public/podcasts/#{@podcast.id + 1}.md") { true }
42+
allow(File).to receive(:exist?).with("public/podcasts/#{@podcast.id + 1}.md") { true }
4343

44-
expect(@podcast.exists?(offset: 1)).to eq(true)
44+
expect(@podcast.exist?(offset: 1)).to eq(true)
4545
end
4646

4747
it 'ファイルなし ⇒ false' do
48-
expect(@podcast.exists?(offset: 1)).to eq(false)
48+
expect(@podcast.exist?(offset: 1)).to eq(false)
4949
end
5050
end
5151
end
@@ -57,13 +57,13 @@
5757
end
5858

5959
it 'ファイル存在 ⇒ ファイルから読み込み' do
60-
allow(@podcast).to receive(:exists?) { true }
60+
allow(@podcast).to receive(:exist?) { true }
6161

6262
expect(@podcast.content).to eq(@content_body)
6363
end
6464

6565
it 'ファイルなし ⇒ 空文字列' do
66-
allow(@podcast).to receive(:exists?) { false }
66+
allow(@podcast).to receive(:exist?) { false }
6767

6868
expect(@podcast.content).to eq('')
6969
end

0 commit comments

Comments
 (0)