Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loosen Lune version string requirements #294

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions crates/lune-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dunce = "1.0"
once_cell = "1.17"
path-clean = "1.0"
pathdiff = "0.2"
semver = "1.0"
11 changes: 5 additions & 6 deletions crates/lune-utils/src/version_string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::sync::Arc;

use mlua::prelude::*;
use once_cell::sync::Lazy;
use semver::Version;

static LUAU_VERSION: Lazy<Arc<String>> = Lazy::new(create_luau_version_string);

Expand All @@ -20,12 +21,10 @@ pub fn get_version_string(lune_version: impl AsRef<str>) -> String {
let lune_version = lune_version.as_ref();

assert!(!lune_version.is_empty(), "Lune version string is empty");
assert!(
lune_version.chars().all(is_valid_version_char),
"Lune version string contains invalid characters"
);

format!("Lune {lune_version}+{}", *LUAU_VERSION)
match Version::parse(lune_version) {
Ok(semver) => format!("Lune {semver}+{}", *LUAU_VERSION),
Err(e) => panic!("Lune version string is not valid semver: {e}"),
}
}

fn create_luau_version_string() -> Arc<String> {
Expand Down
Loading