Skip to content

Commit

Permalink
Release/0.7.1 (#105)
Browse files Browse the repository at this point in the history
* fix: pascal case not parsing capitals full words correctly

* release/0.7.1

* Add release binaries for

* release/0.7.1 windows

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
joshstevens19 and github-actions committed Sep 17, 2024
1 parent 2add7dd commit 06a4f3e
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 6 deletions.
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.

0 comments on commit 06a4f3e

Please sign in to comment.