Commit Graph

1787 Commits

Author SHA1 Message Date
Trevor Brown
beaf038dba feat(golang-rewrite): create versions.InstallOneVersion function
* Create Plugin.Exists method
* Create internal/versions package
* Add missing asdfrc for internal/resolve package tests
* Create versions.ParseString function
* Create versions.InstallOneVersion function
* Update hook package to allow hook output to be received
* Write tests
2024-12-18 10:21:41 -05:00
Trevor Brown
99df51fca6 Merge pull request #53 from asdf-vm/tb/full-version-resolution
feat(golang-rewrite): full version resolution
2024-12-18 10:21:41 -05:00
Trevor Brown
01ec98eef4 Merge pull request #52 from asdf-vm/tb/version-resolution
feat(golang-rewrite): create internal/resolve package
2024-12-18 10:21:41 -05:00
Trevor Brown
bd3d83092c feat(golang-rewrite): full version resolution
* Refactor config package so default settings are always used with config file not loaded
* Update `findVersionsInDir` to check legacy files
* Refactor functions in internal/resolve package to return `ToolVersion` structs instead of version slices
* Refactor `findVersionsInEnv` function to return env variable name
* Create `resolve.Version` function
2024-12-18 10:21:41 -05:00
Trevor Brown
356720f610 Merge pull request #51 from asdf-vm/tb/offline-tests
feat(golang-rewrite): offline Go tests
2024-12-18 10:21:41 -05:00
Trevor Brown
30cf61a278 feat(golang-rewrite): create internal/resolve package
* Create `resolve` package
* Create `FindVersionsInDir`, `findVersionsInEnv`, and `findVersionsInLegacyFile` functions in resolve package
* Create `LegacyFilenames` and `ParseLegacyVersionFile` methods for Plugin
2024-12-18 10:21:41 -05:00
Trevor Brown
42b2f0294b Merge pull request #50 from asdf-vm/tb/version-file-parsing
feat(golang-rewrite): version file parsing
2024-12-18 10:21:41 -05:00
Trevor Brown
7533fbb5c8 feat(golang-rewrite): offline Go tests
Some of the Go tests actually cloned remote repos, which meant slow tests, and tests failures if I was working offline. These changes allow all Go tests to run offline. The test code now clones local Git repos instead of remotes ones.

