Convert core to library for easier testing

This commit is contained in:
Lucien Greathouse 2018-04-04 23:29:45 -07:00
parent 8d87d81f49
commit 6c0a0efd5b
3 changed files with 28 additions and 22 deletions

View file

@ -6,6 +6,10 @@ description = "A tool to create robust Roblox projects"
license = "MIT"
repository = "https://github.com/LPGhatguy/rojo"
[lib]
name = "rojo_core"
path = "src/lib.rs"
[[bin]]
name = "rojo"
path = "src/bin.rs"

View file

@ -1,29 +1,11 @@
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate rouille;
#[macro_use] extern crate clap;
#[macro_use] extern crate lazy_static;
extern crate notify;
extern crate rand;
extern crate serde;
extern crate serde_json;
extern crate regex;
pub mod rbx_session;
pub mod id;
pub mod web;
pub mod core;
pub mod project;
pub mod pathext;
pub mod vfs;
pub mod rbx;
pub mod middleware;
pub mod middlewares;
pub mod commands;
extern crate rojo_core;
use std::path::{Path, PathBuf};
use std::process;
use pathext::canonicalish;
use rojo_core::pathext::canonicalish;
fn main() {
let matches = clap_app!(rojo =>
@ -61,7 +43,7 @@ fn main() {
let project_path = Path::new(sub_matches.value_of("PATH").unwrap_or("."));
let full_path = canonicalish(project_path);
commands::init(&full_path);
rojo_core::commands::init(&full_path);
},
("serve", sub_matches) => {
let sub_matches = sub_matches.unwrap();
@ -84,7 +66,7 @@ fn main() {
}
};
commands::serve(&project_path, verbose, port);
rojo_core::commands::serve(&project_path, verbose, port);
},
("pack", _) => {
eprintln!("'rojo pack' is not yet implemented!");

20
server/src/lib.rs Normal file
View file

@ -0,0 +1,20 @@
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate rouille;
#[macro_use] extern crate lazy_static;
extern crate notify;
extern crate rand;
extern crate serde;
extern crate serde_json;
extern crate regex;
pub mod rbx_session;
pub mod id;
pub mod web;
pub mod core;
pub mod project;
pub mod pathext;
pub mod vfs;
pub mod rbx;
pub mod middleware;
pub mod middlewares;
pub mod commands;