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
4 changes: 0 additions & 4 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,6 @@ export ASDF_DATA_DIR="/your/custom/data/dir"

`asdf` scripts need to be sourced **after** you have set your `$PATH` and **after** you have sourced your framework (oh-my-zsh etc).

::: warning
On macOS, starting a Bash or Zsh shell automatically calls a utility called `path_helper`. `path_helper` can rearrange items in `PATH` (and `MANPATH`), causing inconsistent behavior for tools that require specific ordering. To workaround this, `asdf` on macOS defaults to forcibly adding its `PATH`-entries to the front (taking highest priority). This is controllable with the `ASDF_FORCE_PREPEND` variable.
:::

Restart your shell so that `PATH` changes take effect. Opening a new terminal tab will usually do it.


Expand Down
4 changes: 0 additions & 4 deletions docs/ja-jp/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,6 @@ export ASDF_DATA_DIR="/your/custom/data/dir"

`asdf`のスクリプトは、`$PATH`を設定した**あと**、かつ、使用中のフレームワーク(oh-my-zsh など)を呼び出した**あと**に記述する必要があります。

::: warning 警告
macOSでは、BashまたはZSHシェルを起動すると、自動的に`path_helper`というユーティリティが呼び出されます。`path_helper`は`PATH`(および`MANPATH`)内の項目の順番を並び替えることができるため、特定の順序を必要とするツールの動作に一貫性が無くなってしまいます。これを回避するため、macOSで`asdf`を利用するときは強制的に`PATH`エントリの先頭に追加する(優先度を一番高くする)ようにしてください。これは、`ASDF_FORCE_PREPEND`環境変数で制御できます。
:::

`PATH`の変更を反映するために、シェルを再起動してください。たいていの場合、ターミナルのタブを新たに開けばOKです。


Expand Down
9 changes: 0 additions & 9 deletions docs/ja-jp/manage/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,6 @@ pre_foo_bar = echo Executing with args: $@
- 未設定の場合: asdf構成ファイルの`concurrency`の値が使用されます。
- 使用方法: `export ASDF_CONCURRENCY=32`

### `ASDF_FORCE_PREPEND`

`asdf`のShimやパスのディレクトリを`PATH`の先頭(最高優先度)に追加するかどうかを設定します。

- 未設定の場合: macOSでのデフォルト値は`yes`、その他のシステムでのデフォルト値は`no`です。
- `yes`の場合: `asdf`ディレクトリを強制的に`PATH`の先頭に配置します。
- `yes`以外の文字列を設定した場合: `asdf`ディレクトリを強制的に`PATH`の先頭に配置することは _しません_ 。
- Usage: `ASDF_FORCE_PREPEND=no . "<path-to-asdf-directory>/asdf.sh"`

## 完全な構成の例

下記のように、asdfをシンプルにセットアップしたとします:
Expand Down
6 changes: 1 addition & 5 deletions docs/ko-kr/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,7 @@ export ASDF_DIR="/opt/asdf-vm"

:::

`asdf` 스크립트들은 `$PATH` 설정한 **이후에** 프레임워크 (oh-my-zsh 등) source **이후에** source 되어야 합니다.

::: 경고
macOS에서, Bash 혹은 Zsh 셸 시작시에 자동적으로 `path_helper` 유틸리티를 실행시킵니다. `path_helper`는 `PATH` (와 `MANPATH`)에 항목들을 재배열 시켜 특정 순서를 요구하는 툴들의 일관된 동작을 방해합니다. 이를 방지하기 위해, macOS에서 `asdf`는 `PATH` 앞부분에 (가장 높은 우선순위) 강제로 추가합니다. 이는 `ASDF_FORCE_PREPEND`를 통해 변경가능합니다.
:::
`asdf` 스크립트들은 `$PATH` 설정한 **이후에** 프레임워크 (oh-my-zsh 등) source **이후에** source 되어야 합니다.

`PATH` 업데이트를 위해 셸을 재시작하세요. 새로운 터미널을 여는 경우 대부분 해결됩니다.

Expand Down
9 changes: 0 additions & 9 deletions docs/ko-kr/manage/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,6 @@ pre_foo_bar = echo Executing with args: $@
- 미설정 시: asdf 설정 `concurrency` 값이 사용됩니다.
- 사용법: `export ASDF_CONCURRENCY=32`

### `ASDF_FORCE_PREPEND`

