diff --git a/README.md b/README.md index f7ee2b4..d4baa9b 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,10 @@ # Distillery -![Static Badge](https://img.shields.io/badge/Status%20-%20Beta%20-%20orange) -![GitHub Release](https://img.shields.io/github/v/release/ekristen/distillery?include_prereleases) -![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/ekristen/distillery/total) ![GitHub License](https://img.shields.io/github/license/ekristen/distillery) - [![Known Vulnerabilities](https://snyk.io/test/github/ekristen/distillery/badge.svg)](https://snyk.io/test/github/ekristen/distillery) [![Go Report Card](https://goreportcard.com/badge/github.com/ekristen/distillery)](https://goreportcard.com/report/github.com/ekristen/distillery) - -Most things are working, this project follows semantic commits and semantic releases, any breaking -changes will result in new major versions. +![GitHub Release](https://img.shields.io/github/v/release/ekristen/distillery?include_prereleases) +![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/ekristen/distillery/total) ## Overview @@ -27,6 +22,10 @@ The goal of this project is to install binaries by leverage the collective power are using tools like [goreleaser](https://goreleaser.com/) and [cargo-dist](https://github.com/axodotdev/cargo-dist) and many others to pre-compile their software and put their binaries up on GitHub or GitLab. +## Documentation + +[Full Documentation](https://dist.sh) + ## Features - Simple to install binaries on your system from multiple sources @@ -34,44 +33,65 @@ and many others to pre-compile their software and put their binaries up on GitHu - Support multiple platforms and architectures - Support private repositories (this was a feature removed from homebrew) - Support checksum verifications (if they exist) -- Support signatures verifications (if they exist) (**not implemented yet**) +- Support signatures verifications (if they exist) -## Install +## Quickstart -### MacOS/Linux +See full documentation at [Installation](https://dist.sh/installation/) -1. Set your path `export PATH=$HOME/.distillery/bin:$PATH` -2. Download the latest release from the [releases page](https://github.com/ekristen/distillery/releases) -3. Extract and Run `./dist install ekristen/distillery` -4. Delete `./dist` and the .tar.gz, now use `dist` normally -5. Run `dist install owner/repo` to install a binary from GitHub Repository +**Note:** the installation script **DO NOT CURRENTLY** try to modify your path, you will need to do that manually. -### Windows +### MacOS/Linux +```bash +curl --proto '=https' --tlsv1.2 -LsSf https://get.dist.sh | sh +``` -1. [Set Your Path](#set-your-path) -2. Download the latest release from the [releases page](https://github.com/ekristen/distillery/releases) -3. Extract and Run `.\dist.exe install ekristen/distillery` -4. Delete `.\dist.exe` and the .zip, now use `dist` normally -5. Run `dist install owner/repo` to install a binary from GitHub Repository +### Windows +```powershell +iwr https://get.dist.sh/install.ps1 -useb | iex +``` -#### Set Your Path +### Adjust Your Path -##### For Current Session +#### MacOS/Linux -```powershell -$env:Path = "C:\Users\\.distillery\bin;" + $env:Path +```bash +export PATH=$HOME/.distillery/bin:$PATH` ``` -##### For Current User +#### Windows ```powershell [Environment]::SetEnvironmentVariable("Path", "C:\Users\\.distillery\bin;" + $env:Path, [EnvironmentVariableTarget]::User) ``` -## Uninstall +## Behaviors + +- Allow for multiple versions of a binary using `tool@version` syntax +- Running installation for any version will automatically update the default symlink to that version (i.e. switching versions) +- Caching of HTTP calls where possible (GitHub primarily) +- Caching of downloads + +### Running install always updates default symlink + +**Note:** this might change before exiting beta. + +Whenever you run install the default symlink will always be updated to whatever version you specify. This is to make +it easy to switch versions. + +### Multiple Versions + +Every time you run install it will by default seek out the latest version, it will not remove any other versions. All +versions are symlinked with the suffix `@version` this means you can have multiple versions installed at the same time. + +It also means you can call any version any time using the `@version` syntax or if you are using something like [direnv](https://direnv.net/) +you can set aliases in your `.envrc` file for specific versions. -1. Run `dist info` -2. Remove the directories listed under the cleanup section +#### Example + +```console +alias terraform="terraform@1.8.5" +``` ### Examples @@ -103,7 +123,7 @@ installing from GitHub or GitLab directly. dist install homebrew/opentofu ``` -## Supported Platforms +## Supported Sources - GitHub - GitLab @@ -117,34 +137,6 @@ Distillery supports authentication for GitHub and GitLab. There are CLI options method is to set the `DISTILLERY_GITHUB_TOKEN` or `DISTILLERY_GITLAB_TOKEN` environment variables using a tool like [direnv](https://direnv.net/). -## Behaviors - -- Allow for multiple versions of a binary using `tool@version` syntax -- Running installation for any version will automatically update the default symlink to that version (i.e. switching versions) -- Caching of HTTP calls where possible (GitHub primarily) -- Caching of downloads - -### Running install always updates default symlink - -**Note:** this might change before exiting beta. - -Whenever you run install the default symlink will always be updated to whatever version you specify. This is to make -it easy to switch versions. - -### Multiple Versions - -Every time you run install it will by default seek out the latest version, it will not remove any other versions. All -versions are symlinked with the suffix `@version` this means you can have multiple versions installed at the same time. - -It also means you can call any version any time using the `@version` syntax or if you are using something like [direnv](https://direnv.net/) -you can set aliases in your `.envrc` file for specific versions. - -#### Example - -```console -alias terraform="terraform@1.8.5" -``` - ## Directory Structure This is the default directory structure that distillery uses. Some of this can be overridden via the configuration. diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 0000000..d1af572 --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,27 @@ +# Architecture + +## Directory Structure + +This is the default directory structure that distillery uses. Some of this can be overridden via the configuration. + +- Binaries + - Symlinks `$HOME/.distillery/bin` (this should be in your `$PATH` variable) + - Binaries `$HOME/.distillery/opt` (this is where the raw binaries are stored and symlinked to) + - `source/owner/repo/version/` + - example: `github/ekristen/aws-nuke/v2.15.0/aws-nuke` + - example: `hashicorp/terraform/v0.14.7/terraform` +- Cache directory (downloads, http caching) + - MacOS `$HOME/Library/Caches/distillery` + - Linux `$HOME/.cache/distillery` + - Windows `$HOME/AppData/Local/distillery` + +### Caching + +At the moment there are two discrete caches. One for HTTP requests and one for downloads. The HTTP cache is used to +store the ETag and Last-Modified headers from the server to determine if the file has changed. The download cache is +used to store the downloaded file. The download cache is not used to determine if the file has changed, that is done +by the HTTP cache. + +If you need to delete your cache simply run `dist info` identify the cache directory and remove it. + +**Note:** I may add a cache clear command in the future. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index d5bf4a5..41ca88f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -36,8 +36,9 @@ and many others to pre-compile their software and put their binaries up on GitHu - Support private repositories (this was a feature removed from homebrew) - Support checksum verifications (if they exist) - Support signatures verifications (if they exist) (**not implemented yet**) +- [Aliases](config/aliases.md) for easy access to binaries -### Examples +## Examples Install a specific version of a tool using `@version` syntax. `github` is the default scope, this implies `github/ekristen/aws-nuke` @@ -67,19 +68,6 @@ installing from GitHub or GitLab directly. dist install homebrew/opentofu ``` -## Supported Platforms - -- GitHub -- GitLab -- Homebrew (binaries only, if anything has a dependency, it will not work at this time) -- Hashicorp (special handling for their releases, pointing to github repos will automatically pass through) - -### Authentication - -Distillery supports authentication for GitHub and GitLab. There are CLI options to pass in a token, but the preferred -method is to set the `DISTILLERY_GITHUB_TOKEN` or `DISTILLERY_GITLAB_TOKEN` environment variables using a tool like -[direnv](https://direnv.net/). - ## Behaviors - Allow for multiple versions of a binary using `tool@version` syntax @@ -89,8 +77,6 @@ method is to set the `DISTILLERY_GITHUB_TOKEN` or `DISTILLERY_GITLAB_TOKEN` envi ### Running install always updates default symlink -**Note:** this might change before exiting beta. - Whenever you run install the default symlink will always be updated to whatever version you specify. This is to make it easy to switch versions. @@ -102,26 +88,8 @@ versions are symlinked with the suffix `@version` this means you can have multip It also means you can call any version any time using the `@version` syntax or if you are using something like [direnv](https://direnv.net/) you can set aliases in your `.envrc` file for specific versions. -## Directory Structure +#### Example -- Binaries - - Symlinks `$HOME/.distillery/bin` (this should be in your `$PATH` variable) - - Binaries `$HOME/.distillery/opt` (this is where the raw binaries are stored and symlinked to) - - `source/owner/repo/version/` - - example: `github/ekristen/aws-nuke/v2.15.0/aws-nuke` - - example: `hashicorp/terraform/v0.14.7/terraform` -- Cache directory (downloads, http caching) - - MacOS `$HOME/Library/Caches/distillery` - - Linux `$HOME/.cache/distillery` - - Windows `$HOME/AppData/Local/distillery` - -### Caching - -At the moment there are two discrete caches. One for HTTP requests and one for downloads. The HTTP cache is used to -store the ETag and Last-Modified headers from the server to determine if the file has changed. The download cache is -used to store the downloaded file. The download cache is not used to determine if the file has changed, that is done -by the HTTP cache. - -If you need to delete your cache simply run `dist info` identify the cache directory and remove it. - -**Note:** I may add a cache clear command in the future. \ No newline at end of file +```console +alias terraform="terraform@1.8.5" +``` \ No newline at end of file diff --git a/docs/sources.md b/docs/sources.md new file mode 100644 index 0000000..1544f89 --- /dev/null +++ b/docs/sources.md @@ -0,0 +1,16 @@ +# Supported Sources + +- GitHub +- GitLab +- Homebrew (binaries only, if anything has a dependency, it will not work at this time) +- Hashicorp (special handling for their releases, pointing to GitHub repos will automatically pass through) +- Kubernetes (special handling for their releases, pointing to GitHub repos will automatically pass through) + +## Authentication + +Distillery supports authentication for GitHub and GitLab. There are CLI options to pass in a token, but the preferred +method is to set the `DISTILLERY_GITHUB_TOKEN` or `DISTILLERY_GITLAB_TOKEN` environment variables using a tool like +[direnv](https://direnv.net/). + +This allows you to bypass any API rate limits that might be in place for unauthenticated requests, but more importantly +it allows you to install private repositories that you have access to! diff --git a/mkdocs.yml b/mkdocs.yml index 1905787..8e79c06 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -74,4 +74,6 @@ nav: - Config: - Overview: config.md - Aliases: config/aliases.md + - Architecture: architecture.md + - Supported Sources: sources.md diff --git a/pkg/config/config.go b/pkg/config/config.go index 5f667f7..2958ad7 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -30,9 +30,6 @@ type Config struct { // DefaultSource - the default source to use when installing binaries, this defaults to GitHub DefaultSource string `yaml:"default_source" toml:"default_source"` - // AutomaticAliases - automatically create aliases for any binary that is installed - AutomaticAliases bool `yaml:"automatic_aliases" toml:"automatic_aliases"` - // Aliases - Allow for creating shorthand aliases for source locations that you use frequently. A good example // of this is `distillery` -> `ekristen/distillery` Aliases *Aliases `yaml:"aliases" toml:"aliases"`