mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Rename Project to SourceProject
This commit is contained in:
parent
204084dcae
commit
6b9367c370
3 changed files with 14 additions and 14 deletions
|
|
@ -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());
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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<u64>) {
|
||||
let server_id = rand::random::<u64>();
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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<String, ProjectPartition>,
|
||||
pub partitions: HashMap<String, SourceProjectPartition>,
|
||||
}
|
||||
|
||||
impl Project {
|
||||
impl SourceProject {
|
||||
/// Initializes a new project inside the given folder path.
|
||||
pub fn init<T: AsRef<Path>>(location: T) -> Result<Project, ProjectInitError> {
|
||||
pub fn init<T: AsRef<Path>>(location: T) -> Result<SourceProject, ProjectInitError> {
|
||||
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<T: AsRef<Path>>(location: T) -> Result<Project, ProjectLoadError> {
|
||||
pub fn load<T: AsRef<Path>>(location: T) -> Result<SourceProject, ProjectLoadError> {
|
||||
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(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue