-
-
Notifications
You must be signed in to change notification settings - Fork 168
Expand file tree
/
Copy pathsetup_bundle_optimization
More file actions
executable file
·123 lines (111 loc) · 3.44 KB
/
Copy pathsetup_bundle_optimization
File metadata and controls
executable file
·123 lines (111 loc) · 3.44 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env bash
set -e
echo "=== Bundle Install Performance Optimization Setup ==="
echo
# Check if we're on a supported system
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "📦 Installing system dependencies for faster native gem compilation..."
# Check for package manager
if command -v apt-get &> /dev/null; then
echo " Using apt-get (Ubuntu/Debian)..."
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
pkg-config \
libmysqlclient-dev \
libxml2-dev \
libxslt1-dev \
libffi-dev \
libssl-dev \
zlib1g-dev \
libyaml-dev \
libreadline-dev \
libncurses5-dev \
libgdbm-dev \
libdb-dev \
libpcre3-dev \
gettext
elif command -v yum &> /dev/null; then
echo " Using yum (CentOS/RHEL)..."
sudo yum groupinstall -y "Development Tools"
sudo yum install -y \
cmake \
mysql-devel \
libxml2-devel \
libxslt-devel \
libffi-devel \
openssl-devel \
zlib-devel \
libyaml-devel \
readline-devel \
ncurses-devel \
gdbm-devel \
db-devel \
pcre-devel \
gettext
else
echo " ⚠️ Unknown package manager. Please install build tools manually."
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "📦 Installing system dependencies for macOS..."
# Check if Homebrew is installed
if command -v brew &> /dev/null; then
echo " Using Homebrew..."
brew install \
cmake \
pkg-config \
mysql-client \
libxml2 \
libxslt \
libffi \
openssl \
zlib \
libyaml \
readline \
ncurses \
gdbm \
pcre \
gettext
else
echo " ⚠️ Homebrew not found. Please install Xcode command line tools:"
echo " xcode-select --install"
fi
else
echo " ⚠️ Unsupported OS: $OSTYPE"
echo " Please install build tools manually."
fi
echo
echo "⚙️ Configuring bundle for optimal performance..."
# Detect number of CPU cores
if command -v nproc &> /dev/null; then
CORES=$(nproc)
elif command -v sysctl &> /dev/null; then
CORES=$(sysctl -n hw.ncpu)
else
CORES=4
fi
echo " Detected $CORES CPU cores, setting bundle jobs to $CORES"
# Configure bundle
bundle config set --local jobs $CORES
bundle config set --local retry 3
bundle config set --local path 'vendor/bundle'
bundle config set --local without 'production'
bundle config set --local cache_all true
echo " ✅ Bundle configuration optimized!"
echo
echo "📊 Bundle configuration:"
bundle config list
echo
echo "🚀 Ready to install gems with optimized settings!"
echo " Run: bundle install"
echo
echo "💡 Tips:"
echo " - First install will take time to compile native extensions"
echo " - Subsequent installs will be much faster due to caching"
echo " - Add 'vendor/bundle' to your .gitignore (already done)"
echo
echo "⏱️ Expected performance improvements:"
echo " - ~75% faster due to parallel installation"
echo " - ~90% faster on subsequent installs due to caching"
echo " - Faster native extension compilation with system packages"