Skip to content

Commit

Permalink
Merge pull request #1655 from axodotdev/xdg-config-home
Browse files Browse the repository at this point in the history
feat: support XDG_CONFIG_HOME
  • Loading branch information
mistydemeo authored Dec 20, 2024
2 parents aa437ee + 991430d commit 8d4da89
Show file tree
Hide file tree
Showing 54 changed files with 262 additions and 94 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ axoproject = { version = "=0.26.1", path = "axoproject", default-features = fals

# first-party deps
axocli = { version = "0.2.0" }
axoupdater = { version = "0.8.2" }
axoupdater = { version = "0.9.0" }
axotag = "0.2.0"
axoasset = { version = "1.2.0", features = ["json-serde", "toml-serde", "toml-edit", "yaml-serde", "compression", "remote"] }
axoprocess = { version = "0.2.0" }
Expand Down
2 changes: 1 addition & 1 deletion cargo-dist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fn run_build_step(
}

const AXOUPDATER_ASSET_ROOT: &str = "https://github.com/axodotdev/axoupdater/releases";
const AXOUPDATER_MINIMUM_VERSION: &str = "0.7.0";
const AXOUPDATER_MINIMUM_VERSION: &str = "0.9.0";

fn axoupdater_latest_asset_root() -> String {
format!("{AXOUPDATER_ASSET_ROOT}/latest/download")
Expand Down
6 changes: 5 additions & 1 deletion cargo-dist/templates/installer/installer.ps1.j2
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ if ($env:INSTALLER_DOWNLOAD_URL) {
$receipt = @"
{{ receipt | tojson }}
"@
$receipt_home = "${env:LOCALAPPDATA}\{{ app_name }}"
if ($env:XDG_CONFIG_HOME) {
$receipt_home = "${env:XDG_CONFIG_HOME}\{{ app_name }}"
} else {
$receipt_home = "${env:LOCALAPPDATA}\{{ app_name }}"
}

if ($env:{{ env_vars.disable_update_env_var }}) {
$install_updater = $false
Expand Down
2 changes: 1 addition & 1 deletion cargo-dist/templates/installer/installer.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fi
read -r RECEIPT <<EORECEIPT
{{ receipt | tojson }}
EORECEIPT
RECEIPT_HOME="${HOME}/.config/{{ app_name }}"
RECEIPT_HOME="${XDG_CONFIG_HOME:-$HOME/.config}/{{ app_name }}"
usage() {
# print help (this cat/EOF stuff is a "heredoc" string)
Expand Down
2 changes: 2 additions & 0 deletions cargo-dist/tests/cli-tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ fn test_self_update() {
.map(|s| s == "selfupdate" || s == "all")
.unwrap_or(false)
{
std::env::remove_var("XDG_CONFIG_HOME");

let mut args = RuntestArgs {
app_name: "cargo-dist".to_owned(),
package: "cargo-dist".to_owned(),
Expand Down
1 change: 1 addition & 0 deletions cargo-dist/tests/gallery/dist/powershell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl AppResult {
.env("LOCALAPPDATA", &appdata)
.env("MY_ENV_VAR", &app_home)
.env_remove("CARGO_HOME")
.env_remove("XDG_CONFIG_HOME")
.env_remove("PSModulePath")
})?;
eprintln!(
Expand Down
1 change: 1 addition & 0 deletions cargo-dist/tests/gallery/dist/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ impl AppResult {
.env("ZDOTDIR", &tempdir)
.env("MY_ENV_VAR", &app_home)
.env_remove("CARGO_HOME")
.env_remove("XDG_CONFIG_HOME")
})?;
// we could theoretically look at the above output and parse out the `source` line...

Expand Down
8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/akaikatana_basic.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cargo-dist/tests/snapshots/akaikatana_musl.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/akaikatana_two_bin_aliases.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/akaikatana_updaters.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_abyss.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_abyss_only.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_alias.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_basic.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_basic_lies.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions cargo-dist/tests/snapshots/axolotlsay_build_setup_steps.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8d4da89

Please sign in to comment.