mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-19 18:05:02 -07:00
10 lines
22 KiB
JavaScript
10 lines
22 KiB
JavaScript
import{_ as n,c as i,a2 as s,j as e,a as o,G as a,B as d,o as r}from"./chunks/framework.BQmytedh.js";const S=JSON.parse('{"title":"Configuration","description":"","frontmatter":{},"headers":[],"relativePath":"manage/configuration.md","filePath":"manage/configuration.md","lastUpdated":1699489504000}'),c={name:"manage/configuration.md"},u={tabindex:"0"},p={style:{"text-align":"left"}},f={tabindex:"0"},h={style:{"text-align":"left"}},g={tabindex:"0"},m={style:{"text-align":"left"}},y={tabindex:"0"},b={style:{"text-align":"left"}},v={tabindex:"0"},x={style:{"text-align":"left"}};function _(k,t,w,D,E,F){const l=d("Badge");return r(),i("div",null,[t[33]||(t[33]=s(`<h1 id="configuration" tabindex="-1">Configuration <a class="header-anchor" href="#configuration" aria-label="Permalink to "Configuration""></a></h1><p>Configuration of <code>asdf</code> encompasses both the sharable <code>.tool-versions</code> files as well as user specific customisations with <code>.asdfrc</code> and Environment Variables.</p><h2 id="tool-versions" tabindex="-1"><code>.tool-versions</code> <a class="header-anchor" href="#tool-versions" aria-label="Permalink to "\`.tool-versions\`""></a></h2><p>Whenever <code>.tool-versions</code> file is present in a directory, the tool versions it declares will be used in that directory and any subdirectories.</p><div class="warning custom-block"><p class="custom-block-title">Note</p><p>Global defaults can be set in the file <code>$HOME/.tool-versions</code></p></div><p>This is what a <code>.tool-versions</code> file looks like:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>ruby 2.5.3</span></span>
|
||
<span class="line"><span>nodejs 10.15.0</span></span></code></pre></div><p>You can also include comments:</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>ruby 2.5.3 # This is a comment</span></span>
|
||
<span class="line"><span># This is another comment</span></span>
|
||
<span class="line"><span>nodejs 10.15.0</span></span></code></pre></div><p>The versions can be in the following format:</p><ul><li><code>10.15.0</code> - an actual version. Plugins that support downloading binaries, will download binaries.</li><li><code>ref:v1.0.2-a</code> or <code>ref:39cb398vb39</code> - tag/commit/branch to download from github and compile</li><li><code>path:~/src/elixir</code> - a path to custom compiled version of a tool to use. For use by language developers and such.</li><li><code>system</code> - this keyword causes asdf to passthrough to the version of the tool on the system that is not managed by asdf.</li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>Multiple versions can be set by separating them with a space. For example, to use Python <code>3.7.2</code>, fallback to Python <code>2.7.15</code> and finally to the <code>system</code> Python, the following line can be added to <code>.tool-versions</code>.</p><div class="language- vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang"></span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>python 3.7.2 2.7.15 system</span></span></code></pre></div></div><p>To install all the tools defined in a <code>.tool-versions</code> file run <code>asdf install</code> with no other arguments in the directory containing the <code>.tool-versions</code> file.</p><p>To install a single tool defined in a <code>.tool-versions</code> file run <code>asdf install <name></code> in the directory containing the <code>.tool-versions</code> file. The tool will be installed at the version specified in the <code>.tool-versions</code> file.</p><p>Edit the file directly or use <code>asdf local</code> (or <code>asdf global</code>) which updates it.</p><h2 id="asdfrc" tabindex="-1"><code>.asdfrc</code> <a class="header-anchor" href="#asdfrc" aria-label="Permalink to "\`.asdfrc\`""></a></h2><p>The <code>.asdfrc</code> file defines the user's machine specific configuration.</p><p><code>\${HOME}/.asdfrc</code> is the default location used by asdf. This can be set with the <a href="#asdfconfigfile">Environment Variable <code>ASDF_CONFIG_FILE</code></a>.</p><p>The below file shows the required format with the default values:</p><div class="language-txt vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">txt</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>legacy_version_file = no</span></span>
|
||
<span class="line"><span>use_release_candidates = no</span></span>
|
||
<span class="line"><span>always_keep_download = no</span></span>
|
||
<span class="line"><span>plugin_repository_last_check_duration = 60</span></span>
|
||
<span class="line"><span>disable_plugin_short_name_repository = no</span></span>
|
||
<span class="line"><span>concurrency = auto</span></span></code></pre></div><h3 id="legacy-version-file" tabindex="-1"><code>legacy_version_file</code> <a class="header-anchor" href="#legacy-version-file" aria-label="Permalink to "\`legacy_version_file\`""></a></h3><p>Plugins <strong>with support</strong> can read the versions files used by other version managers, for example, <code>.ruby-version</code> in the case of Ruby's <code>rbenv</code>.</p>`,22)),e("table",u,[t[4]||(t[4]=e("thead",null,[e("tr",null,[e("th",{style:{"text-align":"left"}},"Options"),e("th",{style:{"text-align":"left"}},"Description")])],-1)),e("tbody",null,[e("tr",null,[e("td",p,[t[0]||(t[0]=e("code",null,"no",-1)),t[1]||(t[1]=o()),a(l,{type:"tip",text:"default",vertical:"middle"})]),t[2]||(t[2]=e("td",{style:{"text-align":"left"}},[o("Use "),e("code",null,".tool-versions"),o(" to read versions")],-1))]),t[3]||(t[3]=e("tr",null,[e("td",{style:{"text-align":"left"}},[e("code",null,"yes")]),e("td",{style:{"text-align":"left"}},[o("Use plugin fallback to legacy version files ("),e("code",null,".ruby-version"),o(") if available")])],-1))])]),t[34]||(t[34]=e("h3",{id:"use-release-candidates",tabindex:"-1"},[e("code",null,"use_release_candidates"),o(),e("a",{class:"header-anchor",href:"#use-release-candidates","aria-label":'Permalink to "`use_release_candidates`"'},"")],-1)),t[35]||(t[35]=e("p",null,[o("Configure the "),e("code",null,"asdf update"),o(" command to upgrade to the latest Release Candidate instead of the latest Semantic Version.")],-1)),e("table",f,[t[9]||(t[9]=e("thead",null,[e("tr",null,[e("th",{style:{"text-align":"left"}},"Options"),e("th",{style:{"text-align":"left"}},"Description")])],-1)),e("tbody",null,[e("tr",null,[e("td",h,[t[5]||(t[5]=e("code",null,"no",-1)),t[6]||(t[6]=o()),a(l,{type:"tip",text:"default",vertical:"middle"})]),t[7]||(t[7]=e("td",{style:{"text-align":"left"}},"Semantic Version is used",-1))]),t[8]||(t[8]=e("tr",null,[e("td",{style:{"text-align":"left"}},[e("code",null,"yes")]),e("td",{style:{"text-align":"left"}},"Release Candidate is used")],-1))])]),t[36]||(t[36]=e("h3",{id:"always-keep-download",tabindex:"-1"},[e("code",null,"always_keep_download"),o(),e("a",{class:"header-anchor",href:"#always-keep-download","aria-label":'Permalink to "`always_keep_download`"'},"")],-1)),t[37]||(t[37]=e("p",null,[o("Configure the "),e("code",null,"asdf install"),o(" command to keep or delete the source code or binary it downloads.")],-1)),e("table",g,[t[14]||(t[14]=e("thead",null,[e("tr",null,[e("th",{style:{"text-align":"left"}},"Options"),e("th",{style:{"text-align":"left"}},"Description")])],-1)),e("tbody",null,[e("tr",null,[e("td",m,[t[10]||(t[10]=e("code",null,"no",-1)),t[11]||(t[11]=o()),a(l,{type:"tip",text:"default",vertical:"middle"})]),t[12]||(t[12]=e("td",{style:{"text-align":"left"}},"Delete source code or binary after successful install",-1))]),t[13]||(t[13]=e("tr",null,[e("td",{style:{"text-align":"left"}},[e("code",null,"yes")]),e("td",{style:{"text-align":"left"}},"Keep source code or binary after install")],-1))])]),t[38]||(t[38]=e("h3",{id:"plugin-repository-last-check-duration",tabindex:"-1"},[e("code",null,"plugin_repository_last_check_duration"),o(),e("a",{class:"header-anchor",href:"#plugin-repository-last-check-duration","aria-label":'Permalink to "`plugin_repository_last_check_duration`"'},"")],-1)),t[39]||(t[39]=e("p",null,"Configure the duration (in minutes) between asdf plugin repository syncs. Trigger events result in a check of the duration. If more time has elapsed since the last sync than specified in the duration, a new sync occurs.",-1)),e("table",y,[t[27]||(t[27]=e("thead",null,[e("tr",null,[e("th",{style:{"text-align":"left"}},"Options"),e("th",{style:{"text-align":"left"}},"Description")])],-1)),e("tbody",null,[e("tr",null,[e("td",b,[t[15]||(t[15]=o("integer in range ")),t[16]||(t[16]=e("code",null,"1",-1)),t[17]||(t[17]=o(" to ")),t[18]||(t[18]=e("code",null,"999999999",-1)),t[19]||(t[19]=o()),t[20]||(t[20]=e("br",null,null,-1)),t[21]||(t[21]=o()),t[22]||(t[22]=e("code",null,"60",-1)),t[23]||(t[23]=o(" is ")),a(l,{type:"tip",text:"default",vertical:"middle"})]),t[24]||(t[24]=e("td",{style:{"text-align":"left"}},"Sync on trigger event if duration (in minutes) since last sync has been exceeded",-1))]),t[25]||(t[25]=e("tr",null,[e("td",{style:{"text-align":"left"}},[e("code",null,"0")]),e("td",{style:{"text-align":"left"}},"Sync on each trigger event")],-1)),t[26]||(t[26]=e("tr",null,[e("td",{style:{"text-align":"left"}},[e("code",null,"never")]),e("td",{style:{"text-align":"left"}},"Never sync")],-1))])]),t[40]||(t[40]=s('<p>Sync events occur when the following commands are executed:</p><ul><li><code>asdf plugin add <name></code></li><li><code>asdf plugin list all</code></li></ul><p><code>asdf plugin add <name> <git-url></code> does NOT trigger a plugin sync.</p><div class="warning custom-block"><p class="custom-block-title">Note</p><p>Setting the value to <code>never</code> does not stop the plugin repository from being initially synced, for that behaviour see <code>disable_plugin_short_name_repository</code>.</p></div><h3 id="disable-plugin-short-name-repository" tabindex="-1"><code>disable_plugin_short_name_repository</code> <a class="header-anchor" href="#disable-plugin-short-name-repository" aria-label="Permalink to "`disable_plugin_short_name_repository`""></a></h3><p>Disable synchronization of the asdf plugin short-name repository. Sync events will exit early if the short-name repository is disabled.</p>',6)),e("table",v,[t[32]||(t[32]=e("thead",null,[e("tr",null,[e("th",{style:{"text-align":"left"}},"Options"),e("th",{style:{"text-align":"left"}},"Description")])],-1)),e("tbody",null,[e("tr",null,[e("td",x,[t[28]||(t[28]=e("code",null,"no",-1)),t[29]||(t[29]=o()),a(l,{type:"tip",text:"default",vertical:"middle"})]),t[30]||(t[30]=e("td",{style:{"text-align":"left"}},"Clone or update the asdf plugin repository on sync events",-1))]),t[31]||(t[31]=e("tr",null,[e("td",{style:{"text-align":"left"}},[e("code",null,"yes")]),e("td",{style:{"text-align":"left"}},"Disable the plugin short-name repository")],-1))])]),t[41]||(t[41]=s('<p>Sync events occur when the following commands are executed:</p><ul><li><code>asdf plugin add <name></code></li><li><code>asdf plugin list all</code></li></ul><p><code>asdf plugin add <name> <git-url></code> does NOT trigger a plugin sync.</p><div class="warning custom-block"><p class="custom-block-title">Note</p><p>Disabling the plugin short-name repository does not remove the repository if it has already synced. Remove the plugin repo with <code>rm --recursive --trash $ASDF_DATA_DIR/repository</code>.</p><p>Disabling the plugin short-name repository does not remove plugins previously installed from this source. Plugins can be removed with <code>asdf plugin remove <name></code>. Removing a plugin will remove all installed versions of the managed tool.</p></div><h3 id="concurrency" tabindex="-1"><code>concurrency</code> <a class="header-anchor" href="#concurrency" aria-label="Permalink to "`concurrency`""></a></h3><p>The default number of cores to use during compilation.</p><table tabindex="0"><thead><tr><th style="text-align:left;">Options</th><th style="text-align:left;">Description</th></tr></thead><tbody><tr><td style="text-align:left;">integer</td><td style="text-align:left;">Number of cores to use when compiling the source code</td></tr><tr><td style="text-align:left;"><code>auto</code></td><td style="text-align:left;">Calculate the number of cores using <code>nproc</code>, then <code>sysctl hw.ncpu</code>, then <code>/proc/cpuinfo</code> or else <code>1</code></td></tr></tbody></table><p>Note: the environment variable <code>ASDF_CONCURRENCY</code> take precedence if set.</p><h3 id="plugin-hooks" tabindex="-1">Plugin Hooks <a class="header-anchor" href="#plugin-hooks" aria-label="Permalink to "Plugin Hooks""></a></h3><p>It is possible to execute custom code:</p><ul><li>Before or after a plugin is installed, reshimed, updated, or uninstalled</li><li>Before or after a plugin command is executed</li></ul><p>For example, if a plugin called <code>foo</code> is installed and provides a <code>bar</code> executable, then the following hooks can be used to execute custom code first:</p><div class="language-text vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">text</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span>pre_foo_bar = echo Executing with args: $@</span></span></code></pre></div><p>The following patterns are supported:</p><ul><li><code>pre_<plugin_name>_<command></code></li><li><code>pre_asdf_download_<plugin_name></code></li><li><code>{pre,post}_asdf_{install,reshim,uninstall}_<plugin_name></code><ul><li><code>$1</code>: full version</li></ul></li><li><code>{pre,post}_asdf_plugin_{add,update,remove,reshim}</code><ul><li><code>$1</code>: plugin name</li></ul></li><li><code>{pre,post}_asdf_plugin_{add,update,remove}_<plugin_name></code></li></ul><p>See <a href="./../plugins/create.html">Create a Plugin</a> for specifics on what command hooks are ran before or after what commands.</p><h2 id="environment-variables" tabindex="-1">Environment Variables <a class="header-anchor" href="#environment-variables" aria-label="Permalink to "Environment Variables""></a></h2><p>Setting environment variables varies depending on your system and Shell. Default locations depend upon your installation location and method (Git clone, Homebrew, AUR).</p><p>Environment variables should generally be set before sourcing <code>asdf.sh</code>/<code>asdf.fish</code> etc. For Elvish set above <code>use asdf</code>.</p><p>The following describe usage with a Bash Shell.</p><h3 id="asdf-config-file" tabindex="-1"><code>ASDF_CONFIG_FILE</code> <a class="header-anchor" href="#asdf-config-file" aria-label="Permalink to "`ASDF_CONFIG_FILE`""></a></h3><p>Path to the <code>.asdfrc</code> configuration file. Can be set to any location. Must be an absolute path.</p><ul><li>If Unset: <code>$HOME/.asdfrc</code> will be used.</li><li>Usage: <code>export ASDF_CONFIG_FILE=/home/john_doe/.config/asdf/.asdfrc</code></li></ul><h3 id="asdf-default-tool-versions-filename" tabindex="-1"><code>ASDF_DEFAULT_TOOL_VERSIONS_FILENAME</code> <a class="header-anchor" href="#asdf-default-tool-versions-filename" aria-label="Permalink to "`ASDF_DEFAULT_TOOL_VERSIONS_FILENAME`""></a></h3><p>The filename of the file storing the tool names and versions. Can be any valid filename. Typically, you should not set this value unless you want to ignore <code>.tool-versions</code> files.</p><ul><li>If Unset: <code>.tool-versions</code> will be used.</li><li>Usage: <code>export ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=tool_versions</code></li></ul><h3 id="asdf-dir" tabindex="-1"><code>ASDF_DIR</code> <a class="header-anchor" href="#asdf-dir" aria-label="Permalink to "`ASDF_DIR`""></a></h3><p>The location of <code>asdf</code> core scripts. Can be set to any location. Must be an absolute path.</p><ul><li>If Unset: the parent directory of the <code>bin/asdf</code> executable is used.</li><li>Usage: <code>export ASDF_DIR=/home/john_doe/.config/asdf</code></li></ul><h3 id="asdf-data-dir" tabindex="-1"><code>ASDF_DATA_DIR</code> <a class="header-anchor" href="#asdf-data-dir" aria-label="Permalink to "`ASDF_DATA_DIR`""></a></h3><p>The location where <code>asdf</code> will install plugins, shims and tool versions. Can be set to any location. Must be an absolute path.</p><ul><li>If Unset: <code>$HOME/.asdf</code> if it exists, or else the value of <code>ASDF_DIR</code></li><li>Usage: <code>export ASDF_DATA_DIR=/home/john_doe/.asdf</code></li></ul><h3 id="asdf-concurrency" tabindex="-1"><code>ASDF_CONCURRENCY</code> <a class="header-anchor" href="#asdf-concurrency" aria-label="Permalink to "`ASDF_CONCURRENCY`""></a></h3><p>Number of cores to use when compiling the source code. If set, this value takes precedence over the asdf config <code>concurrency</code> value.</p><ul><li>If Unset: the asdf config <code>concurrency</code> value is used.</li><li>Usage: <code>export ASDF_CONCURRENCY=32</code></li></ul><h3 id="asdf-force-prepend" tabindex="-1"><code>ASDF_FORCE_PREPEND</code> <a class="header-anchor" href="#asdf-force-prepend" aria-label="Permalink to "`ASDF_FORCE_PREPEND`""></a></h3><p>Whether or not to prepend the <code>asdf</code> shims and path directories to the front-most (highest-priority) part of the <code>PATH</code>.</p><ul><li>If Unset: On macOS, defaults to <code>yes</code>; but on other systems, defaults to <code>no</code></li><li>If <code>yes</code>: Force <code>asdf</code> directories to the front of the <code>PATH</code></li><li>If set to any string <em>other</em> than <code>yes</code>: Do <em>not</em> force <code>asdf</code> directories to the front of the <code>PATH</code></li><li>Usage: <code>ASDF_FORCE_PREPEND=no . "<path-to-asdf-directory>/asdf.sh"</code></li></ul><h2 id="full-configuration-example" tabindex="-1">Full Configuration Example <a class="header-anchor" href="#full-configuration-example" aria-label="Permalink to "Full Configuration Example""></a></h2><p>Following a simple asdf setup with:</p><ul><li>a Bash Shell</li><li>an installation location of <code>$HOME/.asdf</code></li><li>installed via Git</li><li>NO environment variables set</li><li>NO custom <code>.asdfrc</code> file</li></ul><p>would result in the following outcomes:</p><table tabindex="0"><thead><tr><th style="text-align:left;">Configuration</th><th style="text-align:left;">Value</th><th style="text-align:left;">Calculated by</th></tr></thead><tbody><tr><td style="text-align:left;">config file location</td><td style="text-align:left;"><code>$HOME/.asdfrc</code></td><td style="text-align:left;"><code>ASDF_CONFIG_FILE</code> is empty, so use <code>$HOME/.asdfrc</code></td></tr><tr><td style="text-align:left;">default tool versions filename</td><td style="text-align:left;"><code>.tool-versions</code></td><td style="text-align:left;"><code>ASDF_DEFAULT_TOOL_VERSIONS_FILENAME</code> is empty, so use <code>.tool-versions</code></td></tr><tr><td style="text-align:left;">asdf dir</td><td style="text-align:left;"><code>$HOME/.asdf</code></td><td style="text-align:left;"><code>ASDF_DIR</code> is empty, so use parent dir of <code>bin/asdf</code></td></tr><tr><td style="text-align:left;">asdf data dir</td><td style="text-align:left;"><code>$HOME/.asdf</code></td><td style="text-align:left;"><code>ASDF_DATA_DIR</code> is empty so use <code>$HOME/.asdf</code> as <code>$HOME</code> exists.</td></tr><tr><td style="text-align:left;">concurrency</td><td style="text-align:left;"><code>auto</code></td><td style="text-align:left;"><code>ASDF_CONCURRENCY</code> is empty, so rely on <code>concurrency</code> value from the <a href="https://github.com/asdf-vm/asdf/blob/master/defaults" target="_blank" rel="noreferrer">default configuration</a></td></tr><tr><td style="text-align:left;">legacy_version_file</td><td style="text-align:left;"><code>no</code></td><td style="text-align:left;">No custom <code>.asdfrc</code>, so use the <a href="https://github.com/asdf-vm/asdf/blob/master/defaults" target="_blank" rel="noreferrer">default configuration</a></td></tr><tr><td style="text-align:left;">use_release_candidates</td><td style="text-align:left;"><code>no</code></td><td style="text-align:left;">No custom <code>.asdfrc</code>, so use the <a href="https://github.com/asdf-vm/asdf/blob/master/defaults" target="_blank" rel="noreferrer">default configuration</a></td></tr><tr><td style="text-align:left;">always_keep_download</td><td style="text-align:left;"><code>no</code></td><td style="text-align:left;">No custom <code>.asdfrc</code>, so use the <a href="https://github.com/asdf-vm/asdf/blob/master/defaults" target="_blank" rel="noreferrer">default configuration</a></td></tr><tr><td style="text-align:left;">plugin_repository_last_check_duration</td><td style="text-align:left;"><code>60</code></td><td style="text-align:left;">No custom <code>.asdfrc</code>, so use the <a href="https://github.com/asdf-vm/asdf/blob/master/defaults" target="_blank" rel="noreferrer">default configuration</a></td></tr><tr><td style="text-align:left;">disable_plugin_short_name_repository</td><td style="text-align:left;"><code>no</code></td><td style="text-align:left;">No custom <code>.asdfrc</code>, so use the <a href="https://github.com/asdf-vm/asdf/blob/master/defaults" target="_blank" rel="noreferrer">default configuration</a></td></tr></tbody></table><h2 id="internal-configuration" tabindex="-1">Internal Configuration <a class="header-anchor" href="#internal-configuration" aria-label="Permalink to "Internal Configuration""></a></h2><p>Users should not worry about this section as it describes configuration internal to <code>asdf</code> useful for Package Managers and integrators.</p><ul><li><code>$ASDF_DIR/asdf_updates_disabled</code>: Updates via the <code>asdf update</code> command are disabled when this file is present (content irrelevant). This is used by package managers like Pacman or Homebrew to ensure the correct update method is used for the particular installation.</li></ul>',46))])}const A=n(c,[["render",_]]);export{S as __pageData,A as default};
|