Skip to content

Commit

Permalink
dependencies cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Philosobyte committed Aug 22, 2023
1 parent 4968708 commit 922a941
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 49 deletions.
44 changes: 20 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# tera-rand   [![build status]][actions] [![rustc Version 1.64+]][rustc]
# tera-rand   [![build status]][actions] [![rustc Version 1.65+]][rustc]
tera-rand is a suite of random data generation functions for the [Tera] template engine.

[build status]: https://img.shields.io/github/actions/workflow/status/philosobyte/tera-rand/ci.yml?branch=main
[actions]: https://github.com/philosobyte/tera-rand/actions?query=branch%3Amain
[Tera]: https://github.com/Keats/tera
[rustc Version 1.64+]: https://img.shields.io/badge/rustc-1.64+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2022/09/22/Rust-1.64.0.html
[rustc Version 1.65+]: https://img.shields.io/badge/rustc-1.65+-lightgray.svg
[rustc]: https://blog.rust-lang.org/2022/09/22/Rust-1.65.0.html
36 changes: 20 additions & 16 deletions tera-rand/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
[package]
name = "tera-rand"
version = "0.1.0"
authors = ["Raymond Liu <philosobyte@gmail.com>"]
categories = ["template-engine",]
description = "A suite of random data generation functions for the Tera template engine"
edition = "2021"
rust-version = "1.65"
keywords = ["fake",]
license = "MIT OR Apache-2.0"
repository = "https://github.com/Philosobyte/tera-rand"
rust-version = "1.65"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
thiserror = "1.0.40"
anyhow = "1.0.71"
dashmap = "5.4.0"
lazy_static = "1.4.0"
tracing = "0.1.37"
tracing-subscriber = "0.3.17"
tracing-test = "0.2.4"
rand = "0.8.5"
rand_distr = { version = "0.4.3", optional = true }
regex = "1.8.1"
tera = "1.18.1"
anyhow = "=1.0.75"
dashmap = "=5.5.1"
lazy_static = "=1.4.0"
rand = "=0.8.5"
serde = "=1.0.185"
tera = "=1.19.0"
thiserror = "=1.0.47"
uuid = { version = "=1.4.1", features = ["v4"], optional = true }

serde = { version = "1.0.162" }
serde_json = "1.0.96"
uuid = { version = "1.3.2", features = ["v4"], optional = true }
[dev-dependencies]
regex = "=1.9.3"
tracing = "=0.1.37"
tracing-subscriber = "=0.3.17"
tracing-test = "=0.2.4"

[features]
default = ["uuid", "rand_distr"]
default = ["uuid",]
3 changes: 0 additions & 3 deletions tera-rand/src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::collections::HashMap;
use std::fs::File;
use std::io::{BufRead, BufReader};
use tera::{to_value, Result, Value};
use tracing::trace;

lazy_static! {
static ref FILE_CACHE: DashMap<String, Vec<String>> = DashMap::new();
Expand Down Expand Up @@ -47,7 +46,6 @@ pub fn random_from_file(args: &HashMap<String, Value>) -> Result<Value> {
for line_result in buf_reader.lines() {
let line: String = line_result
.map_err(|source| read_file_error("random_from_file", filepath.clone(), source))?;
trace!(line);
file_values.push(line);
}

Expand All @@ -61,7 +59,6 @@ pub fn random_from_file(args: &HashMap<String, Value>) -> Result<Value> {
match possible_values_opt {
Some(reference) => {
let possible_values: &Vec<String> = reference.value();
trace!("possible_values: {possible_values:?}");
let index_to_sample: usize = thread_rng().gen_range(0usize..possible_values.len());

match possible_values.get(index_to_sample) {
Expand Down
3 changes: 0 additions & 3 deletions tera-rand/src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use rand::{thread_rng, Rng};
use std::collections::HashMap;
use std::net::{Ipv4Addr, Ipv6Addr};
use tera::{to_value, Result, Value};
use tracing::trace;

/// A Tera function to generate a random IPv4 address.
///
Expand Down Expand Up @@ -162,7 +161,6 @@ pub fn random_ipv4_cidr(args: &HashMap<String, Value>) -> Result<Value> {

let random_prefix_length: u32 = thread_rng().gen_range(length_start..=length_end);
let bits_to_shift: u32 = u32::BITS - random_prefix_length;
trace!("random_prefix_length: {random_prefix_length}, bits_to_shift: {bits_to_shift}, random_addr: {random_addr}");

let random_prefix: u32 = match bits_to_shift {
u32::BITS => 0u32,
Expand Down Expand Up @@ -227,7 +225,6 @@ pub fn random_ipv6_cidr(args: &HashMap<String, Value>) -> Result<Value> {

let random_prefix_length: u32 = thread_rng().gen_range(length_start..=length_end);
let bits_to_shift: u32 = u128::BITS - random_prefix_length;
trace!("random_prefix_length: {random_prefix_length}, bits_to_shift: {bits_to_shift}, random_addr: {random_addr}");

let random_prefix: u128 = match bits_to_shift {
u128::BITS => 0u128,
Expand Down

0 comments on commit 922a941

Please sign in to comment.