diff --git a/server/src/commands/init.rs b/server/src/commands/init.rs index 96cbbcb3..a27ef083 100644 --- a/server/src/commands/init.rs +++ b/server/src/commands/init.rs @@ -1,10 +1,10 @@ use std::path::PathBuf; use std::process; -use project::Project; +use project::SourceProject; pub fn init(project_path: &PathBuf) { - match Project::init(project_path) { + match SourceProject::init(project_path) { Ok(_) => { println!("Created new empty project at {}", project_path.display()); }, diff --git a/server/src/commands/serve.rs b/server/src/commands/serve.rs index 4e8e48ff..16b3b922 100644 --- a/server/src/commands/serve.rs +++ b/server/src/commands/serve.rs @@ -5,7 +5,7 @@ use std::fs; use rand; -use project::Project; +use project::SourceProject; use web; use session::{Session, SessionConfig}; use partition::Partition; @@ -13,7 +13,7 @@ use partition::Partition; pub fn serve(project_path: &PathBuf, port: Option) { let server_id = rand::random::(); - let project = match Project::load(project_path) { + let project = match SourceProject::load(project_path) { Ok(v) => { println!("Using project from {}", fs::canonicalize(project_path).unwrap().display()); v diff --git a/server/src/project.rs b/server/src/project.rs index 6c278819..dac531d3 100644 --- a/server/src/project.rs +++ b/server/src/project.rs @@ -63,7 +63,7 @@ impl fmt::Display for ProjectInitError { #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] -pub struct ProjectPartition { +pub struct SourceProjectPartition { /// A slash-separated path to a file or folder, relative to the project's /// directory. pub path: String, @@ -79,15 +79,15 @@ pub struct ProjectPartition { /// configurables #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(default, rename_all = "camelCase")] -pub struct Project { +pub struct SourceProject { pub name: String, pub serve_port: u64, - pub partitions: HashMap, + pub partitions: HashMap, } -impl Project { +impl SourceProject { /// Initializes a new project inside the given folder path. - pub fn init>(location: T) -> Result { + pub fn init>(location: T) -> Result { let location = location.as_ref(); let package_path = location.join(PROJECT_FILENAME); @@ -109,7 +109,7 @@ impl Project { let serve_port = rand::thread_rng().gen_range(2000, 49151); // Configure the project with all of the values we know so far. - let project = Project { + let project = SourceProject { name, serve_port, partitions: HashMap::new(), @@ -124,7 +124,7 @@ impl Project { /// Attempts to load a project from the file named PROJECT_FILENAME from the /// given folder. - pub fn load>(location: T) -> Result { + pub fn load>(location: T) -> Result { let package_path = location.as_ref().join(Path::new(PROJECT_FILENAME)); fs::metadata(&package_path) @@ -157,9 +157,9 @@ impl Project { } } -impl Default for Project { - fn default() -> Project { - Project { +impl Default for SourceProject { + fn default() -> SourceProject { + SourceProject { name: "new-project".to_string(), serve_port: 8000, partitions: HashMap::new(),