forked from biniyam69/flexile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup
More file actions
executable file
·55 lines (42 loc) · 1.48 KB
/
Copy pathsetup
File metadata and controls
executable file
·55 lines (42 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -e
function install_if_missing() {
local cmd=$1
local name=$2
local install_cmd=$3
if command -v "$cmd" &> /dev/null; then
return 0
fi
read -p "Would you like to install $name? (y/N) " answer
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
eval "$install_cmd"
return 0
fi
return 1
}
echo "🚀 Setting up development environment..."
if install_if_missing "brew" "Homebrew" "curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash"; then
brew install postgresql
brew services start postgresql
psql -c "CREATE USER username WITH LOGIN SUPERUSER PASSWORD 'password';" || true
else
read -p "Please make sure PostgreSQL headers are installed before continuing."
fi
if install_if_missing "ruby" "Ruby using rbenv" "curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash"; then
rbenv install -s $(cat .ruby-version)
else
read -p "Please make sure Ruby is installed before continuing."
fi
corepack enable
if [ ! -f ".env" ]; then
read -p "Would you like to pull environment variables from Vercel? (y/N) " answer
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
pnpx vercel link && pnpx vercel env pull .env
else
cp .env.example .env
echo "A sample .env file has been created. Please fill it in with your own keys."
fi
fi
ln -sf $PWD/.env ./frontend/.env
gem install foreman
echo "✨ Setup complete! You can now start the development server."