feat: 更新 deploy.sh 脚本以支持 macOS 和多种 Linux 发行版,删除无用的测试文件

This commit is contained in:
vastxie 2024-12-19 10:30:37 +08:00
parent cb3e983620
commit cf7dc1d1e7
3 changed files with 27 additions and 43 deletions

View File

@ -31,26 +31,46 @@ check_cpu_arch() {
} }
check_os() { check_os() {
# 检测 macOS
if [[ "$(uname)" == "Darwin" ]]; then if [[ "$(uname)" == "Darwin" ]]; then
os_name="macOS" os_name="macOS"
InstallMethod="brew" InstallMethod="brew"
# 检测 Linux 系统
else else
if command -v lsb_release >/dev/null; then if command -v lsb_release >/dev/null; then
DISTRO=$(lsb_release -i -s) DISTRO=$(lsb_release -i -s)
else else
DISTRO=$(grep -oP '^ID=\K.*' /etc/*-release) DISTRO=$(grep -oP '^ID=\K.*' /etc/*-release)
fi fi
case "$DISTRO" in case "$DISTRO" in
Debian|Ubuntu) os_name="${DISTRO}-based Linux"; InstallMethod="sudo apt-get" ;; Debian|Ubuntu)
os_name="${DISTRO}-based Linux"
InstallMethod="sudo apt-get"
;;
centos) centos)
# 区分 CentOS 7 和 CentOS 8
if [[ "$(grep -oP '^VERSION_ID="\K[0-9]+' /etc/*-release)" == "7" ]]; then if [[ "$(grep -oP '^VERSION_ID="\K[0-9]+' /etc/*-release)" == "7" ]]; then
os_name="CentOS 7"; InstallMethod="yum" os_name="CentOS 7"
InstallMethod="yum"
else else
os_name="CentOS 8"; InstallMethod="dnf" os_name="CentOS 8"
fi ;; InstallMethod="dnf"
fedora) os_name="Fedora"; InstallMethod="dnf" ;; fi
opensuse-leap) os_name="openSUSE Leap"; InstallMethod="sudo zypper" ;; ;;
*) echo "未知操作系统,脚本不支持"; exit 1 ;; fedora)
os_name="Fedora"
InstallMethod="dnf"
;;
opensuse-leap)
os_name="openSUSE Leap"
InstallMethod="sudo zypper"
;;
*)
echo "未知操作系统,脚本不支持"
exit 1
;;
esac esac
fi fi
} }

View File

@ -1,18 +0,0 @@
import { Test, TestingModule } from '@nestjs/testing';
import { OrderController } from './order.controller';
describe('OrderController', () => {
let controller: OrderController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [OrderController],
}).compile();
controller = module.get<OrderController>(OrderController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});

View File

@ -1,18 +0,0 @@
import { Test, TestingModule } from '@nestjs/testing';
import { OrderService } from './order.service';
describe('OrderService', () => {
let service: OrderService;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [OrderService],
}).compile();
service = module.get<OrderService>(OrderService);
});
it('should be defined', () => {
expect(service).toBeDefined();
});
});