-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·76 lines (63 loc) · 2.43 KB
/
install.sh
File metadata and controls
executable file
·76 lines (63 loc) · 2.43 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Rails Docker Generator Installer
# Usage: curl -fsSL https://raw.githubusercontent.com/x1wins/rails-new-with-docker-compose/main/install.sh | bash
set -e
INSTALL_DIR="$HOME/.rails-docker-gen"
BIN_DIR="$HOME/.local/bin"
REPO_URL="https://raw.githubusercontent.com/x1wins/rails-new-with-docker-compose/main"
echo "🚀 Installing Rails Docker Generator..."
# Check for Docker
if ! command -v docker &> /dev/null; then
echo "❌ Error: Docker is not installed"
echo ""
echo "Please install Docker first:"
echo " macOS: https://docs.docker.com/desktop/install/mac-install/"
echo " Linux: https://docs.docker.com/engine/install/"
echo " Windows: https://docs.docker.com/desktop/install/windows-install/"
exit 1
fi
# Check for Docker Compose
if ! docker compose version &> /dev/null && ! command -v docker-compose &> /dev/null; then
echo "❌ Error: Docker Compose is not installed"
echo ""
echo "Docker Compose is usually included with Docker Desktop."
echo "If using Docker Engine, install it separately:"
echo " https://docs.docker.com/compose/install/"
exit 1
fi
# Check if Docker daemon is running
if ! docker info &> /dev/null; then
echo "⚠️ Warning: Docker daemon is not running"
echo "Please start Docker and try again"
exit 1
fi
echo "✅ Docker and Docker Compose found"
# Create directories
mkdir -p "$INSTALL_DIR"
mkdir -p "$BIN_DIR"
mkdir -p "$INSTALL_DIR/config"
# Download files
echo "📦 Downloading files..."
curl -fsSL "$REPO_URL/generate_rails_project.sh" -o "$INSTALL_DIR/generate_rails_project.sh"
curl -fsSL "$REPO_URL/Dockerfile" -o "$INSTALL_DIR/Dockerfile"
curl -fsSL "$REPO_URL/docker-compose.yml" -o "$INSTALL_DIR/docker-compose.yml"
curl -fsSL "$REPO_URL/entrypoint.sh" -o "$INSTALL_DIR/entrypoint.sh"
curl -fsSL "$REPO_URL/Gemfile" -o "$INSTALL_DIR/Gemfile"
curl -fsSL "$REPO_URL/Gemfile.lock" -o "$INSTALL_DIR/Gemfile.lock"
curl -fsSL "$REPO_URL/config/database.yml" -o "$INSTALL_DIR/config/database.yml"
chmod +x "$INSTALL_DIR/generate_rails_project.sh"
# Create wrapper script
cat > "$BIN_DIR/rails-docker-gen" << 'EOF'
#!/bin/bash
CURRENT_DIR="$(pwd)"
cd "$HOME/.rails-docker-gen"
./generate_rails_project.sh "$1" "$CURRENT_DIR"
EOF
chmod +x "$BIN_DIR/rails-docker-gen"
echo "✅ Installation complete!"
echo ""
echo "Add to your PATH if not already:"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo ""
echo "Usage:"
echo " rails-docker-gen my-project"