forked from niphy/niphy.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_ruby_jekyll.sh
More file actions
53 lines (40 loc) · 1.3 KB
/
Copy pathinstall_ruby_jekyll.sh
File metadata and controls
53 lines (40 loc) · 1.3 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
#!/bin/bash
echo "🚀 安装Ruby和Jekyll环境..."
# 检查系统类型
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
echo "📦 检测到Linux系统,使用apt安装..."
# 更新包管理器
sudo apt-get update
# 安装Ruby和相关依赖
echo "📦 安装Ruby和相关依赖..."
sudo apt-get install -y ruby-full build-essential zlib1g-dev
# 安装Bundler
echo "📦 安装Bundler..."
sudo gem install bundler
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "🍎 检测到macOS系统,使用Homebrew安装..."
# 检查是否安装了Homebrew
if ! command -v brew &> /dev/null; then
echo "📦 安装Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# 安装Ruby
echo "📦 安装Ruby..."
brew install ruby
# 添加到PATH
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# 安装Bundler
echo "📦 安装Bundler..."
gem install bundler
else
echo "❌ 不支持的操作系统: $OSTYPE"
exit 1
fi
# 验证安装
echo "✅ 验证安装..."
ruby --version
gem --version
bundle --version
echo "🎉 Ruby和Jekyll环境安装完成!"
echo "💡 现在可以运行: bundle install"