Commit Graph

284 Commits

Author SHA1 Message Date
Victor Hugo Borja
7fda291df0 Add asdf shim-versions command (#380)
For example `asdf shim-versions npm` will list the plugins and their
versions on which the `npm` command is available.

Based on #432
2019-01-19 13:31:26 -06:00
Victor Hugo Borja
9b27848d07 New shim metadata to allow many plugins with same executable names
Features

* New shim version meta-data allows shims to not depend on a particular plugin
  nor on its relative executable path (#431)
  Upgrading requires shim re-generation and should happen automatically
  by `asdf-exec`:
    `rm -rf ~/.asdf/shims/` followed by `asdf reshim`
* Added lots of tests for shim execution.
  We now make sure that shim execution obeys plugins hooks like
  `list-bin-paths` and `exec-path`.
* Shim exec is now performed by a new `bin/private/asdf-tool-exec` that might
  be faster for most common use case: (versions on local .tool-versions file)
  but fallbacks to slower `get_preset_version_for` which takes legacy formats
  into account.
* Shim exec recommends which plugins or versions to set when command is
  not found.

Fixed Bugs

* Allow many plugins to provide shims with same executable name (#431)
2019-01-19 13:22:12 -06:00
Trevor Brown
8f242e7ec2 Address shellcheck warnings 2019-01-05 11:10:59 -05:00
Trevor Brown
c37307a2cc Create get_custom_executable_path function to hold the custom exec path logic 2019-01-05 10:23:41 -05:00
Raphx
ec6662d4c0
Continue list even when version is not found
Previous implementation exits abruptly when no version is installed for
a plugin. This prevented the list command from listing the versions for
some other plugins.

This commit allows list command to continue executing even when no
version is installed for some plugins.

Example, plugin a with 1.0, b with none, and c with 2.0.

Previous implementation:

```
$ asdf list

a
  1.0
b
No versions installed
```

After commit changes:

```
$ asdf list

a
  1.0
b
No versions installed
c
  2.0
```
2018-12-28 09:21:43 +08:00
Trevor Brown
fcf5f3653c
Merge pull request #416 from asdf-vm/fix-shellcheck-warnings
Fix shellcheck warnings on OSX
2018-12-21 17:34:37 -05:00
Trevor Brown
41e2059a3e Fix shellcheck warnings on OSX 2018-12-20 17:25:30 -05:00
Trevor Brown
7ca88746a8
Merge pull request #411 from rliebz/update
Fix issues with update command
2018-12-02 14:12:23 -05:00
Robert Liebowitz
321e3b0e46 Exit 1 for failed update 2018-12-01 21:17:27 -05:00
Robert Liebowitz
697772fe8c Fix git dir for update and add error handling 2018-12-01 21:07:44 -05:00
Daniel Perez
2eae89c432 Fix which for when "system" version is present 2018-11-29 00:31:31 +00:00
Daniel Perez
11882c1151
Merge pull request #382 from fcrespo82/better-which-command
Updated which command.
2018-11-29 00:18:51 +00:00
Trevor Brown
f88f140ea8
Make get_executable_path use ASDF_DATA_DIR
Fixes #402
2018-11-26 08:50:11 -05:00
Fernando Crespo
0871b7fe8f Change maxdepth position to fix error in ubuntu trusty 2018-11-21 14:57:05 -02:00
Trevor Brown
22b709f94e
Merge pull request #403 from burnettk/support-tool-versions-without-newline
support .tool-versions content even if it does not end in a newline
2018-11-20 09:18:41 -05:00
Kevin Burnett
f1b2c59b1d support .tool-versions if it does not end in newline 2018-11-15 21:47:48 -05:00
Fernando Crespo
03394831a8 Merge remote-tracking branch 'upstream/master' into better-which-command 2018-11-12 15:35:19 -02:00
Fernando Crespo
3491322601 Fixed review issues and added -L to find to account for python having its main binary as a symlink 2018-11-12 15:30:44 -02:00
Daniel Perez
18587d4d6f Fix current behavior when multiple versions of a plugin are set 2018-11-10 11:32:02 +00:00
Trevor Brown
359191104b
Merge pull request #389 from mig4/where-default-version-to-current
Make where command default to current version
2018-11-03 10:07:44 -04:00
mig4
a58e9e3c17
Make where command default to current version
Allow not specifying the version on command line in which case fall back
to looking it up.

Also add tests for the `where` command.
2018-10-28 17:47:21 +00:00
mig4
f994b07a2c
Optimise listing all plugins
When checking if a plugin is installed (to display a flag) it is not
necessary to loop through all installed plugins, since we already have
a name we can check directly.

Also expand test case to test this code path too.
2018-10-27 20:05:02 +01:00
Fernando Crespo
61b288c959 Fix shellcheck lint errors 2018-10-21 00:56:28 -03:00
Fernando Crespo
46e5f7427f Updated which command.
Should fix #205
2018-10-21 00:47:13 -03:00
Trevor Brown
357413c950 Add support for the --asdf-tool-version flag to the plugin-test command. 2018-10-20 11:48:10 -04:00
Trevor Brown
13cff01ea0 Fix output for plugin_test_command function. 2018-10-19 22:46:51 -04:00
Trevor Brown
fc078c5e72 Implement 'asdf local -p'. 2018-10-19 20:41:49 -04:00
Trevor Brown
f708e3c15f
Merge pull request #371 from phunehehe/version-set-by
commands/current: add space before parenthesis
2018-10-10 18:21:46 -04:00
Hoang Xuan Phu
1330083229 commands/current: add space before parenthesis
It seems to have been lost in 88d47bbd69.
Probably by accident?

I also pulled the literal bits into the format string. It looks more
readable to me that way. I'm happy to remove that if it's not desired.
2018-10-10 17:28:23 -04:00
Trevor Brown
d6b01e35ec Simplify resolve_symlink function. 2018-10-07 21:47:57 -04:00
Trevor Brown
e0cdec39f9 Address shellcheck errors in resolve_symlink function. 2018-10-07 21:47:57 -04:00
Trevor Brown
4c4590c6e6 Update resolve_symlink function so it always returns absolute paths. 2018-10-07 21:47:57 -04:00
Trevor Brown
e095ed5efa Don't install system versions. 2018-10-07 14:35:36 -04:00
Jose Luis Salas
448d3215d8
Fix asdf current behaviour
Closes: #353
2018-10-04 21:00:29 +02:00
Jose Luis Salas
5acef7c9bf
Remove get_install_type and fix indentation 2018-09-27 22:18:36 +02:00
Diego Nogueira Teixeira
28c0576d17 Fix reshim to create shim only for executable files and not directories. 2018-09-18 10:38:22 -03:00
Trevor Brown
2e27ceb090
Merge pull request #335 from josacar/user-install-directory
Install data outside asdf installation directory
2018-09-16 22:36:08 -04:00
Jose Luis Salas
d1782f456e
Retrieve asdf_data_dir from environment variable 2018-09-16 18:39:21 +02:00
Victor Hugo Borja
a4fc43e682 plugin-test: check Auth is used when list-all uses Github API
Many plugins were having this problem where they rely on accessing
GitHub's API for listing versions from some repo releases. But not
setting an Authorization token for `curl`, causes the test to fail.

We now detect that if the plugin `list-all` looks like accessing
`api.github.com` and if so, we also try to guess if the Authroization
header will be set. If not, we fail the test and head the plugin author
to some documentation on how to add it.

Hope this reduces the number of failures due to GitHub API rate
limiting on travis.
2018-08-29 23:19:30 -07:00
Victor Hugo Borja
950853d9e6 test plugin in subshell and from isolated asdf
The subshell sources the isolated asdf environment, making the asdf
command available. In some plugin tests we were having failures do
to the asdf bin not set on PATH.
2018-08-29 23:16:01 -07:00
Jose Luis Salas
c86707c55f
Add config option to install plugins in $HOME/.asdf 2018-08-11 15:37:56 +02:00
Trevor Brown
bcdc5e0ba7 Switch to single quotes for sed regex. 2018-06-17 19:31:36 -04:00
Trevor Brown
001cd6022f Ignore shellcheck warning. 2018-06-16 23:07:17 -04:00
Trevor Brown
631ad8a005 Resolve symlink paths before altering .tool-version files. 2018-06-16 22:59:37 -04:00
Trevor Brown
c1ce9de4d4
Merge pull request #331 from brennanfee/fix-330-asdf-list
Fix for #330 - "asdf list" spacing
2018-06-16 15:30:35 -04:00
Trevor Brown
1b44fa7549 Fix shellcheck warnings. 2018-06-16 15:26:02 -04:00
Brennan Fee
8a018715c7
Fix for #330 - "asdf list" spacing
In order to make the output of "asdf list" a bit easier to read, this commit adds two spaces to the front of each version being written so as to indent them under the plugin.
2018-05-31 11:45:20 -05:00
Brennan Fee
4cb89b152c
Fix another spot for plugin-name env var lookup
After fixing #319 I wondered if there were any other spots where the same/similar bug existed.  I found one other location at line 126 in utils.sh.
2018-05-31 10:46:04 -05:00
Brennan Fee
67bc9539d1 Fix for #319
Fixed #319 by forcing all dashes to underscores in the plugin name.
Shell variables don't allow dash.
2018-05-30 20:02:23 -05:00
Michael Davis
3f51d3a5ab Change exit code from 0 -> 2 2018-05-29 21:47:46 -05:00