From 091f1c63a70105fa5cf232185edf51d3e9cea70b Mon Sep 17 00:00:00 2001 From: dev-satoshi Date: Thu, 15 May 2025 12:11:04 +0900 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E3=82=BB=E3=83=83=E3=83=88=E3=82=A2?= =?UTF-8?q?=E3=83=83=E3=83=97=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/asdf_setup.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/asdf_setup.sh b/scripts/asdf_setup.sh index 0d19ed7..83cdb3b 100644 --- a/scripts/asdf_setup.sh +++ b/scripts/asdf_setup.sh @@ -3,15 +3,23 @@ set -euo pipefail echo "「ASDF」のセットアップを開始しました" -# プラグインを出力 -asdf plugin list --urls > ~/dotfiles/asdf/plugins.txt - # プラグインをインストール -while read -r name url; do - asdf plugin add "$name" "$url" || true +while IFS=$' \t' read -r name url; do + asdf plugin add "$name" "$url" >/dev/null 2>&1 || true done < ~/dotfiles/asdf/plugins.txt -# 一括インストール -asdf install +# .tool-versionsに書いてある全てのバージョンをインストール +while IFS= read -r line; do + # 空行スキップ + [[ -z "$line" ]] && continue + # 先頭の単語がプラグイン名、残りがバージョン一覧 + set -- $line + plugin=$1 + shift + for version in "$@"; do + echo "→ Installing $plugin $version" + asdf install "$plugin" "$version" + done +done < ~/dotfiles/asdf/.tool-versions echo "「ASDF」のセットアップが完了しました" From fa8fc1b8fbb5ccb91ba288101ff75ee242527541 Mon Sep 17 00:00:00 2001 From: dev-satoshi Date: Thu, 15 May 2025 12:11:22 +0900 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20=E5=B7=AE=E5=88=86=E3=82=92?= =?UTF-8?q?=E3=82=B3=E3=83=9F=E3=83=83=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asdf/.tool-versions | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/asdf/.tool-versions b/asdf/.tool-versions index 92efda0..5dd0340 100644 --- a/asdf/.tool-versions +++ b/asdf/.tool-versions @@ -1,10 +1,10 @@ -ruby 3.3.4 awscli 2.16.5 flutter 3.29.2-stable gradle 8.4 java openjdk-17.0.2 +kotlin 2.1.10 nodejs 20.12.2 pre-commit 3.7.1 -yarn 1.22.22 -kotlin 2.1.10 +ruby 3.3.4 rust 1.85.1 +yarn 1.22.22 From afe1d6491111707db605d81b33e596248453194b Mon Sep 17 00:00:00 2001 From: dev-satoshi Date: Thu, 15 May 2025 12:33:37 +0900 Subject: [PATCH 3/4] =?UTF-8?q?add:=20=E3=82=A2=E3=83=83=E3=83=97=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=83=88=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +++++ scripts/update/asdf_update.sh | 30 ++++++++++++++++++++++++++++++ scripts/update/update.sh | 10 ++++++++++ update.sh | 15 +++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 scripts/update/asdf_update.sh create mode 100644 scripts/update/update.sh create mode 100644 update.sh diff --git a/README.md b/README.md index fd4a197..1235b8d 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,8 @@ ``` $ curl -sL https://github.com/dev-satoshi/dotfiles/install.sh | sh ``` + +## Update +``` +$ curl -sL https://github.com/dev-satoshi/dotfiles/update.sh | sh +``` diff --git a/scripts/update/asdf_update.sh b/scripts/update/asdf_update.sh new file mode 100644 index 0000000..4c8da94 --- /dev/null +++ b/scripts/update/asdf_update.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env zsh +set -euo pipefail + +echo "「ASDF」のアップデートを開始しました" + +# プラグインを出力 +asdf plugin list --urls > "$HOME/dotfiles/asdf/plugins.txt" + +# 出力先ディレクトリがなければ作成 +mkdir -p "$HOME/dotfiles/asdf" + +# .tool-versionsを初期化 +> "$HOME/dotfiles/asdf/.tool-versions" + +# 各プラグインの全バージョンを取得して出力 +for plugin in $(asdf plugin list); do + # 空行はスキップ + [[ -z "$plugin" ]] && continue + + # バージョンリスト取得&整形(行頭の空白、*、空行を削除) + versions=$(asdf list "$plugin" 2>/dev/null \ + | sed -e 's/^[[:space:]]*\*\?[[:space:]]*//' -e '/^$/d') + + # それぞれのバージョンを.tool-versionsに出力 + for version in $versions; do + echo "$plugin $version" >> "$HOME/dotfiles/asdf/.tool-versions" + done +done + +echo "「ASDF」のアップデートが完了しました" diff --git a/scripts/update/update.sh b/scripts/update/update.sh new file mode 100644 index 0000000..a222f0b --- /dev/null +++ b/scripts/update/update.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env zsh +set -euo pipefail + +echo "「dotfiles」のアップデートを開始しました" + +INSTALL_DIR="$HOME/dotfiles" + +sh "$INSTALL_DIR/scripts/update/asdf_update.sh" + +echo "「dotfiles」のアップデートが完了しました" diff --git a/update.sh b/update.sh new file mode 100644 index 0000000..0c1aad4 --- /dev/null +++ b/update.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env zsh +set -euo pipefail + +INSTALL_DIR="$HOME/dotfiles" + +if [ ! -d "$INSTALL_DIR" ]; then + echo "dotfiles not found in $INSTALL_DIR" + echo "Please run 'install.sh' first." + exit 1 +fi + +echo "Updating dotfiles..." +git -C "$INSTALL_DIR" pull + +sh "$INSTALL_DIR/scripts/update/update.sh" From 69e703eed2a56352f8d2ad9f26ed45fbcbea52af Mon Sep 17 00:00:00 2001 From: dev-satoshi Date: Fri, 16 May 2025 16:12:19 +0900 Subject: [PATCH 4/4] fix: ci --- scripts/asdf_setup.sh | 3 ++- scripts/update/asdf_update.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) mode change 100644 => 100755 scripts/asdf_setup.sh diff --git a/scripts/asdf_setup.sh b/scripts/asdf_setup.sh old mode 100644 new mode 100755 index 83cdb3b..ca1afb3 --- a/scripts/asdf_setup.sh +++ b/scripts/asdf_setup.sh @@ -12,8 +12,9 @@ done < ~/dotfiles/asdf/plugins.txt while IFS= read -r line; do # 空行スキップ [[ -z "$line" ]] && continue + # 先頭の単語がプラグイン名、残りがバージョン一覧 - set -- $line + set -- "$line" plugin=$1 shift for version in "$@"; do diff --git a/scripts/update/asdf_update.sh b/scripts/update/asdf_update.sh index 4c8da94..0bd8f83 100644 --- a/scripts/update/asdf_update.sh +++ b/scripts/update/asdf_update.sh @@ -10,7 +10,7 @@ asdf plugin list --urls > "$HOME/dotfiles/asdf/plugins.txt" mkdir -p "$HOME/dotfiles/asdf" # .tool-versionsを初期化 -> "$HOME/dotfiles/asdf/.tool-versions" +: > "$HOME/dotfiles/asdf/.tool-versions" # 各プラグインの全バージョンを取得して出力 for plugin in $(asdf plugin list); do