diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2019-04-17 00:45:53 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2019-04-17 00:45:53 +0200 |
commit | 8927eba83c4c16762b6f9a7e35914836ac52739b (patch) | |
tree | 523190f85182b1eacebb9cd569d64f095ab7c3f0 /railties/lib | |
parent | 1da9a7e410f15859939eb4158421846638a41e71 (diff) | |
parent | 6f73a31c0ca4438c164152695152a9c947eae912 (diff) | |
download | rails-8927eba83c4c16762b6f9a7e35914836ac52739b.tar.gz rails-8927eba83c4c16762b6f9a7e35914836ac52739b.tar.bz2 rails-8927eba83c4c16762b6f9a7e35914836ac52739b.zip |
Merge pull request #33139 'bin-idempotent-setup'
Signed-off-by: Kasper Timm Hansen <kaspth@gmail.com>
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/bin/setup.tt | 5 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/bin/update.tt | 33 |
2 files changed, 3 insertions, 35 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/bin/setup.tt b/railties/lib/rails/generators/rails/app/templates/bin/setup.tt index 3f73bae3da..5928deb6aa 100644 --- a/railties/lib/rails/generators/rails/app/templates/bin/setup.tt +++ b/railties/lib/rails/generators/rails/app/templates/bin/setup.tt @@ -8,7 +8,8 @@ def system!(*args) end FileUtils.chdir APP_ROOT do - # This script is a starting point to setup your application. + # This script is a way to setup or update your development environment automatically. + # This script is idempotent, so that you can run it at anytime and get an expectable outcome. # Add necessary setup steps to this file. puts '== Installing dependencies ==' @@ -27,7 +28,7 @@ FileUtils.chdir APP_ROOT do # end puts "\n== Preparing database ==" - system! 'bin/rails db:setup' + system! 'bin/rails db:prepare' <% end -%> puts "\n== Removing old logs and tempfiles ==" diff --git a/railties/lib/rails/generators/rails/app/templates/bin/update.tt b/railties/lib/rails/generators/rails/app/templates/bin/update.tt deleted file mode 100644 index 03b77d0d46..0000000000 --- a/railties/lib/rails/generators/rails/app/templates/bin/update.tt +++ /dev/null @@ -1,33 +0,0 @@ -require 'fileutils' - -# path to your application root. -APP_ROOT = File.expand_path('..', __dir__) - -def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") -end - -FileUtils.chdir APP_ROOT do - # This script is a way to update your development environment automatically. - # Add necessary update steps to this file. - - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') -<% unless options.skip_javascript? -%> - - # Install JavaScript dependencies - # system('bin/yarn') -<% end -%> -<% unless options.skip_active_record? -%> - - puts "\n== Updating database ==" - system! 'rails db:migrate' -<% end -%> - - puts "\n== Removing old logs and tempfiles ==" - system! 'rails log:clear tmp:clear' - - puts "\n== Restarting application server ==" - system! 'rails restart' -end |