Compare commits

..

9 Commits

Author SHA1 Message Date
Lucien Greathouse
13925f5879 Publish 0.3.2 2017-12-20 22:41:23 -08:00
Lucien Greathouse
2e340ff78c Merge pull request #22 from Quenty/fix-21-high-cpu
Fix #21: High CPU usage in a small project
2017-12-17 21:42:21 -08:00
James Onnen
5a20646c57 Address code review, remove unnecessary import 2017-12-17 23:40:32 -06:00
James Onnen
199ebda689 Use ::park() instead of ::sleep() 2017-12-17 14:34:31 -06:00
James Onnen
ae6ca6fb23 Fix #21: High CPU usage in a small project 2017-12-17 14:20:24 -06:00
Lucien Greathouse
b4e31ea35d Fix serve path failing to be absolute when given as a relative path 2017-12-14 01:09:10 -08:00
Lucien Greathouse
7c6fe38346 CLI version 0.3.1 2017-12-14 00:24:01 -08:00
Lucien Greathouse
f89d491f29 Run rustfmt
I ignored some odd formatting it introduced relating to putting braces on newlines in if-let blocks. This might be a bug, but I didn't find any way to turn that off.
2017-12-13 12:05:11 -08:00
Lucien Greathouse
59b2401c2c Add more detailed error reporting around invalid projects 2017-12-13 11:56:06 -08:00
8 changed files with 59 additions and 16 deletions

View File

@@ -1,7 +1,14 @@
# Rojo Change Log
## Current Master
* *No changes*
* No changes
## 0.3.2
* Fixed `rojo serve` failing to correctly construct an absolute root path when passed as an argument
## 0.3.1
* Improved error reporting when invalid JSON is found in a `rojo.json` project
* These messages are passed on from Serde
## 0.3.0
* Factored out the plugin into a separate repository

2
Cargo.lock generated
View File

@@ -517,7 +517,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "rojo"
version = "0.3.0"
version = "0.3.2"
dependencies = [
"clap 2.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
"notify 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@@ -1,6 +1,6 @@
[package]
name = "rojo"
version = "0.3.0"
version = "0.3.2"
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
description = "A tool to create robust Roblox projects"
license = "MIT"

View File

@@ -25,7 +25,7 @@ use std::thread;
use core::Config;
use pathext::canonicalish;
use project::Project;
use project::{Project, ProjectLoadError};
use vfs::Vfs;
use vfs_watch::VfsWatcher;
@@ -85,7 +85,7 @@ fn main() {
let sub_matches = sub_matches.unwrap();
let project_path = match sub_matches.value_of("PROJECT") {
Some(v) => PathBuf::from(v),
Some(v) => canonicalish(PathBuf::from(v)),
None => std::env::current_dir().unwrap(),
};
@@ -98,8 +98,32 @@ fn main() {
println!("Using project from {}", project_path.display());
v
},
Err(_) => {
println!("Using default project...");
Err(err) => {
match err {
ProjectLoadError::InvalidJson(serde_err) => {
eprintln!(
"Found invalid JSON!\nProject in: {}\nError: {}",
project_path.display(),
serde_err,
);
std::process::exit(1);
},
ProjectLoadError::FailedToOpen | ProjectLoadError::FailedToRead => {
eprintln!("Found project file, but failed to read it!");
eprintln!(
"Check the permissions of the project file at\n{}",
project_path.display(),
);
std::process::exit(1);
},
_ => {
// Any other error is fine; use the default project.
},
}
println!("Found no project file, using default project...");
Project::default()
},
};
@@ -169,7 +193,9 @@ fn main() {
println!("Server listening on port {}", port);
loop {}
loop {
thread::park();
}
},
("pack", _) => {
eprintln!("'rojo pack' is not yet implemented!");

View File

@@ -31,7 +31,11 @@ fn test_path_to_route() {
assert_eq!(path_to_route(root, value), result);
}
t(Path::new("/a/b/c"), Path::new("/a/b/c/d"), Some(vec!["d".to_string()]));
t(
Path::new("/a/b/c"),
Path::new("/a/b/c/d"),
Some(vec!["d".to_string()]),
);
t(Path::new("/a/b"), Path::new("a"), None);
}
@@ -42,7 +46,11 @@ fn test_path_to_route_windows() {
assert_eq!(path_to_route(root, value), result);
}
t(Path::new("C:\\foo"), Path::new("C:\\foo\\bar\\baz"), Some(vec!["bar".to_string(), "baz".to_string()]));
t(
Path::new("C:\\foo"),
Path::new("C:\\foo\\bar\\baz"),
Some(vec!["bar".to_string(), "baz".to_string()]),
);
}
/// Turns the path into an absolute one, using the current working directory if

View File

@@ -13,7 +13,7 @@ pub enum ProjectLoadError {
DidNotExist,
FailedToOpen,
FailedToRead,
Invalid,
InvalidJson(serde_json::Error),
}
#[derive(Debug)]
@@ -116,7 +116,7 @@ impl Project {
match serde_json::from_str(&contents) {
Ok(v) => Ok(v),
Err(_) => return Err(ProjectLoadError::Invalid),
Err(e) => return Err(ProjectLoadError::InvalidJson(e)),
}
}

View File

@@ -4,9 +4,9 @@ use std::time::Duration;
use notify::{DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
use vfs::Vfs;
use pathext::path_to_route;
use core::Config;
use pathext::path_to_route;
use vfs::Vfs;
pub struct VfsWatcher {
vfs: Arc<Mutex<Vfs>>,
@@ -92,6 +92,8 @@ impl VfsWatcher {
}
}
loop {}
loop {
thread::park();
}
}
}

View File

@@ -8,7 +8,7 @@ use serde_json;
use core::Config;
use project::Project;
use vfs::{Vfs, VfsItem, VfsChange};
use vfs::{Vfs, VfsChange, VfsItem};
static MAX_BODY_SIZE: usize = 25 * 1024 * 1025; // 25 MiB