Skip to content

Commit

Permalink
Upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rossmacarthur committed Nov 19, 2023
1 parent a45bd45 commit 93d6cf8
Show file tree
Hide file tree
Showing 28 changed files with 357 additions and 452 deletions.
613 changes: 228 additions & 385 deletions Cargo.lock

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,43 +28,43 @@ codegen-units = 1
pkg-url = "{ repo }/releases/download/{ version }/sheldon-{ version }-{ target }.tar.gz"

[dependencies]
anyhow = "1.0.71"
anyhow = "1.0.75"
casual = "0.2.0"
clap_complete = "4.2.2"
constcat = "0.3.0"
clap_complete = "4.4.4"
constcat = "0.4.0"
curl = "0.4.44"
fmutex = "0.1.0"
git2 = { version = "0.17.1", features = ["vendored-libgit2"] }
git2 = { version = "0.18.1", features = ["vendored-libgit2"] }
globwalk = "0.8.1"
home = "0.5.5"
indexmap = { version = "1.9.3", features = ["rayon", "serde"] }
itertools = "0.10.5"
indexmap = { version = "2.1.0", features = ["rayon", "serde"] }
itertools = "0.12.0"
maplit = "1.0.2"
once_cell = "1.17.1"
rayon = "1.7.0"
once_cell = "1.18.0"
rayon = "1.8.0"
regex-macro = "0.2.0"
serde = { version = "1.0.162", features = ["derive"] }
thiserror = "1.0.40"
toml = { version = "0.5.9", features = ["preserve_order"] }
toml_edit = "0.14.4"
upon = { version = "0.7.1", default-features = false, features = ["serde", "filters"] }
url = { version = "2.3.1", features = ["serde"] }
walkdir = "2.3.3"
which = { version = "4.4.0", default-features = false }
serde = { version = "1.0.192", features = ["derive"] }
thiserror = "1.0.50"
toml = { version = "0.8.8", features = ["preserve_order"] }
toml_edit = "0.21.0"
upon = { version = "0.8.0", default-features = false, features = ["serde", "filters"] }
url = { version = "2.4.1", features = ["serde"] }
walkdir = "2.4.0"
which = { version = "5.0.0", default-features = false }
yansi = "0.5.1"

[dependencies.clap]
version = "4.2.7"
version = "4.4.8"
default-features = false
features = [
"std", "help", "usage", "error-context", "suggestions", # default excluding "color"
"cargo", "env", "derive" # optional
]

[build-dependencies]
anyhow = "1.0.71"
anyhow = "1.0.75"

[dev-dependencies]
goldie = "0.4.3"
pretty_assertions = "1.3.0"
tempfile = "3.5.0"
pretty_assertions = "1.4.0"
tempfile = "3.8.1"
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,9 @@ following.

```toml
[templates]
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
PATH = 'export PATH="{{ dir }}:$PATH"'
path = 'path=( "{{ dir }}" $path )'
fpath = 'fpath=( "{{ dir }}" $fpath )'
Expand Down
2 changes: 1 addition & 1 deletion completions/sheldon.bash
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,4 @@ _sheldon() {
esac
}

complete -F _sheldon -o bashdefault -o default sheldon
complete -F _sheldon -o nosort -o bashdefault -o default sheldon
4 changes: 3 additions & 1 deletion docs/src/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ following.

```toml
[templates]
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
PATH = 'export PATH="{{ dir }}:$PATH"'
path = 'path=( "{{ dir }}" $path )'
fpath = 'fpath=( "{{ dir }}" $fpath )'
Expand Down
18 changes: 8 additions & 10 deletions src/config/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,9 @@ tag = "0.1.0"
.unwrap();
assert_eq!(
config.doc.to_string(),
r#"
[plugins.sheldon-test]
git = 'https://github.com/rossmacarthur/sheldon-test'
branch = 'feature'
r#"[plugins.sheldon-test]
git = "https://github.com/rossmacarthur/sheldon-test"
branch = "feature"
"#
)
}
Expand All @@ -214,10 +213,9 @@ branch = 'feature'
.unwrap();
assert_eq!(
config.doc.to_string(),
r#"
[plugins.sheldon-test]
github = 'rossmacarthur/sheldon-test'
tag = '0.1.0'
r#"[plugins.sheldon-test]
github = "rossmacarthur/sheldon-test"
tag = "0.1.0"
"#
)
}
Expand Down Expand Up @@ -266,8 +264,8 @@ apply = ["prompt"]
use = ["{{ name }}.zsh"]
[plugins.sheldon-test]
github = 'rossmacarthur/sheldon-test'
tag = '0.1.0'
github = "rossmacarthur/sheldon-test"
tag = "0.1.0"
"#
)
}
Expand Down
42 changes: 32 additions & 10 deletions src/config/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,12 @@ mod tests {
let error = toml::from_str::<ShellTest>("s = 'ksh'").unwrap_err();
assert_eq!(
error.to_string(),
"expected one of `bash`, `fish`, or `zsh`, got `ksh` for key `s` at line 1 column 5"
"TOML parse error at line 1, column 5
|
1 | s = 'ksh'
| ^^^^^
expected one of `bash`, `fish`, or `zsh`, got `ksh`
"
)
}

Expand Down Expand Up @@ -424,9 +429,13 @@ mod tests {
.unwrap_err();
assert_eq!(
error.to_string(),
"`rossmacarthur/579d02802b1cc17baed07753d09f5009/test` is not a valid Gist \
identifier, the hash or username/hash should be provided for key `g` at line 1 \
column 5"
"TOML parse error at line 1, column 5
|
1 | g = 'rossmacarthur/579d02802b1cc17baed07753d09f5009/test'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`rossmacarthur/579d02802b1cc17baed07753d09f5009/test` is not a valid Gist identifier, the hash or \
username/hash should be provided
"
);
}

