File tree Expand file tree Collapse file tree 6 files changed +27
-5
lines changed Expand file tree Collapse file tree 6 files changed +27
-5
lines changed Original file line number Diff line number Diff line change
1
+ * Use ` ruby file: ".ruby-version" ` in generated Gemfile if supported.
2
+
3
+ * Hartley McGuire*
4
+
1
5
* ` bin/rails test ` will no longer load files named ` *_test.rb ` if they are located in the ` fixtures ` folder.
2
6
3
7
* Edouard Chin*
Original file line number Diff line number Diff line change @@ -436,8 +436,20 @@ def to_s
436
436
end
437
437
end
438
438
439
+ def gem_ruby_entry
440
+ if Gem ::Version . new ( Bundler ::VERSION ) >= Gem ::Version . new ( "2.4.20" ) # add file: option to #ruby
441
+ 'ruby file: ".ruby-version"'
442
+ else
443
+ "ruby \" #{ gem_ruby_version } \" "
444
+ end
445
+ end
446
+
439
447
def gem_ruby_version
440
- Gem ::Version . new ( Gem ::VERSION ) >= Gem ::Version . new ( "3.3.13" ) ? Gem . ruby_version : RUBY_VERSION
448
+ if Gem ::Version . new ( Gem ::VERSION ) >= Gem ::Version . new ( "3.3.13" ) # patch level removed from Gem.ruby_version
449
+ Gem . ruby_version
450
+ else
451
+ RUBY_VERSION
452
+ end
441
453
end
442
454
443
455
def rails_prerelease?
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ RUN curl -fsSL https://bun.sh/install | bash -s -- "bun-v${BUN_VERSION}"
42
42
43
43
<% end -%>
44
44
# Install application gems
45
- COPY Gemfile Gemfile.lock ./
45
+ COPY .ruby-version Gemfile Gemfile.lock ./
46
46
RUN bundle install && \
47
47
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git<% if depend_on_bootsnap? -%> && \
48
48
bundle exec bootsnap precompile --gemfile<% end %>
Original file line number Diff line number Diff line change 1
1
source "https://rubygems.org"
2
2
3
- ruby <%= "\"#{gem_ruby_version}\"" - %>
3
+ <%= gem_ruby_entry %>
4
4
5
5
<% gemfile_entries.each do |gemfile_entry| %>
6
6
<%= gemfile_entry %>
Original file line number Diff line number Diff line change @@ -1006,7 +1006,13 @@ def test_inclusion_of_ruby_version
1006
1006
run_generator
1007
1007
1008
1008
assert_file "Gemfile" do |content |
1009
- assert_match ( /ruby "#{ Gem ::Version . new ( Gem ::VERSION ) >= Gem ::Version . new ( "3.3.13" ) ? Gem . ruby_version : RUBY_VERSION } "/ , content )
1009
+ if Gem ::Version . new ( Bundler ::VERSION ) >= Gem ::Version . new ( "2.4.20" ) # add file: option to #ruby
1010
+ assert_match ( 'ruby file: ".ruby-version"' , content )
1011
+ elsif Gem ::Version . new ( Gem ::VERSION ) >= Gem ::Version . new ( "3.3.13" ) # patch level removed from Gem.ruby_version
1012
+ assert_match ( "ruby \" #{ Gem . ruby_version } \" " , content )
1013
+ else
1014
+ assert_match ( "ruby \" #{ RUBY_VERSION } \" " , content )
1015
+ end
1010
1016
end
1011
1017
assert_file "Dockerfile" do |content |
1012
1018
assert_match ( /ARG RUBY_VERSION=#{ Gem ::Version . new ( Gem ::VERSION ) >= Gem ::Version . new ( "3.3.13" ) ? Gem . ruby_version : RUBY_VERSION } / , content )
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ def evaluate_template_docker(file)
100
100
private
101
101
def gemfile_locals
102
102
{
103
- gem_ruby_version : RUBY_VERSION ,
103
+ gem_ruby_entry : "ruby \" #{ RUBY_VERSION } \" " ,
104
104
rails_prerelease : false ,
105
105
skip_active_storage : true ,
106
106
depend_on_bootsnap : false ,
You can’t perform that action at this time.
0 commit comments