Skip to content

Commit

Permalink
feat(config): Add config parser file for mod installer
Browse files Browse the repository at this point in the history
Signed-off-by: dark0dave <dark0dave@mykolab.com>
  • Loading branch information
dark0dave committed Sep 11, 2024
1 parent d77b917 commit ecdf0c6
Show file tree
Hide file tree
Showing 13 changed files with 479 additions and 186 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
.swp
target/
dist/
Cargo.toml.test
176 changes: 169 additions & 7 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mod_installer"
version = "8.1.0"
version = "9.0.0"
edition = "2021"
authors = [ "dark0dave" ]
documentation = "https://raw.githubusercontent.com/dark0dave/mod_installer/main/README.md"
Expand All @@ -19,14 +19,14 @@ keywords = [
]

[dependencies]
env_logger = "0.11.1"
fs_extra = "1.3.0"
log = "0.4.22"
walkdir = "2.3.2"

[dependencies.clap]
version = "4.5.9"
features = [ "derive", "env" ]
confy = "^0.5"
clap = { version = "^4.5.9", features = ["derive", "env"] }
env_logger = "^0.11.1"
fs_extra = "^1.3.0"
log = "^0.4.22"
serde = { version = "^1.0.152", features = ["derive"] }
serde_derive = "^1.0.152"
walkdir = "^2.3.2"

[dev-dependencies]
pretty_assertions = "1.3.0"
30 changes: 21 additions & 9 deletions check-version.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
#!/usr/bin/env bash
set -euo pipefail

release_tag=$(git describe --tags --abbrev=0);
trap "rm -f Cargo.toml.test" SIGINT;
sed "s/^version \= .*/version = \"${release_tag/v/}\"/" Cargo.toml > Cargo.toml.test;
diff -sd Cargo.toml.test Cargo.toml;
if [ $? -eq 0 ]; then
rm -f Cargo.toml.test;
exit 0;
else
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }

function main() {
local tag_version=$(git describe --tags --abbrev=0);
echo "Git tag version: ${tag_version}"
local current_version=$(head -3 Cargo.toml | tail -1 | sed -E "s/^version \= \"(.*)\"/\1/")
echo "Cargo.toml version: v${current_version}"
if [ "${tag_version}" == "v${current_version}" ]; then
echo "Versions are the same"
exit 0;
fi

if version_gt "v${current_version}" "${tag_version}"; then
echo "Current version greater than tag version"
exit 0;
fi

echo "Failed, tag version: ${tag_version} is greater than Cargo,toml: v${current_version}"
exit 1;
fi
}

main
29 changes: 29 additions & 0 deletions example_parser_config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
in_progress_words = [
"installing",
"creating",
]
useful_status_words = [
"copied",
"copying",
"creating",
"installed",
"installing",
"patched",
"patching",
"processed",
"processing",
]
choice_words = [
"choice",
"choose",
"select",
"enter",
]
choice_phrase = [
"do you want",
"would you like",
]
completed_with_warnings = "installed with warnings"
failed_with_error = "not installed due to errors"
finished = "successfully installed"
eet_finished = "process ended"
Loading

0 comments on commit ecdf0c6

Please sign in to comment.