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

Release/0.7.1 #105

Merged
merged 4 commits into from
Sep 17, 2024
Merged
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
23 changes: 19 additions & 4 deletions core/src/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,29 @@ pub fn camel_to_snake_advanced(s: &str, numbers_attach_to_last_word: bool) -> St
pub fn to_pascal_case(input: &str) -> String {
let mut result = String::new();
let mut capitalize_next = true;
let mut prev_is_lowercase = false;

for ch in input.chars() {
for (i, ch) in input.chars().enumerate() {
if ch == '_' {
capitalize_next = true;
prev_is_lowercase = false;
} else if capitalize_next {
result.push(ch.to_ascii_uppercase());
capitalize_next = false;
} else {
prev_is_lowercase = false;
} else if ch.is_ascii_uppercase() && prev_is_lowercase {
result.push(ch);
prev_is_lowercase = false;
} else if i > 0 &&
ch.is_ascii_uppercase() &&
!prev_is_lowercase &&
input.chars().nth(i + 1).map_or(false, |next| next.is_ascii_lowercase())
{
result.push(ch.to_ascii_lowercase());
prev_is_lowercase = true;
} else {
result.push(ch.to_ascii_lowercase());
prev_is_lowercase = ch.is_ascii_lowercase();
}
}

Expand Down Expand Up @@ -176,14 +190,15 @@ mod tests {

#[test]
fn test_with_acronyms() {
assert_eq!(to_pascal_case("ETH_USD_price"), "ETHUSDPrice");
assert_eq!(to_pascal_case("ETH_USD_price"), "EthUsdPrice");
assert_eq!(to_pascal_case("http_request_handler"), "HttpRequestHandler");
}

#[test]
fn test_single_word() {
assert_eq!(to_pascal_case("user"), "User");
assert_eq!(to_pascal_case("CONSTANT"), "CONSTANT");
assert_eq!(to_pascal_case("CONSTANT"), "Constant");
assert_eq!(to_pascal_case("URI"), "Uri");
}

#[test]
Expand Down
17 changes: 15 additions & 2 deletions documentation/docs/pages/docs/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

### Bug fixes
-------------------------------------------------
fix: throw error if contract names are not unique
fix: allow non camel case types in generated code

### Breaking changes
-------------------------------------------------
Expand All @@ -19,6 +17,21 @@ fix: allow non camel case types in generated code

all release branches are deployed through `release/VERSION_NUMBER` branches

## 0.7.1-beta - 17th September 2024

github branch - https://github.com/joshstevens19/rindexer/tree/release/0.7.1

- linux binary - https://rindexer.xyz/releases/linux-amd64/0.7.1/rindexer_linux-amd64.tar.gz
- mac apple silicon binary - https://rindexer.xyz/releases/darwin-arm64/0.7.1/rindexer_darwin-arm64.tar.gz
- mac apple intel binary - https://rindexer.xyz/releases/darwin-amd64/0.7.1/rindexer_darwin-amd64.tar.gz
- windows binary - https://rindexer/releases.xyz/win32-amd64/0.7.1/rindexer_win32-amd64.zip

### Bug fixes
-------------------------------------------------
fix: throw error if contract names are not unique
fix: allow non camel case types in generated code
fix: pascal case not parsing capitals full words correctly

## 0.7.0-beta - 16th September 2024

github branch - https://github.com/joshstevens19/rindexer/tree/release/0.7.0
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading