Skip to content

Commit 5da74bf

Browse files
authored
Merge pull request rails#52772 from rails/rm-fix-script-setup
Allow to skip the server in `bin/setup`
2 parents c43b540 + e59153a commit 5da74bf

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

railties/lib/rails/generators/rails/app/templates/bin/setup.tt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ FileUtils.chdir APP_ROOT do
3838
puts "\n== Removing old logs and tempfiles =="
3939
system! "bin/rails log:clear tmp:clear"
4040

41-
puts "\n== Starting development server =="
42-
exec "bin/dev"
41+
unless ARGV.include?("--skip-server")
42+
puts "\n== Starting development server =="
43+
STDOUT.flush # flush the output before exec(2) so that it displays
44+
exec "bin/dev"
45+
end
4346
end

railties/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@
3333
<%- end -%>
3434

3535
// Use 'postCreateCommand' to run commands after the container is created.
36-
"postCreateCommand": "bin/setup"
36+
"postCreateCommand": "bin/setup --skip-server"
3737
}

railties/test/application/bin_setup_test.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ def test_bin_setup
2020
assert_equal 5, File.size("log/test.log")
2121
assert_not File.exist?("tmp/restart.txt")
2222

23-
`bin/setup 2>&1`
23+
`bin/setup --skip-server 2>&1`
2424
assert_equal 0, File.size("log/test.log")
2525
assert_equal '["ar_internal_metadata", "articles", "schema_migrations"]', list_tables.call
26-
assert File.exist?("tmp/restart.txt")
2726
end
2827
end
2928

@@ -35,7 +34,7 @@ def test_bin_setup_output
3534

3635
app_file "db/schema.rb", ""
3736

38-
output = `bin/setup 2>&1`
37+
output = `bin/setup --skip-server 2>&1`
3938

4039
# Ignore line that's only output by Bundler < 1.14
4140
output.sub!(/^Resolving dependencies\.\.\.\n/, "")
@@ -58,8 +57,6 @@ def test_bin_setup_output
5857
Created database 'app_test'
5958
6059
== Removing old logs and tempfiles ==
61-
62-
== Restarting application server ==
6360
OUTPUT
6461
end
6562
end

railties/test/fixtures/.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
// "remoteUser": "root",
2828

2929
// Use 'postCreateCommand' to run commands after the container is created.
30-
"postCreateCommand": "bin/setup"
30+
"postCreateCommand": "bin/setup --skip-server"
3131
}

0 commit comments

Comments
 (0)