From a3accf213a499e782cd7768c023b9ec983e3e5e9 Mon Sep 17 00:00:00 2001 From: "R. Tyler Croy" Date: Fri, 1 Jan 2021 10:10:01 -0800 Subject: [PATCH] Refactor the parser package into a "model" package which is more accurate Most of its job is to contain the models for different data structures --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- cli/Cargo.toml | 2 +- cli/src/main.rs | 4 ++-- cli/src/transport/mod.rs | 2 +- cli/src/transport/ssh.rs | 2 +- {parser => model}/Cargo.toml | 2 +- {parser => model}/src/lib.rs | 0 {parser => model}/src/plan.pest | 0 {parser => model}/src/plan.rs | 0 {parser => model}/src/task.pest | 0 {parser => model}/src/task.rs | 0 12 files changed, 9 insertions(+), 9 deletions(-) rename {parser => model}/Cargo.toml (89%) rename {parser => model}/src/lib.rs (100%) rename {parser => model}/src/plan.pest (100%) rename {parser => model}/src/plan.rs (100%) rename {parser => model}/src/task.pest (100%) rename {parser => model}/src/task.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 1f3f66f..cbde67e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -619,11 +619,11 @@ dependencies = [ "serde_json", "serde_yaml", "ssh2", - "zap-parser", + "zap-model", ] [[package]] -name = "zap-parser" +name = "zap-model" version = "0.1.0" dependencies = [ "handlebars", diff --git a/Cargo.toml b/Cargo.toml index 388a55c..8dc5a01 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] members = [ 'cli', - 'parser', + 'model', ] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 8bbdf15..2a36010 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -16,4 +16,4 @@ serde_derive = "~1.0" serde_json = "~1.0" serde_yaml = "~0.8" ssh2 = "~0.9.0" -zap-parser = { path = "../parser" } +zap-model = { path = "../model" } diff --git a/cli/src/main.rs b/cli/src/main.rs index 800d7da..9e37040 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -10,8 +10,8 @@ mod transport; use crate::inventory::*; use crate::transport::ssh::Ssh; -use zap_parser::plan::{ExecutableTask, Plan}; -use zap_parser::task::Task; +use zap_model::plan::{ExecutableTask, Plan}; +use zap_model::task::Task; fn main() { pretty_env_logger::init(); diff --git a/cli/src/transport/mod.rs b/cli/src/transport/mod.rs index 9a5e918..61af0ae 100644 --- a/cli/src/transport/mod.rs +++ b/cli/src/transport/mod.rs @@ -1,6 +1,6 @@ use crate::inventory::{Group, Inventory, Target}; use std::path::Path; -use zap_parser::plan::ExecutableTask; +use zap_model::plan::ExecutableTask; pub mod ssh; diff --git a/cli/src/transport/ssh.rs b/cli/src/transport/ssh.rs index 9641019..3b75117 100644 --- a/cli/src/transport/ssh.rs +++ b/cli/src/transport/ssh.rs @@ -10,7 +10,7 @@ use std::io::BufReader; use std::net::TcpStream; use std::path::Path; -use zap_parser::plan::ExecutableTask; +use zap_model::plan::ExecutableTask; #[derive(Clone)] pub struct Ssh { diff --git a/parser/Cargo.toml b/model/Cargo.toml similarity index 89% rename from parser/Cargo.toml rename to model/Cargo.toml index 2670723..5308b21 100644 --- a/parser/Cargo.toml +++ b/model/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "zap-parser" +name = "zap-model" version = "0.1.0" authors = ["R. Tyler Croy "] edition = "2018" diff --git a/parser/src/lib.rs b/model/src/lib.rs similarity index 100% rename from parser/src/lib.rs rename to model/src/lib.rs diff --git a/parser/src/plan.pest b/model/src/plan.pest similarity index 100% rename from parser/src/plan.pest rename to model/src/plan.pest diff --git a/parser/src/plan.rs b/model/src/plan.rs similarity index 100% rename from parser/src/plan.rs rename to model/src/plan.rs diff --git a/parser/src/task.pest b/model/src/task.pest similarity index 100% rename from parser/src/task.pest rename to model/src/task.pest diff --git a/parser/src/task.rs b/model/src/task.rs similarity index 100% rename from parser/src/task.rs rename to model/src/task.rs