diff --git a/.github/workflows/check_rust_quality.yml b/.github/workflows/check_rust_quality.yml index 59f1cc1..3d16cd4 100644 --- a/.github/workflows/check_rust_quality.yml +++ b/.github/workflows/check_rust_quality.yml @@ -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 }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b40be1..e7228a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 23f310f..97e869c 100644 --- a/README.md +++ b/README.md @@ -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 --- diff --git a/src/commands/update.rs b/src/commands/update.rs index 8839a54..af32156 100644 --- a/src/commands/update.rs +++ b/src/commands/update.rs @@ -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..."); diff --git a/src/types/version_number.rs b/src/types/version_number.rs index 4c0d439..4f444fd 100644 --- a/src/types/version_number.rs +++ b/src/types/version_number.rs @@ -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(); @@ -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 + } }