|
1 | 1 | ## Creating plugins |
2 | 2 |
|
3 | | -A plugin is a git repo, with a couple executable scripts, to support versioning another language or tool. These scripts are run when `list-all`, `install`, `uninstall` or `exec-env` commands are run. You can set or unset env vars and do anything required to setup the environment for the tool. |
| 3 | +A plugin is a git repo, with a couple executable scripts, to support versioning another language or tool. These scripts are run when `list-all`, `install` or `uninstall` commands are run. You can set or unset env vars and do anything required to setup the environment for the tool. |
4 | 4 |
|
5 | 5 | ### Required scripts |
6 | 6 |
|
7 | 7 | * `bin/list-all` - lists all installable versions |
8 | 8 | * `bin/install` - installs the specified version |
9 | 9 |
|
10 | | -##### bin/list-all |
| 10 | + |
| 11 | +All scripts except `bin/list-all` will have access to the following env vars to act upon: |
| 12 | + |
| 13 | +* `ASDF_INSTALL_TYPE` - `version` or `ref` |
| 14 | +* `ASDF_INSTALL_VERSION` - if `ASDF_INSTALL_TYPE` is `version` then this will be the version number. Else it will be the git ref that is passed. Might point to a tag/commit/branch on the repo. |
| 15 | +* `ASDF_INSTALL_PATH` - the dir where the it *has been* installed (or *should* be installed in case of the `bin/install` script) |
| 16 | + |
| 17 | + |
| 18 | +#### bin/list-all |
11 | 19 |
|
12 | 20 | Must print a string with a space-seperated list of versions. Example output would be the following: |
13 | 21 |
|
14 | 22 | ``` |
15 | 23 | 1.0.1 1.0.2 1.3.0 1.4 |
16 | 24 | ``` |
17 | 25 |
|
18 | | -##### bin/install |
19 | | - |
20 | | -This script should install the package. It will be passed the following command-line args (in order). |
| 26 | +#### bin/install |
21 | 27 |
|
22 | | -* *install type* - "version", "tag", "commit" |
23 | | -* *version* - this is the version or commit sha or the tag name that should be installed (use the first argument to figure out what to do). |
24 | | -* *install path* - the dir where the it *should* be installed |
| 28 | +This script should install the version, in the path mentioned in `ASDF_INSTALL_PATH` |
25 | 29 |
|
26 | 30 |
|
27 | 31 | ### Optional scripts |
28 | 32 |
|
29 | | -* `bin/list-bin-paths` - list executables for the version of the package |
30 | | -* `bin/exec-env` - `echo` a space separated list of "key1=value1 key2=value2" and asdf will set them before running your command |
31 | | -* `bin/uninstall` - uninstalls the specified version |
32 | | - |
| 33 | +#### bin/list-bin-paths |
33 | 34 |
|
34 | | -##### bin/list-bin-paths |
35 | | - |
36 | | -Must print a string with a space-seperated list of dir paths that contain executables. The paths must be relative to the install path passed. Example output would be: |
| 35 | +List executables for the specified version of the tool. Must print a string with a space-seperated list of dir paths that contain executables. The paths must be relative to the install path passed. Example output would be: |
37 | 36 |
|
38 | 37 | ``` |
39 | 38 | bin tools veggies |
40 | 39 | ``` |
41 | 40 |
|
42 | | -Shims will be automatically created for each of the binaries/executables. If this script is not specified, asdf will look for the `bin` dir in an installation and create shims for those. |
43 | | - |
44 | | -##### bin/exec-env |
45 | | - |
46 | | -Will be passed the following args |
| 41 | +This will instruct asdf to create shims for the files in `<install-path>/bin`, `<install-path>/tools` and `<install-path>/veggies` |
47 | 42 |
|
48 | | -* *install type* |
49 | | -* *version* |
| 43 | +If this script is not specified, asdf will look for the `bin` dir in an installation and create shims for those. |
50 | 44 |
|
51 | | -Must print a string with space-seperated list of env vars to set. Example output would be |
| 45 | +#### bin/exec-env |
52 | 46 |
|
53 | | -``` |
54 | | -FOO=bar BAR=baz XYZ=123 |
55 | | -``` |
| 47 | +Setup the env to run the binaries in the package. |
56 | 48 |
|
57 | | -##### bin/uninstall |
| 49 | +#### bin/uninstall |
58 | 50 |
|
59 | | -Uninstalls a specific version of a tool. Same args as the `bin/install` script. |
| 51 | +Uninstalls a specific version of a tool. |
0 commit comments