Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
6 changes: 3 additions & 3 deletions asdf/.tool-versions
Original file line number Diff line number Diff line change
@@ -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
23 changes: 16 additions & 7 deletions scripts/asdf_setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@ 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」のセットアップが完了しました"
30 changes: 30 additions & 0 deletions scripts/update/asdf_update.sh
Original file line number Diff line number Diff line change
@@ -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」のアップデートが完了しました"
10 changes: 10 additions & 0 deletions scripts/update/update.sh
Original file line number Diff line number Diff line change
@@ -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」のアップデートが完了しました"
15 changes: 15 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -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"