diff --git a/README.md b/README.md index 374c7cb..4ba403a 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,6 @@ file in the provided directory. ```yml # rocat.yml -placeFiles: - start: start-place.rbxlx - world: world-place.rbxl - deployments: - name: staging branches: [dev, dev/*] @@ -89,6 +85,7 @@ templates: - game-thumbnail-3.png places: start: + file: start-place.rbxlx name: The Best Experience Ever description: | The best multi-line @@ -96,6 +93,8 @@ templates: maxPlayerCount: 25 serverFill: { reservedSlots: 10 } # or robloxOptimized or maximum allowCopying: false + world: + file: world-place.rbxl ``` To deploy the above configuration with Rocat, run `rocat deploy` from the file's directory. diff --git a/project-fixtures/multi-places/rocat.yml b/project-fixtures/multi-places/rocat.yml index 48113db..ce40b78 100644 --- a/project-fixtures/multi-places/rocat.yml +++ b/project-fixtures/multi-places/rocat.yml @@ -1,7 +1,3 @@ -placeFiles: - start: start.rbxlx - world: world.rbxlx - deployments: - name: staging branches: [dev, dev/*] @@ -23,8 +19,10 @@ templates: name: Rocat Test Experience places: start: + file: start.rbxlx name: Rocat Test Start Place world: + world: start.rbxlx name: Rocat Test World Place state: diff --git a/project-fixtures/single-place/rocat.yml b/project-fixtures/single-place/rocat.yml index a5304be..a2f3078 100644 --- a/project-fixtures/single-place/rocat.yml +++ b/project-fixtures/single-place/rocat.yml @@ -1,6 +1,3 @@ -placeFiles: - start: start.rbxlx - deployments: - name: staging branches: [dev, dev/*] @@ -31,6 +28,7 @@ templates: - game-thumbnail-3.png places: start: + file: start.rbxlx name: Start name description: Start description maxPlayerCount: 20 diff --git a/src/config.rs b/src/config.rs index 7ef4a3e..eae9648 100644 --- a/src/config.rs +++ b/src/config.rs @@ -10,9 +10,6 @@ use std::{collections::HashMap, default, fmt, fs, path::Path, str}; #[derive(Deserialize)] #[serde(rename_all = "camelCase")] pub struct Config { - #[serde(default = "HashMap::new")] - pub place_files: HashMap, - #[serde(default = "Vec::new")] pub deployments: Vec, @@ -234,6 +231,7 @@ pub enum ServerFillConfig { #[derive(Deserialize, Clone)] #[serde(rename_all = "camelCase")] pub struct PlaceTemplateConfig { + pub file: String, pub name: Option, pub description: Option, pub max_player_count: Option, diff --git a/src/state.rs b/src/state.rs index 327a502..24992c9 100644 --- a/src/state.rs +++ b/src/state.rs @@ -120,9 +120,11 @@ fn get_default_resources( for (name, id) in deployment_config.place_ids.iter() { let place_file = config - .place_files + .templates + .places .get(name) - .ok_or(format!("No place file configured for place {}", name))?; + .map(|p| p.file.clone()) + .ok_or(format!("No place file configured for place: {}", name))?; let place_file_resource = Resource::new(resource_types::PLACE_FILE, name) .add_output("assetId", &id)? .add_ref_input("experienceId", &experience_asset_id_ref) @@ -211,9 +213,11 @@ pub fn get_desired_graph( for (name, id) in deployment_config.place_ids.iter() { let place_file = config - .place_files + .templates + .places .get(name) - .ok_or(format!("No place file configured for place {}", name))?; + .map(|p| p.file.clone()) + .ok_or(format!("No place file configured for place: {}", name))?; let place_file_resource = Resource::new(resource_types::PLACE_FILE, name) .add_output("assetId", &id)? .add_ref_input("experienceId", &experience_asset_id_ref)