`PATH`의 맨 앞(최우선순위) 부분에 `asdf` shim과 경로 디렉토리를 추가할 것인지 여부.

- 미설정 시: 맥 운영체제에서, `yes`가 기본값; 다른 시스템에서는 `no`가 기본값
- `yes`: `PATH`의 앞 부분에 `asdf` 디렉토리 강제 추가
- `yes` 이외의 _다른_ 문자열: `PATH`의 앞 부분에 `asdf` 디렉토리 강제로 추가하지 _않음_
- 사용법: `ASDF_FORCE_PREPEND=no . "<path-to-asdf-directory>/asdf.sh"`

## 전체 설정의 예시

다음을 이용한 간단한 asdf 설치는:
Expand Down
9 changes: 0 additions & 9 deletions docs/manage/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,6 @@ Number of cores to use when compiling the source code. If set, this value takes
- If Unset: the asdf config `concurrency` value is used.
- Usage: `export ASDF_CONCURRENCY=32`

### `ASDF_FORCE_PREPEND`

Whether or not to prepend the `asdf` shims and path directories to the front-most (highest-priority) part of the `PATH`.

- If Unset: On macOS, defaults to `yes`; but on other systems, defaults to `no`
- If `yes`: Force `asdf` directories to the front of the `PATH`
- If set to any string _other_ than `yes`: Do _not_ force `asdf` directories to the front of the `PATH`
- Usage: `ASDF_FORCE_PREPEND=no . "<path-to-asdf-directory>/asdf.sh"`

## Full Configuration Example

Following a simple asdf setup with:
Expand Down
10 changes: 1 addition & 9 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
)

const (
forcePrependDefault = false
dataDirDefault = "~/.asdf"
configFileDefault = "~/.asdfrc"
defaultToolVersionsFilenameDefault = ".tool-versions"
Expand All @@ -40,8 +39,7 @@ type Config struct {
DefaultToolVersionsFilename string `env:"ASDF_DEFAULT_TOOL_VERSIONS_FILENAME, overwrite"`
// Unclear if this value will be needed with the golang implementation.
// AsdfDir string
DataDir string `env:"ASDF_DATA_DIR, overwrite"`
ForcePrepend bool
DataDir string `env:"ASDF_DATA_DIR, overwrite"`
// Field that stores the settings struct if it is loaded
Settings Settings
PluginIndexURL string
Expand All @@ -61,13 +59,7 @@ type Settings struct {
}

func defaultConfig(dataDir, configFile string) *Config {
forcePrepend := forcePrependDefault
forcePrependEnv := os.Getenv("ASDF_FORCE_PREPEND")
if strings.ToLower(forcePrependEnv) == "yes" || (forcePrependEnv == "" && runtime.GOOS == "darwin") {
forcePrepend = true
}
return &Config{
ForcePrepend: forcePrepend,
DataDir: dataDir,
ConfigFile: configFile,
DefaultToolVersionsFilename: defaultToolVersionsFilenameDefault,
Expand Down
17 changes: 0 additions & 17 deletions internal/config/config_darwin_test.go

This file was deleted.

17 changes: 0 additions & 17 deletions internal/config/config_linux_test.go

This file was deleted.

26 changes: 0 additions & 26 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,6 @@ func TestLoadConfigEnv(t *testing.T) {
assert.Zero(t, config.Home, "Shouldn't set Home property when loading config")
}

func TestLoadConfigEnv_WithForcePrependEnv(t *testing.T) {
t.Run("When ASDF_FORCE_PREPEND env given yes", func(t *testing.T) {
t.Setenv("ASDF_FORCE_PREPEND", "yes")

config, _ := loadConfigEnv()

assert.True(t, config.ForcePrepend, "Then ForcePrepend property is true")
})

t.Run("When ASDF_FORCE_PREPEND env given YES", func(t *testing.T) {
t.Setenv("ASDF_FORCE_PREPEND", "YES")

config, _ := loadConfigEnv()

assert.True(t, config.ForcePrepend, "Then ForcePrepend property is true")
})

t.Run("When ASDF_FORCE_PREPEND env given any string other than yes", func(t *testing.T) {
t.Setenv("ASDF_FORCE_PREPEND", "no")

config, _ := loadConfigEnv()

assert.False(t, config.ForcePrepend, "Then ForcePrepend property is false")
})
}

func TestLoadSettings(t *testing.T) {
t.Run("When given invalid path returns error", func(t *testing.T) {
settings, err := loadSettings("./foobar")
Expand Down