mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-25 23:26:19 +00:00
Stub out build command for generating rbxmx files
This commit is contained in:
@@ -10,6 +10,8 @@ use std::{
|
|||||||
env,
|
env,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use librojo::commands;
|
||||||
|
|
||||||
fn make_path_absolute(value: &Path) -> PathBuf {
|
fn make_path_absolute(value: &Path) -> PathBuf {
|
||||||
if value.is_absolute() {
|
if value.is_absolute() {
|
||||||
PathBuf::from(value)
|
PathBuf::from(value)
|
||||||
@@ -40,6 +42,11 @@ fn main() {
|
|||||||
(@arg port: --port +takes_value "The port to listen on. Defaults to 8000.")
|
(@arg port: --port +takes_value "The port to listen on. Defaults to 8000.")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(@subcommand build =>
|
||||||
|
(about: "Generates a .model.json, rbxm, or rbxmx model from the project.")
|
||||||
|
(@arg PROJECT: "Path to the project to serve. Defaults to the current directory.")
|
||||||
|
(@arg output: --output +takes_value +required "Where to output the result.")
|
||||||
|
)
|
||||||
).get_matches();
|
).get_matches();
|
||||||
|
|
||||||
match matches.subcommand() {
|
match matches.subcommand() {
|
||||||
@@ -60,6 +67,23 @@ fn main() {
|
|||||||
|
|
||||||
librojo::commands::serve(&project_path);
|
librojo::commands::serve(&project_path);
|
||||||
},
|
},
|
||||||
|
("build", sub_matches) => {
|
||||||
|
let sub_matches = sub_matches.unwrap();
|
||||||
|
|
||||||
|
let fuzzy_project_path = match sub_matches.value_of("PROJECT") {
|
||||||
|
Some(v) => make_path_absolute(Path::new(v)),
|
||||||
|
None => std::env::current_dir().unwrap(),
|
||||||
|
};
|
||||||
|
|
||||||
|
let output_file = make_path_absolute(Path::new(sub_matches.value_of("output").unwrap()));
|
||||||
|
|
||||||
|
let options = commands::BuildOptions {
|
||||||
|
fuzzy_project_path,
|
||||||
|
output_file,
|
||||||
|
};
|
||||||
|
|
||||||
|
commands::build(&options);
|
||||||
|
},
|
||||||
_ => {
|
_ => {
|
||||||
error!("Please specify a subcommand!");
|
error!("Please specify a subcommand!");
|
||||||
error!("Try 'rojo help' for information.");
|
error!("Try 'rojo help' for information.");
|
||||||
|
|||||||
13
server/src/commands/build.rs
Normal file
13
server/src/commands/build.rs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
use std::{
|
||||||
|
path::PathBuf,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct BuildOptions {
|
||||||
|
pub fuzzy_project_path: PathBuf,
|
||||||
|
pub output_file: PathBuf,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build(options: &BuildOptions) {
|
||||||
|
println!("build {:#?}", options);
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
mod serve;
|
mod serve;
|
||||||
mod init;
|
mod init;
|
||||||
|
mod build;
|
||||||
|
|
||||||
pub use self::serve::*;
|
pub use self::serve::*;
|
||||||
pub use self::init::*;
|
pub use self::init::*;
|
||||||
|
pub use self::build::*;
|
||||||
Reference in New Issue
Block a user