Mercurial > zeropaste
annotate bin/setup @ 495:92929378413e
Update to latest rails
author | nanaya <me@nanaya.net> |
---|---|
date | Sun, 15 Dec 2024 22:18:06 +0900 |
parents | 6cac8fcf8164 |
children |
rev | line source |
---|---|
431 | 1 #!/usr/bin/env ruby |
481 | 2 require "fileutils" |
431 | 3 |
485 | 4 APP_ROOT = File.expand_path("..", __dir__) |
431 | 5 |
6 def system!(*args) | |
495 | 7 system(*args, exception: true) |
431 | 8 end |
9 | |
467 | 10 FileUtils.chdir APP_ROOT do |
481 | 11 # This script is a way to set up or update your development environment automatically. |
12 # This script is idempotent, so that you can run it at any time and get an expectable outcome. | |
431 | 13 # Add necessary setup steps to this file. |
14 | |
485 | 15 puts "== Installing dependencies ==" |
16 system("bundle check") || system!("bundle install") | |
459
07d6c6639adf
Upgrade to rails 5.2. RIP code style.
nanaya <me@nanaya.pro>
parents:
431
diff
changeset
|
17 |
431 | 18 # puts "\n== Copying sample files ==" |
485 | 19 # unless File.exist?("config/database.yml") |
20 # FileUtils.cp "config/database.yml.sample", "config/database.yml" | |
431 | 21 # end |
22 | |
23 puts "\n== Preparing database ==" | |
485 | 24 system! "bin/rails db:prepare" |
431 | 25 |
26 puts "\n== Removing old logs and tempfiles ==" | |
485 | 27 system! "bin/rails log:clear tmp:clear" |
431 | 28 |
495 | 29 unless ARGV.include?("--skip-server") |
30 puts "\n== Starting development server ==" | |
31 STDOUT.flush # flush the output before exec(2) so that it displays | |
32 exec "bin/dev" | |
33 end | |
431 | 34 end |