* Add otiai10/copy as a dependency
* Create repotest package for test code that needs to work with Git repos
* Add back missing test script for execute package
* Update git, pluginindex, and plugins package tests so they work offline
2024-12-18 10:21:41 -05:00
Trevor Brown
dc9521be61 Merge pull request #49 from asdf-vm/tb/info-command
feat(golang-rewrite): info command
2024-12-18 10:21:41 -05:00
Trevor Brown
a0cd0319cb feat(golang-rewrite): version file parsing
* Create toolversions package
* Address linter errors for toolversions package
* Write tests
2024-12-18 10:21:41 -05:00
Trevor Brown
259959c6e7 Merge pull request #48 from asdf-vm/tb/plugin-callback-invocation
feat(golang-rewrite): create `RunCallback` method for `Plugin` struct
2024-12-18 10:21:41 -05:00
Trevor Brown
f657055832 feat(golang-rewrite): info command
* Implement info command
* Remove duplicate and unneeded BATS tests from `main_test.go`
* remove download dir for plugin when removing plugin
* update plugins.Add function so downloads directory is created
2024-12-18 10:21:41 -05:00
Trevor Brown
2531de184a Merge pull request #45 from asdf-vm/tb/command-exec
feat(golang-rewrite): create hooks
2024-12-18 10:21:41 -05:00
Trevor Brown
f1e7c05ae3 feat(golang-rewrite): create RunCallback method for Plugin struct
* Create `plugins.New` function, updating existing code to use it
* Add another test for `hook.Run` function
* Enable `plugin_add_command.bats` tests for Go implementation of asdf
* Add `RunCallback` method to `Plugin` struct
* Update `plugins.Add` function to run `post-plugin-add` plugin callback script
* Handle Bash expression and scripts properly in `execute` package so `$@` is always set
2024-12-18 10:21:41 -05:00
Trevor Brown
44e8257dcf Merge pull request #44 from asdf-vm/tb/use-plugin-index
feat(golang-rewrite): use plugin index
2024-12-18 10:21:41 -05:00
Trevor Brown
b1a47fe2bf feat(golang-rewrite): create hooks
* Update tests for config package to use assert package
* Create Config.GetHook method
* Create execute package for running Bash commands
* Create hook package for running asdf hooks
* Run plugin add hooks
2024-12-18 10:21:41 -05:00
Trevor Brown
a5bc137ab3 Merge pull request #42 from asdf-vm/tb/git-code-refactor
feat(golang-rewrite): move all Git code to git package
2024-12-18 10:21:41 -05:00
Trevor Brown
1785ed8d20 feat(golang-rewrite): use plugin index
* Create `pluginindex.Build` function
* Use `pluginindex` when no plugin URL provided for plugin add command
* Get more `plugin_add_command` BATS tests passing against Golang version
* Only use `pluginindex` when it is not disabled
* Update error message so it matches legacy format
* Add staticcheck.conf
2024-12-18 10:21:41 -05:00
Trevor Brown
031419b549 Merge pull request #40 from asdf-vm/tb/plugin-repository
feat(golang-rewrite): create pluginindex package
2024-12-18 10:21:41 -05:00
Trevor Brown
8cb2918169 feat(golang-rewrite): move all Git code to git package
* Move plugins/git package to /git.
* Update repoer interface in pluginindex package to match interface in git package
* Use git package's Repo struct in pluginindex package
2024-12-18 10:21:41 -05:00
Trevor Brown
642e63a931 Merge pull request #36 from asdf-vm/tb/plugin-update-cmd
feat(golang-rewrite): create plugin update command
2024-12-18 10:21:41 -05:00
Trevor Brown
da5c91d30a feat(golang-rewrite): create pluginindex package
* Switch to non-verbose test output in Makefile
* Create pluginindex package with PluginIndex struct with methods for updating index and retrieving plugin URLs
* Create IndexRepo interface to allow for easy testing out cloning real Git repository.
2024-12-18 10:21:41 -05:00
Trevor Brown
81199ded61 Merge pull request #38 from asdf-vm/tb/setup-gofumpt
chore(golang-rewrite): setup gofumpt
2024-12-18 10:21:41 -05:00
Trevor Brown
4c0d5893c0 feat(golang-rewrite): create plugin update command 2024-12-18 10:21:41 -05:00
Trevor Brown
f5cfe36b18 Merge pull request #35 from asdf-vm/tb/plugin-git-package
feat(golang-rewrite): create plugins/git package to store plugin Git operations
2024-12-18 10:21:41 -05:00
Trevor Brown
b8d13190ed chore(golang-rewrite): setup gofumpt
* Install and run gofumpt in Golang lint workflow
* Remove golangci-lint
* Run gofumpt and fix revive linter errors
2024-12-18 10:21:41 -05:00
Trevor Brown
7179459a4d feat(golang-rewrite): create plugins/git package to store plugin Git operations 2024-12-18 10:21:41 -05:00
Trevor Brown
0d15e5644d Merge pull request #33 from asdf-vm/tb/default-config-refactor
chore(golang-rewrite): default settings refactor
2024-12-18 10:21:27 -05:00
Trevor Brown
52a7c7a432 chore(golang-rewrite): rename files for plugins and cmd packages 2024-12-18 10:21:27 -05:00
Trevor Brown
826de00cbf chore(golang-rewrite): default settings refactor 2024-12-18 10:21:27 -05:00
Trevor Brown
b8eda79837 Merge pull request #32 from asdf-vm/tb/workflow-improvements
chore(golang-rewrite): Github workflow improvements
2024-12-18 10:21:27 -05:00
Trevor Brown
90fc14191c Merge pull request #31 from asdf-vm/tb/add-makefile
feat(golang-rewrite): create Makefile
2024-12-18 10:21:27 -05:00
Trevor Brown
cfd7e0d046 chore(golang-rewrite): Github workflow improvements
* Add golangci-lint to lint workflow
* Remove failing Bash test jobs
* Add golangci lint config
* Fix revive command in Makefile
* Fix revive warnings
2024-12-18 10:21:27 -05:00
Trevor Brown
dab4657784 feat(golang-rewrite): create Makefile
* Address Go linter warnings
* Fix Github workflow
2024-12-18 10:21:25 -05:00
Trevor Brown
d79027a8f6 Merge pull request #30 from asdf-vm/tb/plugin-remove-command
feat(golang-rewrite): create plugin remove command
2024-12-18 10:21:11 -05:00
Trevor Brown
974b11b0fe Merge pull request #29 from asdf-vm/tb/plugin-list-command
feat(golang-rewrite): create plugin list command
2024-12-18 10:21:11 -05:00
Trevor Brown
b1f1414e4d feat(golang-rewrite): create plugin remove command
* Simplify BATS test Golang code
* Update plugin add test to new command format
* Correctly set `ASDF_DATA_DIR` for BATS tests
* Rename `PluginAdd` function to `Add`
* Create `plugin.Remove` function
* Make plugin remove command invoke `plugin.Remove` function
2024-12-18 10:21:11 -05:00
Trevor Brown
89e9be5b04 Merge pull request #28 from asdf-vm/tb/plugin-add-command-2
feat(golang-rewrite): create pluginAddCommand function for plugin add command action
2024-12-18 10:21:11 -05:00
Trevor Brown
6d01b38abc feat(golang-rewrite): create plugin list command
* remove underscores from function names (addresses warnings from revive linter)
* create installMockPluginRepo function
* implement plugin list command
2024-12-18 10:21:11 -05:00
Trevor Brown
8f6e321d4a Merge pull request #26 from asdf-vm/tb/plugin-add-command
feat(golang-rewrite): PluginAdd function
2024-12-18 10:21:11 -05:00
Trevor Brown
db5db87322 feat(golang-rewrite): create pluginAddCommand function for plugin add command action 2024-12-18 10:21:11 -05:00
Trevor Brown
147ce31160 Merge pull request #25 from asdf-vm/tb/plugin-command-placeholders
feat(golang-rewrite): add placeholders for plugin subcommands
2024-12-18 10:21:11 -05:00
Trevor Brown
da44ce242f feat(golang-rewrite): PluginAdd function
* Add go-git as a dependency
* Remove plugins dir from gitignore
* Move config code to config package
* Create validatePluginName function
* Create PluginDirectory function
* Create PluginExists function
* Implement PluginAdd function
* Add testify as a dependency
* Write test for PluginAdd happy path
2024-12-18 10:21:11 -05:00
Trevor Brown
be3fb7cb51 Merge pull request #24 from asdf-vm/tb/config-api
feat(golang-rewrite): add config methods
2024-12-18 10:21:11 -05:00
Trevor Brown
2e4e4cd879 feat(golang-rewrite): add placeholders for plugin subcommands
* Switch from cobra to urfave/cli
* Create placeholder plugin command structs
2024-12-18 10:21:11 -05:00
Trevor Brown
1c4757f0ed Merge pull request #16 from asdf-vm/dependabot/github_actions/actions/checkout-4
chore(deps): bump actions/checkout from 3 to 4
2024-12-18 10:21:11 -05:00
Trevor Brown
d33701f7a6 feat(golang-rewrite): add config methods
* Create PluginRepoCheckDuration struct to represent config value
* Make some functions private
* write basic tests for Config methods
* Add Loaded field to Settings struct
* Define constants for config default values
2024-12-18 10:21:11 -05:00
Trevor Brown
66c7abc0d0 Merge pull request #23 from asdf-vm/tb/setup-config
feat(golang-rewrite): create settings and config structs for loading config
2024-12-18 10:21:11 -05:00
dependabot[bot]
c9a9e575e7 chore(deps): bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-18 10:21:11 -05:00
Trevor Brown
abd12bb09d Merge pull request #22 from asdf-vm/tb/workflow-fix
fix(golang-rewrite): update detect-changes logic for Golang tests
2024-12-18 10:21:11 -05:00