Skip to content

Commit

Permalink
v1.0.0 - official release
Browse files Browse the repository at this point in the history
  • Loading branch information
cophilot committed Mar 28, 2024
1 parent 816137a commit cd03df1
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check_rust_quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Run tests
run: ./scripts/test

- name: Merge to stable branch
- name: Merge to master branch
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

---

## [v1.0.0](https://github.com/cophilot/templify/tree/1.0.0) (2024-3-?)
## [v1.0.0](https://github.com/cophilot/templify/tree/1.0.0) (2024-3-28)

- Refactoring
- Added variable placeholders
Expand Down
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,23 @@ tpy load https://github.com/cophilot/templify-vault/tree/main/React-ts

## [Release Notes](https://github.com/cophilot/templify/blob/master/CHANGELOG.md)

### [v0.7.0](https://github.com/cophilot/templify/tree/0.7.0)

- macOS support added
### [v1.0.0](https://github.com/cophilot/templify/tree/1.0.0)

- Refactoring
- Added variable placeholders
- Added `-reset` flag for the `reload` command
- Added `-force` flag for the `generate` command
- Added `-reload` flag for the `generate` command
- Added `-var` flag for the `generate` command
- Added `-default-var` flag for the `generate` command
- Short forms for case conversion
- Added divider selection support in the `.templify` file
- Added global flag support
- Added `--quiet` global flag
- Added `--dev` global flag
- Added `--log-file` global flag
- Initialize test suite
- CI pipeline for code quality checks

---

Expand Down
7 changes: 6 additions & 1 deletion src/commands/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ pub(crate) fn update(command: &Command) -> Status {
}

if !version.is_empty() {
if !VersionNumber::new().parse_from_string(&version) {
let mut version_number = VersionNumber::new();
if !version_number.parse_from_string(&version) {
return Status::error(format!("Invalid version number: {}", version));
}
if version_number.is_older(&VersionNumber::from_string("1.0.0")) {
return Status::error("Versions older than 1.0.0 are not supported.".to_string());
}

log!("Updating templify to version {}...", version);
} else {
log!("Updating templify...");
Expand Down
21 changes: 21 additions & 0 deletions src/types/version_number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ impl VersionNumber {
}
}

/// Create a new version number from a string
pub fn from_string(version: &str) -> VersionNumber {
let mut version_number = VersionNumber::new();
version_number.parse_from_string(version);
version_number
}

/// Parse a version number from a string and return if it was successful
pub fn parse_from_string(&mut self, version: &str) -> bool {
let parts: Vec<&str> = version.split('.').collect();
Expand Down Expand Up @@ -45,4 +52,18 @@ impl VersionNumber {
}
false
}

/// Check if this version number is older than the other
pub fn is_older(&self, other: &VersionNumber) -> bool {
if self.major < other.major {
return true;
}
if self.major == other.major && self.minor < other.minor {
return true;
}
if self.major == other.major && self.minor == other.minor && self.patch < other.patch {
return true;
}
false
}
}

0 comments on commit cd03df1

Please sign in to comment.