-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfd37bf
commit 0d8d0a9
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
--- | ||
title: asdf の設定ファイル .asdfrc をつかってみた | ||
tags: | ||
- 設定 | ||
- asdf | ||
- asdf-vm | ||
- asdfrc | ||
private: false | ||
updated_at: '2024-11-30T20:12:41+09:00' | ||
id: 11fccf5e2e4a23f49c89 | ||
organization_url_name: fukuokaex | ||
slide: false | ||
ignorePublish: false | ||
--- | ||
|
||
[asdf]: https://asdf-vm.com/ | ||
|
||
## はじめに | ||
|
||
[asdf] は、複数のプログラミング言語やツールのバージョンを統一的に管理できる便利なツールです。 | ||
|
||
[asdf] を利用する中で、設定ファイルである `.asdfrc` の便利さに氣づきました。 | ||
|
||
この記事では、`.asdfrc` の基本的な設定内容を整理し、学んだことを共有します。誰かの参考になれば幸いです。 | ||
|
||
https://qiita.com/torifukukaiou/items/9009191de6873664bb58 | ||
|
||
## `.asdfrc` の基本 | ||
|
||
[asdf] の設定ファイル `.asdfrc` は、デフォルトでホームディレクトリに配置する設定ファイルです。このファイルを作成し編集することで、[asdf] の動作を細かくカスタマイズし、自分の開発環境に最適化した使い方を実現できます。 | ||
|
||
以下はデフォルトの設定内容です。 | ||
|
||
```bash | ||
legacy_version_file = no | ||
use_release_candidates = no | ||
always_keep_download = no | ||
plugin_repository_last_check_duration = 60 | ||
disable_plugin_short_name_repository = no | ||
concurrency = auto | ||
``` | ||
|
||
詳しくは[公式ドキュメントの `.asdfrc` 設定セクション](https://asdf-vm.com/manage/configuration.html#asdfrc)を参照してください。 | ||
|
||
### 各設定項目の説明 | ||
|
||
- **[`legacy_version_file`](https://asdf-vm.com/manage/configuration.html#legacy-version-file)** | ||
既存のバージョン管理ツールのファイル(例: `.ruby-version`, `.node-version` など)を参照するかどうかを制御します。`yes` にすると互換性を持たせられます。 | ||
|
||
- **[`use_release_candidates`](https://asdf-vm.com/manage/configuration.html#use-release-candidates)** | ||
リリース候補(RC)のバージョンを使用するかどうかを設定します。 | ||
|
||
- **[`always_keep_download`](https://asdf-vm.com/manage/configuration.html#always-keep-download)** | ||
ダウンロードしたアーカイブを削除せず保持するかどうかを指定します。 | ||
|
||
- **[`plugin_repository_last_check_duration`](https://asdf-vm.com/manage/configuration.html#plugin-repository-last-check-duration)** | ||
プラグインリポジトリの更新頻度(分単位)を指定します。デフォルトは 60 分です。 | ||
|
||
- **[`disable_plugin_short_name_repository`](https://asdf-vm.com/manage/configuration.html#disable-plugin-short-name-repository)** | ||
プラグインの短縮名を使ったリポジトリを無効化します。 | ||
|
||
- **[`concurrency`](https://asdf-vm.com/manage/configuration.html#concurrency)** | ||
並列処理の設定を行います。`auto` にすると環境に応じた適切な値が設定されます。 | ||
|
||
## 既存のバージョン管理ファイルを活用する | ||
|
||
これらの設定項目を理解した上で、次に僕が特に便利だと感じている `legacy_version_file` 設定について詳しく見ていきます。 | ||
|
||
プロジェクト内に `.node-version` や `.ruby-version` などの既存のバージョン管理ツール用ファイルがある場合、それらをそのまま活用できる便利な設定です。この機能は、`.asdfrc` 内で `legacy_version_file` を `yes` に設定することで有効になります。 | ||
|
||
以下のように `.asdfrc` を設定します。 | ||
|
||
```bash | ||
legacy_version_file = yes | ||
``` | ||
|
||
**ユースケース**: | ||
|
||
- プロジェクト内で `rbenv` や `nvm` など他のバージョン管理ツールと [asdf] を併用している場合。 | ||
- 古いプロジェクトのファイルを `.tool-versions` に変換せずに活用したい場合。 | ||
|
||
ただし、[asdf] では `.tool-versions` を使用することが推奨されています。この設定は、既存プロジェクトでの一時的な対応策として活用するのが最適です。 | ||
|
||
詳細は[レガシーファイル設定](https://asdf-vm.com/manage/configuration.html#legacy-version-file)をご確認ください。 | ||
|
||
## 僕の `.asdfrc` | ||
|
||
僕の `.asdfrc` 設定では、`legacy_version_file` のみを設定しています。この一つの設定項目で、既存のツールから [asdf] へのスムーズな移行が可能になり、プロジェクトごとの特性に合わせた柔軟な運用も実現できます。 | ||
|
||
これを設定することで、`.ruby-version` や `.node-version` といった既存のバージョン管理ツール用ファイルをそのまま活用できました。特に、古いプロジェクトをメンテナンスする際や、他のツールから [asdf] への移行作業を行う際に大きな助けとなりました。 | ||
|
||
## おわりに | ||
|
||
`.asdfrc` は、[asdf] を使いこなすための重要なカスタマイズツールです。この記事を参考に、ぜひ自分の開発環境に合った設定を試してみてください! | ||
僕の場合、特に `legacy_version_file` の設定が役立ちました。既存のプロジェクトをスムーズに移行したり、古いバージョン管理ツール用ファイルをそのまま活用できたりする点は、非常に強力で便利です。 | ||
|
||
この記事が少しでも参考になれば嬉しいです。また、皆さんの `.asdfrc` 設定やおすすめの工夫があれば、ぜひコメントで共有してください。 |