From 0b2e80aa4053826a916c72b4d34edab831579d35 Mon Sep 17 00:00:00 2001 From: nakamura Date: Fri, 7 Mar 2025 06:24:37 +0000 Subject: [PATCH] Add quickstart script for Codespaces environment --- bin/setup-codespaces | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/setup-codespaces diff --git a/bin/setup-codespaces b/bin/setup-codespaces new file mode 100755 index 0000000000..2f8cdd826a --- /dev/null +++ b/bin/setup-codespaces @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +if [ -z "$ZSH_VERSION" ] && [ -z "$BASH_VERSION" ]; then + echo "This script must be sourced. Please run with 'source bin/setup-codespaces'." + exit 1; +fi + +rvm install $(cat .ruby-version) +rvm --default use $(cat .ruby-version) +ruby -v + +docker run -d -i --name postgres -p 5432:5432 -e POSTGRES_HOST_AUTH_METHOD=trust postgres +export DATABASE_URL=postgresql://postgres:@localhost + +# Create config/database.yml +./bin/setup +# Setup & Create .env +./bin/setup +RAILS_ENV=test bundle exec rake db:setup dev:prime + +echo "" >> .env && echo "DATABASE_URL=postgresql://postgres:@localhost" >> .env