Expand All @@ -435,8 +444,12 @@ mod tests {
let error = toml::from_str::<TestGistRepository>("g = 'nothex'").unwrap_err();
assert_eq!(
error.to_string(),
"`nothex` is not a valid Gist identifier, the hash or username/hash should be \
provided for key `g` at line 1 column 5"
"TOML parse error at line 1, column 5
|
1 | g = 'nothex'
| ^^^^^^^^
`nothex` is not a valid Gist identifier, the hash or username/hash should be provided
"
);
}

Expand Down Expand Up @@ -464,8 +477,13 @@ mod tests {
toml::from_str::<TestGitHubRepository>("g = 'rossmacarthur/sheldon/test'").unwrap_err();
assert_eq!(
error.to_string(),
"`rossmacarthur/sheldon/test` is not a valid GitHub repository, the \
username/repository should be provided for key `g` at line 1 column 5"
"TOML parse error at line 1, column 5
|
1 | g = 'rossmacarthur/sheldon/test'
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`rossmacarthur/sheldon/test` is not a valid GitHub repository, the username/repository should be \
provided
"
);
}

Expand All @@ -474,8 +492,12 @@ mod tests {
let error = toml::from_str::<TestGitHubRepository>("g = 'noslash'").unwrap_err();
assert_eq!(
error.to_string(),
"`noslash` is not a valid GitHub repository, the username/repository should be \
provided for key `g` at line 1 column 5"
"TOML parse error at line 1, column 5
|
1 | g = 'noslash'
| ^^^^^^^^^
`noslash` is not a valid GitHub repository, the username/repository should be provided
"
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/lock/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ fn render_template<S>(template: &str, ctx: S) -> Result<String>
where
S: Serialize,
{
TEMPLATE_ENGINE
let t = TEMPLATE_ENGINE
.compile(template)
.with_context(|| format!("failed to compile template `{template}`"))?
.render(ctx)
.with_context(|| format!("failed to compile template `{template}`"))?;
t.render(&TEMPLATE_ENGINE, ctx)
.to_string()
.with_context(|| format!("failed to render template `{template}`"))
}
Expand Down
2 changes: 1 addition & 1 deletion src/lock/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl LockedConfig {
.with_context(|| {
format!("failed to compile inline plugin `{}`", &plugin.name)
})?
.render(&data)
.render(&engine, &data)
.to_string()
.with_context(|| {
format!("failed to render inline plugin `{}`", &plugin.name)
Expand Down
1 change: 0 additions & 1 deletion src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::result;
use anyhow::Error;
use once_cell::sync::Lazy;

pub use crate::util::path_ext::PathExt;
pub use crate::util::temp::TempPath;

pub static TEMPLATE_ENGINE: Lazy<upon::Engine> = Lazy::new(upon::Engine::new);
Expand Down
5 changes: 4 additions & 1 deletion tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl TestCase {
let value = ENGINE
.compile(&raw)
.unwrap()
.render(&subs)
.render(&ENGINE, &subs)
.to_string()
.unwrap();
data.insert(name, value);
Expand Down Expand Up @@ -101,15 +101,18 @@ impl TestCase {
fs::write(path, self.get(name))
}

#[track_caller]
fn assert_contents(&self, name: &str) -> io::Result<()> {
self.assert_contents_path(name, &self.dirs.data.join(name))
}

#[track_caller]
fn assert_contents_path(&self, name: &str, path: &Path) -> io::Result<()> {
assert_eq!(&fs::read_to_string(path)?, &self.get(name));
Ok(())
}

#[track_caller]
fn run(&self) -> io::Result<()> {
self.write_config_file("plugins.toml")?;
self.command("lock").run()?;
Expand Down
4 changes: 3 additions & 1 deletion tests/testdata/clean/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ plugins = []
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/clean_permission_denied/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ plugins = []
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/deprecated_directories/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ apply = ["source"]
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/deprecated_get_filter/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ apply = ["source"]
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks | get: \"pre\" | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks | get: \"post\" | nl }}"
source = """
{{ hooks | get: \"pre\" | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks | get: \"post\" | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/directories_default/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ apply = ["source"]
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/directories_xdg_from_env/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ apply = ["source"]
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/empty/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ plugins = []
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/github_bad_reinstall/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ apply = ["source"]
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/github_branch/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ apply = ["source"]
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/github_https/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ apply = ["source"]
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/github_submodule/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ apply = ["source"]
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/github_tag/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ apply = ["source"]
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
8 changes: 6 additions & 2 deletions tests/testdata/hooks/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ pre = "pre"

[[plugins]]
name = "inline-test"
raw = "{{ hooks?.pre | nl }}echo 'testing...'\n{{ hooks?.post | nl }}"
raw = """
{{ hooks?.pre | nl }}echo 'testing...'
{{ hooks?.post | nl }}"""

[plugins.hooks]
post = "post"
Expand All @@ -24,4 +26,6 @@ post = "post"
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/inline/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ raw = "echo 'testing...'"
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
4 changes: 3 additions & 1 deletion tests/testdata/override_config_file/plugins.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ plugins = []
PATH = "export PATH=\"{{ dir }}:$PATH\""
path = "path=( \"{{ dir }}\" $path )"
fpath = "fpath=( \"{{ dir }}\" $fpath )"
source = "{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"\n{% endfor %}{{ hooks?.post | nl }}"
source = """
{{ hooks?.pre | nl }}{% for file in files %}source \"{{ file }}\"
{% endfor %}{{ hooks?.post | nl }}"""
Loading

0 comments on commit 93d6cf8

Please sign in to comment.