diff --git a/.bashrc b/.bashrc index 76567cc1..f478b5a7 100644 --- a/.bashrc +++ b/.bashrc @@ -187,6 +187,8 @@ if [[ $(command -v git) ]]; then alias gl='git log --oneline' alias gbm='git branch --merged' alias gbm-all='git branch --merged|egrep -v "\*|develop|main"|xargs git branch' # -d で削除, -D で完全削除 + alias gchp='git cherry-pick' + alias gnewb='git new-feature-branch' fi # anyenv @@ -206,7 +208,7 @@ fi if [[ $(command -v brew) ]]; then if [ "$(brew list | grep -c "^fzf@*.*$")" -gt 0 ]; then # shellcheck source=/dev/null - [ -f "$HOME/.fzf.bash" ] && . $HOME/.fzf.bash + [ -f "$HOME/.fzf.bash" ] && . "$HOME/.fzf.bash" fi fi diff --git a/.gitconfig b/.gitconfig index 4de731ad..2d27dce1 100644 --- a/.gitconfig +++ b/.gitconfig @@ -11,3 +11,5 @@ tool = default-difftool [difftool "default-difftool"] cmd = code --wait --diff $LOCAL $REMOTE +[alias] + new-feature = "!f() { \\\n TITLE=\"$1\"; \\\n DATE=$(date +%Y%m%d); \\\n git checkout main && \\\n git fetch origin -p && \\\n git reset --hard origin/main && \\\n git checkout -b \"feature/${TITLE}-${DATE}\"; \\\n}; f" diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..9298fe5f --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,3 @@ +# global owners + +* @tqer39 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..1eb484d5 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,3 @@ +# About + +SSIA diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml new file mode 100644 index 00000000..a1fd978f --- /dev/null +++ b/.github/auto_assign.yml @@ -0,0 +1,2 @@ +--- +addAssignees: author diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml new file mode 100644 index 00000000..ac74170a --- /dev/null +++ b/.github/workflows/auto-assign.yml @@ -0,0 +1,20 @@ +--- +name: Auto Assign + +on: + pull_request: + types: [opened, ready_for_review] + +jobs: + add-reviews: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + timeout-minutes: 2 + steps: + - name: Auto Assign + uses: kentaro-m/auto-assign-action@v1.2.5 + if: ${{ github.event.pull_request.assignee == null && join(github.event.pull_request.assignees) == '' }} + with: + configuration-path: .github/auto_assign.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..7e517990 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,24 @@ +--- +name: pre-commit + +on: + push: + branches: + - main + pull_request: + +jobs: + pre-commit: + name: pre-commit + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: pre-commit + uses: pre-commit/action@v3.0.0 + with: + extra_args: -a --show-diff-on-failure diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..958a3dfa --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,65 @@ +--- +# see https://pre-commit.com + +exclude: | + (?x)^( + .+/package.*.json + )$ + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-added-large-files + args: ['--maxkb=512'] + - id: check-json + - id: check-yaml + - id: detect-aws-credentials + args: [--allow-missing-credentials] + - id: detect-private-key + - id: end-of-file-fixer + - id: mixed-line-ending + args: ['--fix=lf'] + - id: trailing-whitespace + + - repo: https://github.com/streetsidesoftware/cspell-cli + rev: v6.31.0 + hooks: + - id: cspell + + - repo: local + hooks: + - id: textlint + name: textlint + language: node + types: [file] + files: \.(txt|md|mdown|markdown)$ + entry: textlint + require_serial: false + additional_dependencies: + - 'textlint@12.2.1' + - 'textlint-filter-rule-allowlist@4.0.0' + - 'textlint-rule-ja-no-space-between-full-width@2.2.0' + - 'textlint-filter-rule-comments@1.2.2' + - 'textlint-rule-no-dropping-the-ra@3.0.0' + - 'textlint-rule-terminology@3.0.1' + + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.9.0 + hooks: + - id: shellcheck + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.0.2 + hooks: + - id: prettier + name: Format GitHub Actions workflow files + types: + - yaml + - json + + - repo: https://github.com/renovatebot/pre-commit-hooks + rev: 36.51.2 + hooks: + - id: renovate-config-validator + files: renovate\.json diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..1e008ed4 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +**/.git/ +**/tmp/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..fa9699b8 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "trailingComma": "all", + "singleQuote": true, + "printWidth": 80, + "tabWidth": 2 +} diff --git a/.textlintignore b/.textlintignore new file mode 100644 index 00000000..8fba60d9 --- /dev/null +++ b/.textlintignore @@ -0,0 +1,10 @@ +.editorconfig +.git/ +.github/ +.gitignore +.pre-commit-config.yaml +.textlintcache +.yamllint.yml +cspell.json +renovate.json +tmp/ diff --git a/.textlintrc b/.textlintrc new file mode 100644 index 00000000..1308f0db --- /dev/null +++ b/.textlintrc @@ -0,0 +1,10 @@ +{ + "filters": { + "comments": true + }, + "rules": { + "no-dropping-the-ra": true, + "textlint-rule-ja-no-space-between-full-width": true, + "textlint-rule-no-dropping-the-ra": true + } +} diff --git a/.zshrc b/.zshrc index 21c2d4a1..8adbc32b 100644 --- a/.zshrc +++ b/.zshrc @@ -57,17 +57,6 @@ is_macos() { fi } -# Ubuntuを判定する関数 -is_ubuntu() { - if [ -f /etc/os-release ]; then - . /etc/os-release - if [ "$ID" = "ubuntu" ]; then - return 0 # 成功(真) - fi - fi - return 1 # 失敗(偽) -} - # その他のLinuxディストリビューションを判定する関数 is_linux() { if [ "$(uname)" = "Linux" ]; then @@ -77,14 +66,6 @@ is_linux() { fi } -# ubuntu なら実行する -if [[ is_ubuntu ]]; then - alias update='sudo apt update && sudo apt upgrade -y' - alias install='sudo apt install' - alias remove='sudo apt remove' - alias search='apt search' -fi - # ------------------------------------------------------------------------------ # \shellcheck # ------------------------------------------------------------------------------ @@ -172,6 +153,8 @@ if [[ $(command -v git) ]]; then alias gl='git log --oneline' alias gbm='git branch --merged' alias gbm-all='git branch --merged|egrep -v "\*|develop|main"|xargs git branch' # -d で削除, -D で完全削除 + alias gchp='git cherry-pick' + alias gnewb='git new-feature-branch' fi # anyenv diff --git a/README.md b/README.md index 703b1256..b4185af2 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,40 @@ This repository contains a shell script for provisioning a local development env curl -sL https://setup.tqer39.dev | bash ``` +## High-Level Architecture + +1. Acquire the `tqer39.dev` domain on Google Cloud Platform (GCP) Cloud Domains +2. Define the `tqer39.dev` domain in Cloudflare + 1. SSL/TLS is automatically issued + 2. Issue an NS record and set it in Cloud Domains +3. Add rules to Cloudflare and redirect to `setup` when accessing `https://setup.tqer39.dev/*` +4. When accessing `https://setup.tqer39.dev` with cURL, the `setup.sh` in this repository is loaded as plain text and executed with bash + +### Sequence Diagram + +```mermaid +sequenceDiagram + participant User + participant Cloudflare + participant CloudDomains + participant GitHub + participant GCP + participant setup.tqer39.dev + participant bash + + User->>Cloudflare: https://setup.tqer39.dev + Cloudflare->>Cloudflare: Add rules + Cloudflare->>setup.tqer39.dev: Redirect + setup.tqer39.dev->>GitHub: setup.sh + GitHub->>setup.tqer39.dev: setup.sh + setup.tqer39.dev->>bash: setup.sh + bash->>CloudDomains: Acquire + CloudDomains->>Cloudflare: Define + Cloudflare->>Cloudflare: SSL/TLS + Cloudflare->>Cloudflare: NS record + Cloudflare->>User: Complete +``` + ## Setup Contents ### Installed Software diff --git a/cspell.json b/cspell.json new file mode 100644 index 00000000..5428dea2 --- /dev/null +++ b/cspell.json @@ -0,0 +1,91 @@ +{ + "$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json", + "files": [ + "**", + ".*/**" + ], + "ignorePaths": [ + ".git", + ".gitignore" + ], + "words": [ + "aahl", + "anyenv", + "apdisk", + "autoload", + "automerge", + "awscli", + "checkwinsize", + "chsh", + "Consolas", + "dearmor", + "deskpad", + "difftool", + "dircolors", + "direnv", + "donotpresent", + "dpkg", + "ehthumbs", + "elif", + "encryptable", + "esktop", + "EUID", + "fgrep", + "fseventsd", + "gchp", + "gnewb", + "GOPATH", + "gpso", + "gsts", + "gstt", + "gswc", + "hackgen", + "HACKGEN", + "histappend", + "hyperpower", + "icns", + "ignoredups", + "ignorespace", + "kentaro", + "keymaps", + "Keymaps", + "keyrings", + "lesspipe", + "libcrypt", + "libnotify", + "linuxbrew", + "Lucida", + "Menlo", + "msix", + "nodenv", + "oneline", + "pcra", + "pyenv", + "rxvt", + "SAVEHIST", + "schelp", + "setaf", + "setf", + "setopt", + "shellcheck", + "shellenv", + "shlvl", + "spctl", + "SSIA", + "stackdump", + "statusline", + "textlint", + "textlintcache", + "tfaa", + "tfenv", + "tfsl", + "timemachine", + "tqer", + "vdir", + "xclip", + "xsel", + "ZDHARMA", + "zinit", + "Zinit's" + ] +} diff --git a/docs/README.ja.md b/docs/README.ja.md index 9f21a587..4edfebca 100644 --- a/docs/README.ja.md +++ b/docs/README.ja.md @@ -8,6 +8,41 @@ curl -sL https://setup.tqer39.dev | bash ``` +## ハイレベルアーキテクチャ + +1. Google Cloud Platform (GCP) の Cloud Domains で `tqer39.dev` のドメインを取得 +2. Cloudflare で tqer39.dev のドメインを定義 + 1. SSL/TLS が自動的に発行される + 2. NS レコードを発行して Cloud Domains に設定 +3. Cloudflare のルールを追加し、`https://setup.tqer39.dev/*` へアクセスすると `setup` へリダイレクトさせる +4. cURL で `https://setup.tqer39.dev` へアクセスすると、このリポジトリの `setup.sh` プレーンテキストで読み込まれ、bash で実行される + +### シーケンス図 + +```mermaid +sequenceDiagram + participant User + participant Cloudflare + participant CloudDomains + participant GitHub + participant GCP + participant setup.tqer39.dev + participant bash + + User->>Cloudflare: https://setup.tqer39.dev + Cloudflare->>Cloudflare: ルール追加 + Cloudflare->>setup.tqer39.dev: リダイレクト + setup.tqer39.dev->>GitHub: setup.sh + GitHub->>setup.tqer39.dev: setup.sh + setup.tqer39.dev->>bash: setup.sh + bash->>CloudDomains: 取得 + CloudDomains->>Cloudflare: 定義 + Cloudflare->>Cloudflare: SSL/TLS + Cloudflare->>Cloudflare: NS レコード + Cloudflare->>User: 完了 +``` + + ## セットアップ内容 ### インストールされるソフトウェア diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..cb702b1c --- /dev/null +++ b/renovate.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": ["github>tqer39/renovate-config"], + "automergeStrategy": "squash" +} diff --git a/scripts/generate_pr_description.py b/scripts/generate_pr_description.py index 96ddc391..39098f19 100644 --- a/scripts/generate_pr_description.py +++ b/scripts/generate_pr_description.py @@ -17,8 +17,20 @@ def create_prompt(commit_logs): return f""" ## 指示内容 - - 以下のコミットログとファイルの差分を読んで、わかりやすいプルリクエストのタイトルと詳細な説明を日本語で作成してください。 - - Markdown 形式で記述してください。ただし出力内容の1行目は例外です。`# ` などは不要です。 + - 以下のコミットログとファイルの差分を読んで、理解し易いプルリクエストのタイトルと詳細な説明を日本語で作成してください。 + - Markdown 形式で記述してください。 + - ただし出力内容の1行目は例外です。`# ` などは不要です。 + - ファイル名はバッククオートで囲んでください。 + - https://github.com/orgs/community/discussions/16925 を参考にしてください。 + - 内容に応じて NOTE, TIPS, IMPORTANT, WARNING, CAUTION を使用してください。 + + 例: + ``` + > [!WARNING] + > + > - 💣 breaking change が含まれています。注意してください。 + ``` + - プルリクエストのタイトル - タイトルの冒頭には総合的に適した emoji をつけてください。 - 1行目に出力してください。2行目以降がプルリクエストの説明です。 @@ -26,8 +38,10 @@ def create_prompt(commit_logs): - コミットログとファイルを読んで、変更点の概要と技術的な詳細や注意点を記述してください。 - なければ項目ごと出力しないでください。 - 嘘を書かないでください。 - - リストで表現する場合はそのリストの項目の先頭に適切な emoji をつけてください。 - - https://github.com/orgs/community/discussions/16925 を参考に必要に応じて NOTE, TIPS, IMPORTANT, WARNING, CAUTION を使用してください。 + - 変更点の概要 + - 概要を簡潔に説明する。 + - 技術的な詳細や注意点 + - 各項目の先頭に適切な emoji をつけてください。 ## コミットログとファイルの差分 @@ -37,11 +51,11 @@ def create_prompt(commit_logs): プルリクエストのタイトル - ## 変更点の概要 + ## 📓 変更点の概要 - - 概要の説明 + - 概要を簡潔に説明する。 - ## 技術的な詳細や注意点 + ## ⚒ 技術的な詳細や注意点 - 詳細な説明A - 詳細な説明B diff --git a/setup b/setup index bca501d7..0c5058dd 100755 --- a/setup +++ b/setup @@ -71,7 +71,7 @@ install_if_missing() { # curl のインストール確認 if [[ "$OS_TYPE" == "Linux" ]]; then if [[ "$PACKAGE_MANAGER" == "apt" || "$PACKAGE_MANAGER" == "apt-get" ]]; then - install_if_missing "curl" "$SUDO $PACKAGE_MANAGER update && $SUDO $PACKAGE_MANAGER install -y curl" + install_if_missing "curl" "${SUDO} ${PACKAGE_MANAGER} update && ${SUDO} ${PACKAGE_MANAGER} install -y curl" elif [[ "$PACKAGE_MANAGER" == "yum" ]]; then install_if_missing "curl" "$SUDO yum install -y curl" fi @@ -83,7 +83,7 @@ fi if [[ "$OS_TYPE" == "Linux" ]]; then if ! command -v pbcopy &> /dev/null; then if [[ "$PACKAGE_MANAGER" == "apt" || "$PACKAGE_MANAGER" == "apt-get" ]]; then - $SUDO $PACKAGE_MANAGER install -y xsel + $SUDO "$PACKAGE_MANAGER" install -y xsel elif [[ "$PACKAGE_MANAGER" == "yum" ]]; then $SUDO yum install xclip fi @@ -117,8 +117,8 @@ if ! command -v brew &> /dev/null; then if [[ "$OS_TYPE" == "Linux" ]]; then # Linuxbrew の場合、ビルドに必要なパッケージをインストール if [[ "$PACKAGE_MANAGER" == "apt" || "$PACKAGE_MANAGER" == "apt-get" ]]; then - $SUDO $PACKAGE_MANAGER update - $SUDO $PACKAGE_MANAGER install -y build-essential + $SUDO "$PACKAGE_MANAGER" update + $SUDO "$PACKAGE_MANAGER" install -y build-essential elif [[ "$PACKAGE_MANAGER" == "yum" ]]; then $SUDO yum install -y gcc make fi @@ -132,7 +132,7 @@ fi if ! command -v git &> /dev/null; then if [[ "$OS_TYPE" == "Linux" ]]; then if [[ "$PACKAGE_MANAGER" == "apt" || "$PACKAGE_MANAGER" == "apt-get" ]]; then - install_if_missing "git" "$SUDO $PACKAGE_MANAGER update && $SUDO $PACKAGE_MANAGER install -y git" + install_if_missing "git" "${SUDO} ${PACKAGE_MANAGER} update && ${SUDO} ${PACKAGE_MANAGER} install -y git" elif [[ "$PACKAGE_MANAGER" == "yum" ]]; then install_if_missing "git" "$SUDO yum install -y git" fi @@ -172,8 +172,7 @@ if [ "$CI" == "true" ]; then else if [ ! -d "$WORKSPACE" ]; then echo "${REPO_NAME} を ${WORKSPACE} にクローンします..." - git clone "$REPO_URL" "$WORKSPACE" - if [ $? -ne 0 ]; then + if ! git clone "$REPO_URL" "$WORKSPACE"; then echo "❌ リポジトリのクローンに失敗しました。" exit 1 fi @@ -201,15 +200,14 @@ DOTFILES=( ) for file in "${DOTFILES[@]}"; do - if [ $CI == "true" ]; then + if [ "$CI" == "true" ]; then source_file="$WORKSPACE/$file" else source_file="$WORKSPACE/$REPO_NAME/$file" fi target_file="$HOME/$file" if [ -e "$source_file" ]; then - ln -sf "$source_file" "$target_file" - if [ $? -eq 0 ]; then + if ln -sf "$source_file" "$target_file"; then echo "✅ シンボリックリンクを作成しました: $target_file" else echo "❌ シンボリックリンクの作成に失敗しました: $target_file" @@ -372,8 +370,8 @@ if ! command -v code &> /dev/null; then curl https://packages.microsoft.com/keys/microsoft.asc | $SUDO gpg --dearmor -o /usr/share/keyrings/packages.microsoft.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/packages.microsoft.gpg] \ https://packages.microsoft.com/repos/code stable main" | $SUDO tee /etc/apt/sources.list.d/vscode.list - $SUDO $PACKAGE_MANAGER update - $SUDO $PACKAGE_MANAGER install -y code + $SUDO "$PACKAGE_MANAGER" update + $SUDO "$PACKAGE_MANAGER" install -y code elif [[ "$PACKAGE_MANAGER" == "yum" ]]; then rpm --import https://packages.microsoft.com/keys/microsoft.asc $SUDO sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' @@ -401,17 +399,17 @@ if ! command -v hyper &> /dev/null; then if [[ "$OS_TYPE" == "Linux" ]]; then if [[ "$PACKAGE_MANAGER" == "apt" || "$PACKAGE_MANAGER" == "apt-get" ]]; then # 依存パッケージのインストール - $SUDO $PACKAGE_MANAGER update - $SUDO $PACKAGE_MANAGER install -y libnotify4 + $SUDO "$PACKAGE_MANAGER" update + $SUDO "$PACKAGE_MANAGER" install -y libnotify4 # Hyper.js のインストール if [ -z "$DL_PATH" ]; then DL_PATH="$HOME/Downloads" fi - if [ $CI != "true" ]; then - wget -P $DL_PATH https://releases.hyper.is/download/deb + if [ "$CI" != "true" ]; then + wget -P "$DL_PATH" https://releases.hyper.is/download/deb fi $SUDO dpkg -i "${DL_PATH}/deb" - if [ $CI != "true" ]; then + if [ "$CI" != "true" ]; then rm -rf "${DL_PATH}/deb" fi else @@ -440,8 +438,8 @@ if ! command -v rancher-desktop &> /dev/null; then if [[ "$PACKAGE_MANAGER" == "apt" || "$PACKAGE_MANAGER" == "apt-get" ]]; then curl -fsSL https://download.opensuse.org/repositories/isv:/Rancher:/stable/deb/Release.key | $SUDO gpg --dearmor -o /usr/share/keyrings/rancher-desktop-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/rancher-desktop-keyring.gpg] https://download.opensuse.org/repositories/isv:/Rancher:/stable/deb/ /" | $SUDO tee /etc/apt/sources.list.d/rancher-desktop.list - $SUDO $PACKAGE_MANAGER update - $SUDO $PACKAGE_MANAGER install -y rancher-desktop + $SUDO "$PACKAGE_MANAGER" update + $SUDO "$PACKAGE_MANAGER" install -y rancher-desktop elif [[ "$PACKAGE_MANAGER" == "yum" ]]; then $SUDO curl -fsSL https://download.opensuse.org/repositories/isv:Rancher:stable/rpm.repo -o /etc/yum.repos.d/rancher-desktop.repo $SUDO yum install -y rancher-desktop @@ -468,8 +466,8 @@ if ! command -v google-chrome &> /dev/null; then if [[ "$PACKAGE_MANAGER" == "apt" || "$PACKAGE_MANAGER" == "apt-get" ]]; then curl -fsSL https://dl.google.com/linux/linux_signing_key.pub | $SUDO gpg --dearmor -o /usr/share/keyrings/google-linux-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/google-linux-keyring.gpg] http://dl.google.com/linux/chrome/deb/ stable main" | $SUDO tee /etc/apt/sources.list.d/google-chrome.list - $SUDO $PACKAGE_MANAGER update - $SUDO $PACKAGE_MANAGER install -y google-chrome-stable + $SUDO "$PACKAGE_MANAGER" update + $SUDO "$PACKAGE_MANAGER" install -y google-chrome-stable elif [[ "$PACKAGE_MANAGER" == "yum" ]]; then $SUDO sh -c 'echo -e "[google-chrome]\nname=Google Chrome\nbaseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64\nenabled=1\ngpgcheck=1\ngpgkey=https://dl.google.com/linux/linux_signing_key.pub" > /etc/yum.repos.d/google-chrome.repo' $SUDO yum check-update @@ -512,10 +510,10 @@ if ! command -v brave-browser &> /dev/null; then https://brave-browser-apt-release.s3.brave.com/ stable main" | $SUDO tee /etc/apt/sources.list.d/brave-browser-release.list # パッケージリストを更新 - $SUDO $PACKAGE_MANAGER update + $SUDO "$PACKAGE_MANAGER" update # Brave ブラウザをインストール - $SUDO $PACKAGE_MANAGER install -y brave-browser + $SUDO "$PACKAGE_MANAGER" install -y brave-browser elif [[ "$PACKAGE_MANAGER" == "yum" ]]; then $SUDO dnf install dnf-plugins-core $SUDO dnf config-manager --add-repo https://brave-browser-rpm-release.s3.brave.com/x86_64/ @@ -554,8 +552,8 @@ if ! command -v 1password &> /dev/null; then if [[ "$PACKAGE_MANAGER" == "apt" || "$PACKAGE_MANAGER" == "apt-get" ]]; then curl -sS https://downloads.1password.com/linux/keys/1password.asc | $SUDO apt-key add - echo 'deb [arch=amd64] https://downloads.1password.com/linux/debian/amd64 stable main' | $SUDO tee /etc/apt/sources.list.d/1password.list - $SUDO $PACKAGE_MANAGER update - $SUDO $PACKAGE_MANAGER install -y 1password + $SUDO "$PACKAGE_MANAGER" update + $SUDO "$PACKAGE_MANAGER" install -y 1password elif [[ "$PACKAGE_MANAGER" == "yum" ]]; then curl -sS https://downloads.1password.com/linux/keys/1password.asc | $SUDO rpm --import - $SUDO sh -c 'echo -e "[1password]\nname=1Password\nbaseurl=https://downloads.1password.com/linux/rpm\nenabled=1\ngpgcheck=1\ngpgkey=https://downloads.1password.com/linux/keys/1password.asc" > /etc/yum.repos.d/1password.repo' @@ -640,9 +638,7 @@ elif [[ "$OS_TYPE" == "Darwin" ]]; then echo "✅ HackGenNerd Font は既にインストールされています。" else echo "HackGenNerd Font がインストールされていません。インストールを試みます。" - brew install --cask font-hackgen-nerd - - if [ "$?" -eq 0 ]; then + if brew install --cask font-hackgen-nerd; then echo "✅ HackGenNerd Font が正常にインストールされました。" else echo "❌ HackGenNerd Font のインストールに失敗しました。" @@ -668,14 +664,14 @@ if [[ "$OS_TYPE" == "Darwin" ]]; then fi # ローカル専用の utility のインストール -if [ $CI != "true" ]; then +if [ "$CI" != "true" ]; then echo "ローカル専用の utility をインストールします..." if [[ "$OS_TYPE" == "Linux" ]]; then if [[ "$PACKAGE_MANAGER" == "apt" || "$PACKAGE_MANAGER" == "apt-get" ]]; then # pyenv install 3.12.1 で必要なパッケージ echo "pyenv install 3.12.1 で必要なパッケージをインストールします..." - $SUDO $PACKAGE_MANAGER update - $SUDO $PACKAGE_MANAGER install -y libcrypt-dev + $SUDO "$PACKAGE_MANAGER" update + $SUDO "$PACKAGE_MANAGER" install -y libcrypt-dev brew install tcl-tk # uv echo "uv をインストールします..."