Skip to content

Commit

Permalink
Rename version functions
Browse files Browse the repository at this point in the history
  • Loading branch information
BiancaIalangi committed Dec 18, 2023
1 parent 1607104 commit 209c02e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions framework/meta/src/cmd/standalone/template/copy_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
path::{Path, PathBuf},
};

use crate::version_history::validate_template_with_autogenerated_json;
use crate::version_history::is_template_with_autogenerated_json;

/// Will copy an entire folder according to a whitelist of allowed paths.
///
Expand All @@ -18,7 +18,7 @@ pub fn whitelisted_deep_copy(
whitelist: &[String],
args_tag: &str,
) {
if validate_template_with_autogenerated_json(args_tag) {
if is_template_with_autogenerated_json(args_tag) {
perform_file_copy(source_root, &PathBuf::new(), target_root, whitelist);
} else {
let mut tmp_whitelist = whitelist.to_vec();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::{template_metadata::TemplateMetadata, ContractCreatorTarget};
use crate::{
cmd::standalone::upgrade::upgrade_common::{rename_files, replace_in_files},
version_history::validate_template_with_autogenerated_wasm,
version_history::is_template_with_autogenerated_wasm,
CargoTomlContents,
};
use convert_case::{Case, Casing};
Expand Down Expand Up @@ -50,7 +50,7 @@ impl TemplateAdjuster {
}

fn update_dependencies_wasm(&self, args_tag: &str) {
if validate_template_with_autogenerated_wasm(args_tag) {
if is_template_with_autogenerated_wasm(args_tag) {
return;
}

Expand Down
12 changes: 6 additions & 6 deletions framework/meta/src/version_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn template_versions_with_autogenerated_wasm() -> &'static [&'static str] {
&VERSIONS[40..]
}

pub fn validate_template_with_autogenerated_wasm(tag: &str) -> bool {
pub fn is_template_with_autogenerated_wasm(tag: &str) -> bool {
template_versions_with_autogenerated_wasm()
.iter()
.any(|&tt| tt == tag)
Expand All @@ -78,7 +78,7 @@ pub fn template_versions_with_autogenerated_json() -> &'static [&'static str] {
&VERSIONS[39..]
}

pub fn validate_template_with_autogenerated_json(tag: &str) -> bool {
pub fn is_template_with_autogenerated_json(tag: &str) -> bool {
template_versions_with_autogenerated_json()
.iter()
.any(|&tt| tt == tag)
Expand Down Expand Up @@ -139,15 +139,15 @@ pub mod tests {
fn template_versions_with_autogenerated_wasm_test() {
assert_eq!(template_versions_with_autogenerated_wasm()[0], "0.45.0");

assert!(validate_template_with_autogenerated_wasm("0.45.0"));
assert!(!validate_template_with_autogenerated_wasm("0.44.0"));
assert!(is_template_with_autogenerated_wasm("0.45.0"));
assert!(!is_template_with_autogenerated_wasm("0.44.0"));
}

#[test]
fn template_versions_with_autogenerated_json_test() {
assert_eq!(template_versions_with_autogenerated_json()[0], "0.44.0");

assert!(validate_template_with_autogenerated_json("0.44.0"));
assert!(!validate_template_with_autogenerated_json("0.43.0"));
assert!(is_template_with_autogenerated_json("0.44.0"));
assert!(!is_template_with_autogenerated_json("0.43.0"));
}
}

0 comments on commit 209c02e

Please sign in to comment.