mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 20:55:50 +00:00
Comment out roblox_studio mechanisms for now, start using env_logger
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#[macro_use] extern crate clap;
|
||||
#[macro_use] extern crate log;
|
||||
extern crate env_logger;
|
||||
|
||||
extern crate librojo;
|
||||
|
||||
@@ -8,6 +10,10 @@ use std::process;
|
||||
use librojo::pathext::canonicalish;
|
||||
|
||||
fn main() {
|
||||
env_logger::Builder::from_default_env()
|
||||
.default_format_timestamp(false)
|
||||
.init();
|
||||
|
||||
let matches = clap_app!(rojo =>
|
||||
(version: env!("CARGO_PKG_VERSION"))
|
||||
(author: env!("CARGO_PKG_AUTHORS"))
|
||||
@@ -45,8 +51,8 @@ fn main() {
|
||||
librojo::commands::serve(&project_path);
|
||||
},
|
||||
_ => {
|
||||
eprintln!("Please specify a subcommand!");
|
||||
eprintln!("Try 'rojo help' for information.");
|
||||
error!("Please specify a subcommand!");
|
||||
error!("Try 'rojo help' for information.");
|
||||
process::exit(1);
|
||||
},
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ pub fn init(project_path: &PathBuf) {
|
||||
println!("Created new empty project at {}", project_path.display());
|
||||
},
|
||||
Err(e) => {
|
||||
eprintln!("Failed to create new project.\n{}", e);
|
||||
error!("Failed to create new project.\n{}", e);
|
||||
process::exit(1);
|
||||
},
|
||||
}
|
||||
|
||||
@@ -8,22 +8,24 @@ use ::{
|
||||
project::Project,
|
||||
web::Server,
|
||||
session::Session,
|
||||
roblox_studio,
|
||||
// roblox_studio,
|
||||
};
|
||||
|
||||
pub fn serve(fuzzy_project_location: &Path) {
|
||||
info!("Looking for project at {}", fuzzy_project_location.display());
|
||||
|
||||
let project = match Project::load_fuzzy(fuzzy_project_location) {
|
||||
Ok(project) => project,
|
||||
Err(error) => {
|
||||
eprintln!("Fatal: {}", error);
|
||||
error!("{}", error);
|
||||
process::exit(1);
|
||||
},
|
||||
};
|
||||
|
||||
println!("Found project at {}", project.file_location.display());
|
||||
println!("Using project {:#?}", project);
|
||||
info!("Found project at {}", project.file_location.display());
|
||||
info!("Using project {:#?}", project);
|
||||
|
||||
roblox_studio::install_bundled_plugin().unwrap();
|
||||
// roblox_studio::install_bundled_plugin().unwrap();
|
||||
|
||||
let session = Arc::new({
|
||||
let mut session = Session::new(project);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#[macro_use] extern crate serde_derive;
|
||||
#[macro_use] extern crate rouille;
|
||||
#[macro_use] extern crate lazy_static;
|
||||
#[macro_use] extern crate log;
|
||||
extern crate notify;
|
||||
extern crate rand;
|
||||
extern crate serde;
|
||||
@@ -16,7 +17,7 @@ pub mod message_queue;
|
||||
pub mod pathext;
|
||||
pub mod project;
|
||||
pub mod rbx;
|
||||
pub mod roblox_studio;
|
||||
// pub mod roblox_studio;
|
||||
pub mod session;
|
||||
pub mod vfs;
|
||||
pub mod web;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::env;
|
||||
|
||||
#[cfg(all(not(debug_assertions), not(feature = "bundle-plugin")))]
|
||||
compile_error!("`bundle-plugin` feature must be set for release builds.");
|
||||
@@ -14,6 +13,8 @@ static PLUGIN_RBXM: &'static [u8] = include_bytes!("../target/plugin.rbxmx");
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn get_install_location() -> Option<PathBuf> {
|
||||
use std::env;
|
||||
|
||||
let local_app_data = env::var("LocalAppData").ok()?;
|
||||
let mut location = PathBuf::from(local_app_data);
|
||||
|
||||
@@ -46,7 +47,7 @@ pub fn install_bundled_plugin() -> Option<()> {
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
|
||||
println!("Installing plugin...");
|
||||
info!("Installing plugin...");
|
||||
|
||||
let mut file = File::create(get_plugin_location()?).ok()?;
|
||||
file.write_all(PLUGIN_RBXM).ok()?;
|
||||
@@ -56,7 +57,7 @@ pub fn install_bundled_plugin() -> Option<()> {
|
||||
|
||||
#[cfg(not(feature = "bundle-plugin"))]
|
||||
pub fn install_bundled_plugin() -> Option<()> {
|
||||
println!("Skipping plugin installation, bundle-plugin not set.");
|
||||
info!("Skipping plugin installation, bundle-plugin not set.");
|
||||
|
||||
Some(())
|
||||
}
|
||||
@@ -71,7 +71,7 @@ impl Session {
|
||||
}
|
||||
|
||||
for root in vfs.get_roots() {
|
||||
println!("Watching {}", root.display());
|
||||
info!("Watching {}", root.display());
|
||||
|
||||
let (watch_tx, watch_rx) = mpsc::channel();
|
||||
|
||||
@@ -83,7 +83,6 @@ impl Session {
|
||||
let vfs = Arc::clone(&self.vfs);
|
||||
|
||||
thread::spawn(move || {
|
||||
println!("Thread started");
|
||||
loop {
|
||||
match watch_rx.recv() {
|
||||
Ok(event) => {
|
||||
@@ -107,7 +106,7 @@ impl Session {
|
||||
Err(_) => break,
|
||||
};
|
||||
}
|
||||
println!("Thread stopped");
|
||||
info!("Watcher thread stopped");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ use rouille::{self, Request, Response};
|
||||
use ::{
|
||||
id::Id,
|
||||
message_queue::Message,
|
||||
project::Project,
|
||||
rbx::RbxInstance,
|
||||
session::Session,
|
||||
};
|
||||
@@ -54,6 +53,8 @@ impl Server {
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
pub fn handle_request(&self, request: &Request) -> Response {
|
||||
trace!("Request {} {}", request.method(), request.url());
|
||||
|
||||
router!(request,
|
||||
(GET) (/) => {
|
||||
Response::text("Rojo is up and running!")
|
||||
|
||||
Reference in New Issue
Block a user