Skip to content

Commit 77eb55d

Browse files
committed
Refactor data to settings (specificity)
1 parent d721743 commit 77eb55d

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/cli.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use clap::{Clap, ArgMatches, FromArgMatches};
1010

1111
use crate as deploy;
1212

13-
use self::deploy::{DeployFlake, ParseFlakeError};
13+
use self::deploy::{DeployFlake, ParseFlakeError, settings};
1414
use futures_util::stream::{StreamExt, TryStreamExt};
1515
use log::{debug, error, info, warn};
1616
use serde::Serialize;
@@ -173,7 +173,7 @@ async fn get_deployment_data(
173173
supports_flakes: bool,
174174
flakes: &[deploy::DeployFlake<'_>],
175175
extra_build_args: &[String],
176-
) -> Result<Vec<deploy::data::Data>, GetDeploymentDataError> {
176+
) -> Result<Vec<settings::Root>, GetDeploymentDataError> {
177177
futures_util::stream::iter(flakes).then(|flake| async move {
178178

179179
info!("Evaluating flake in {}", flake.repo);
@@ -392,14 +392,14 @@ pub enum RunDeployError {
392392

393393
type ToDeploy<'a> = Vec<(
394394
&'a deploy::DeployFlake<'a>,
395-
&'a deploy::data::Data,
396-
(&'a str, &'a deploy::data::Node),
397-
(&'a str, &'a deploy::data::Profile),
395+
&'a settings::Root,
396+
(&'a str, &'a settings::Node),
397+
(&'a str, &'a settings::Profile),
398398
)>;
399399

400400
async fn run_deploy(
401401
deploy_flakes: Vec<deploy::DeployFlake<'_>>,
402-
data: Vec<deploy::data::Data>,
402+
data: Vec<settings::Root>,
403403
supports_flakes: bool,
404404
check_sigs: bool,
405405
interactive: bool,
@@ -440,7 +440,7 @@ async fn run_deploy(
440440
None => return Err(RunDeployError::NodeNotFound(node_name.to_owned())),
441441
};
442442

443-
let mut profiles_list: Vec<(&str, &deploy::data::Profile)> = Vec::new();
443+
let mut profiles_list: Vec<(&str, &settings::Profile)> = Vec::new();
444444

445445
for profile_name in [
446446
node.node_settings.profiles_order.iter().collect(),
@@ -471,7 +471,7 @@ async fn run_deploy(
471471
let mut l = Vec::new();
472472

473473
for (node_name, node) in &data.nodes {
474-
let mut profiles_list: Vec<(&str, &deploy::data::Profile)> = Vec::new();
474+
let mut profiles_list: Vec<(&str, &settings::Profile)> = Vec::new();
475475

476476
for profile_name in [
477477
node.node_settings.profiles_order.iter().collect(),

src/lib.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ pub fn init_logger(
145145
Ok(())
146146
}
147147

148-
pub mod data;
148+
pub mod settings;
149149
pub mod deploy;
150150
pub mod push;
151151
pub mod cli;
@@ -312,13 +312,13 @@ fn test_parse_flake() {
312312
#[derive(Debug, Clone)]
313313
pub struct DeployData<'a> {
314314
pub node_name: &'a str,
315-
pub node: &'a data::Node,
315+
pub node: &'a settings::Node,
316316
pub profile_name: &'a str,
317-
pub profile: &'a data::Profile,
317+
pub profile: &'a settings::Profile,
318318

319319
pub cmd_overrides: &'a CmdOverrides,
320320

321-
pub merged_settings: data::GenericSettings,
321+
pub merged_settings: settings::GenericSettings,
322322

323323
pub debug_logs: bool,
324324
pub log_dir: Option<&'a str>,
@@ -395,10 +395,10 @@ impl<'a> DeployData<'a> {
395395
}
396396

397397
pub fn make_deploy_data<'a, 's>(
398-
top_settings: &'s data::GenericSettings,
399-
node: &'a data::Node,
398+
top_settings: &'s settings::GenericSettings,
399+
node: &'a settings::Node,
400400
node_name: &'a str,
401-
profile: &'a data::Profile,
401+
profile: &'a settings::Profile,
402402
profile_name: &'a str,
403403
cmd_overrides: &'a CmdOverrides,
404404
debug_logs: bool,

src/data.rs src/settings.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub struct Node {
6666
}
6767

6868
#[derive(Deserialize, Debug, Clone)]
69-
pub struct Data {
69+
pub struct Root {
7070
#[serde(flatten)]
7171
pub generic_settings: GenericSettings,
7272
pub nodes: HashMap<String, Node>,

0 commit comments

Comments
 (0)