File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -644,7 +644,17 @@ def target_rails_prerelease(self_command = "new")
644
644
end
645
645
646
646
def run_bundle
647
- bundle_command ( "install" , "BUNDLE_IGNORE_MESSAGES" => "1" ) if bundle_install?
647
+ if bundle_install?
648
+ bundle_command ( "install" , "BUNDLE_IGNORE_MESSAGES" => "1" )
649
+
650
+ # The vast majority of Rails apps will be deployed on `x86_64-linux`.
651
+ platform = [ "--add-platform=x86_64-linux" ]
652
+
653
+ # Users that develop on M1 mac may use docker and would need `aarch64-linux` as well.
654
+ platform << "--add-platform=aarch64-linux" if RUBY_PLATFORM . start_with? ( "arm64" )
655
+
656
+ bundle_command ( "lock #{ platform . join ( " " ) } " , "BUNDLE_IGNORE_MESSAGES" => "1" )
657
+ end
648
658
end
649
659
650
660
def run_javascript
Original file line number Diff line number Diff line change @@ -366,9 +366,11 @@ def run_generator_using_prerelease(args)
366
366
367
367
assert_file File . expand_path ( "Gemfile" , project_path ) do |gemfile |
368
368
assert_equal "install" , @bundle_commands [ 0 ]
369
+ assert_match "lock --add-platform" , @bundle_commands [ 1 ]
370
+
369
371
assert_equal gemfile [ rails_gem_pattern ] , bundle_command_rails_gems [ 0 ]
370
372
371
- assert_match %r"^exec rails (?:plugin )?new #{ Regexp . escape Shellwords . join ( expected_args ) } " , @bundle_commands [ 1 ]
373
+ assert_match %r"^exec rails (?:plugin )?new #{ Regexp . escape Shellwords . join ( expected_args ) } " , @bundle_commands [ 2 ]
372
374
assert_equal gemfile [ rails_gem_pattern ] , bundle_command_rails_gems [ 1 ]
373
375
end
374
376
end
You can’t perform that action at this time.
0 commit comments