Shuffle around Rojo's public API

This commit is contained in:
Lucien Greathouse
2019-12-17 13:58:46 -08:00
parent ce338a2a72
commit 16c9a23d55
11 changed files with 24 additions and 29 deletions

View File

@@ -3,7 +3,7 @@ use std::collections::HashMap;
use rbx_dom_weak::RbxId; use rbx_dom_weak::RbxId;
use serde::Serialize; use serde::Serialize;
use librojo::web_interface::{Instance, InstanceUpdate, ReadResponse, SubscribeResponse}; use librojo::web_api::{Instance, InstanceUpdate, ReadResponse, SubscribeResponse};
use rojo_insta_ext::RedactionMap; use rojo_insta_ext::RedactionMap;
/// A convenience method to store all of the redactable data from a piece of /// A convenience method to store all of the redactable data from a piece of

View File

@@ -11,7 +11,7 @@ use rbx_dom_weak::RbxId;
use tempfile::{tempdir, TempDir}; use tempfile::{tempdir, TempDir};
use librojo::web_interface::{ReadResponse, ServerInfoResponse, SubscribeResponse}; use librojo::web_api::{ReadResponse, ServerInfoResponse, SubscribeResponse};
use rojo_insta_ext::RedactionMap; use rojo_insta_ext::RedactionMap;
use crate::util::{ use crate::util::{

View File

@@ -4,10 +4,7 @@ use failure::Error;
use log::error; use log::error;
use structopt::StructOpt; use structopt::StructOpt;
use librojo::{ use librojo::cli::{self, Options, Subcommand};
cli::{Options, Subcommand},
commands,
};
fn main() { fn main() {
let options = Options::from_args(); let options = Options::from_args();
@@ -50,10 +47,10 @@ fn main() {
fn run(subcommand: Subcommand) -> Result<(), Error> { fn run(subcommand: Subcommand) -> Result<(), Error> {
match subcommand { match subcommand {
Subcommand::Init(init_options) => commands::init(init_options)?, Subcommand::Init(init_options) => cli::init(init_options)?,
Subcommand::Serve(serve_options) => commands::serve(serve_options)?, Subcommand::Serve(serve_options) => cli::serve(serve_options)?,
Subcommand::Build(build_options) => commands::build(build_options)?, Subcommand::Build(build_options) => cli::build(build_options)?,
Subcommand::Upload(upload_options) => commands::upload(upload_options)?, Subcommand::Upload(upload_options) => cli::upload(upload_options)?,
} }
Ok(()) Ok(())

View File

@@ -1,11 +1,19 @@
//! Defines Rojo's CLI through structopt types. //! Defines Rojo's CLI through structopt types.
#![deny(missing_docs)] mod build;
mod init;
mod serve;
mod upload;
use std::{env, error::Error, fmt, path::PathBuf, str::FromStr}; use std::{env, error::Error, fmt, path::PathBuf, str::FromStr};
use structopt::StructOpt; use structopt::StructOpt;
pub use self::build::*;
pub use self::init::*;
pub use self::serve::*;
pub use self::upload::*;
/// Trick used with structopt to get the initial working directory of the /// Trick used with structopt to get the initial working directory of the
/// process and store it for use in default values. /// process and store it for use in default values.
fn working_dir() -> &'static str { fn working_dir() -> &'static str {

View File

@@ -1,9 +0,0 @@
mod build;
mod init;
mod serve;
mod upload;
pub use self::build::*;
pub use self::init::*;
pub use self::serve::*;
pub use self::upload::*;

View File

@@ -6,12 +6,6 @@
mod impl_from; mod impl_from;
pub mod cli; pub mod cli;
pub mod commands;
// This module is only public for testing right now, and won't be
// part of the first version of the Rojo API.
#[doc(hidden)]
pub mod project;
#[cfg(test)] #[cfg(test)]
mod tree_view; mod tree_view;
@@ -23,6 +17,7 @@ mod message_queue;
mod multimap; mod multimap;
mod path_map; mod path_map;
mod path_serializer; mod path_serializer;
mod project;
mod serve_session; mod serve_session;
mod session_id; mod session_id;
mod snapshot; mod snapshot;
@@ -30,5 +25,6 @@ mod snapshot_middleware;
mod vfs; mod vfs;
mod web; mod web;
pub use crate::session_id::SessionId; pub use project::*;
pub use crate::web::interface as web_interface; pub use session_id::SessionId;
pub use web::interface as web_api;

View File

@@ -8,7 +8,7 @@ use rbx_dom_weak::UnresolvedRbxValue;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use snafu::{ResultExt, Snafu}; use snafu::{ResultExt, Snafu};
pub static PROJECT_FILENAME: &str = "default.project.json"; static PROJECT_FILENAME: &str = "default.project.json";
/// Error type returned by any function that handles projects. /// Error type returned by any function that handles projects.
#[derive(Debug, Snafu)] #[derive(Debug, Snafu)]
@@ -26,6 +26,9 @@ enum Error {
}, },
} }
/// Contains all of the configuration for a Rojo-managed project.
///
/// Project files are stored in `.project.json` files.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(deny_unknown_fields, rename_all = "camelCase")] #[serde(deny_unknown_fields, rename_all = "camelCase")]
pub struct Project { pub struct Project {