summaryrefslogtreecommitdiff
path: root/bin/setup
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
commit9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch)
tree8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /bin/setup
parent85a01e35274b8d4d4165a7b26bd7986e211246bb (diff)
parent1853082fcd8c067390c246f9daa01a9b47387497 (diff)
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'bin/setup')
-rwxr-xr-xbin/setup35
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/setup b/bin/setup
new file mode 100755
index 0000000..81be011
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,35 @@
1#!/usr/bin/env ruby
2require "fileutils"
3
4APP_ROOT = File.expand_path("..", __dir__)
5
6def system!(*args)
7 system(*args, exception: true)
8end
9
10FileUtils.chdir APP_ROOT do
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.
13 # Add necessary setup steps to this file.
14
15 puts "== Installing dependencies =="
16 system("bundle check") || system!("bundle install")
17
18 # puts "\n== Copying sample files =="
19 # unless File.exist?("config/database.yml")
20 # FileUtils.cp "config/database.yml.sample", "config/database.yml"
21 # end
22
23 puts "\n== Preparing database =="
24 system! "bin/rails db:prepare"
25 system! "bin/rails db:reset" if ARGV.include?("--reset")
26
27 puts "\n== Removing old logs and tempfiles =="
28 system! "bin/rails log:clear tmp:clear"
29
30 unless ARGV.include?("--skip-server")
31 puts "\n== Starting development server =="
32 STDOUT.flush # flush the output before exec(2) so that it displays
33 exec "bin/dev"
34 end
35end