Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions bin/setup-codespaces
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is setup running twice by accident or on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's on purpose. The first execution always stops at this point, so a second execution is necessary.
https://github.com/thoughtbot/administrate/blob/main/bin/setup#L12

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, of course. Thank you. How about a comment to remove the confusion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added comments!

RAILS_ENV=test bundle exec rake db:setup dev:prime

echo "" >> .env && echo "DATABASE_URL=postgresql://postgres:@localhost" >> .env