-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running bin/setup
fails after generating a new app
#1224
Comments
Our application template invokes Even invoking Running |
I wonder if we need to remove |
bin/setup
files after generating a new appbin/setup
fails after generating a new app
For context, this is what #!/usr/bin/env ruby
require "fileutils"
APP_ROOT = File.expand_path("..", __dir__)
APP_NAME = "setup-script"
def system!(*args)
system(*args, exception: true)
end
FileUtils.chdir APP_ROOT do
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.
puts "== Installing dependencies =="
system! "gem install bundler --conservative"
system("bundle check") || system!("bundle install")
# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end
puts "\n== Preparing database =="
system! "bin/rails db:prepare"
puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"
puts "\n== Restarting application server =="
system! "bin/rails restart"
# puts "\n== Configuring puma-dev =="
# system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
# system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
end For context, this is what #!/usr/bin/env ruby
require "fileutils"
APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
system(*args, exception: true)
end
FileUtils.chdir APP_ROOT do
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.
puts "== Installing dependencies =="
system("bundle check") || system!("bundle install")
# puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml")
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end
puts "\n== Preparing database =="
system! "bin/rails db:prepare"
puts "\n== Removing old logs and tempfiles =="
system! "bin/rails log:clear tmp:clear"
unless ARGV.include?("--skip-server")
puts "\n== Starting development server =="
STDOUT.flush # flush the output before exec(2) so that it displays
exec "bin/dev"
end
end |
Removing
|
This worked locally: diff --git a/lib/install/web.rb b/lib/install/web.rb
index 6f7d4fd..80a7e19 100644
--- a/lib/install/web.rb
+++ b/lib/install/web.rb
@@ -37,7 +37,7 @@ def apply_template!
run "bundle install"
generate "suspenders:install:web"
- rails_command "db:prepare"
+ rails_command "db:migrate"
say "\nCongratulations! You just pulled our suspenders."
end |
Closes #1224 It's unclear why we need to run migrations, since we were originally calling [db:prepare][dbp] which does the following: > If the database exists but the tables have not been created, the command will load the schema, run any pending migrations, dump the updated schema, and finally load the seed data. See the Seeding Data documentation for more details. However, I found that calling `db:migrate` in the application template worked. [dbp]: https://guides.rubyonrails.org/active_record_migrations.html#preparing-the-database
Closes #1224 It's unclear why we need to run migrations, since we were originally calling [db:prepare][dbp] which does the following: > If the database exists but the tables have not been created, the command will load the schema, run any pending migrations, dump the updated schema, and finally load the seed data. See the Seeding Data documentation for more details. However, I found that calling `db:migrate` in the application template worked. [dbp]: https://guides.rubyonrails.org/active_record_migrations.html#preparing-the-database
Closes #1224 It's unclear why we need to run migrations, since we're already calling [db:prepare][dbp] which does the following: > If the database exists but the tables have not been created, the command will load the schema, run any pending migrations, dump the updated schema, and finally load the seed data. See the Seeding Data documentation for more details. However, I found that calling `db:migrate` in the application template worked. [dbp]: https://guides.rubyonrails.org/active_record_migrations.html#preparing-the-database
When I run
bin/setup
in a newly generated app, I get the following error:The text was updated successfully, but these errors were encountered: